Skip to content

Commit

Permalink
Added locale text
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Dec 27, 2021
1 parent 343d7bb commit d8c8102
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
14 changes: 10 additions & 4 deletions src/main/java/world/bentobox/limits/calculators/Results.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package world.bentobox.limits.calculators;

import java.util.concurrent.atomic.AtomicLong;

import org.bukkit.Material;
import org.bukkit.entity.EntityType;

import com.google.common.collect.HashMultiset;
import com.google.common.collect.Multiset;
Expand All @@ -23,8 +22,7 @@ public enum Result {
TIMEOUT
}
final Multiset<Material> mdCount = HashMultiset.create();
// AtomicLong and AtomicInteger must be used because they are changed by multiple concurrent threads
AtomicLong rawBlockCount = new AtomicLong(0);
final Multiset<EntityType> entityCount = HashMultiset.create();

final Result state;

Expand All @@ -41,11 +39,19 @@ public Results() {
public Multiset<Material> getMdCount() {
return mdCount;
}

/**
* @return the state
*/
public Result getState() {
return state;
}

/**
* @return the entityCount
*/
public Multiset<EntityType> getEntityCount() {
return entityCount;
}

}
8 changes: 4 additions & 4 deletions src/main/java/world/bentobox/limits/commands/CalcCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

/**
*
* @author YellowZaki
* @author YellowZaki, tastybento
*/
public class CalcCommand extends CompositeCommand {

Expand Down Expand Up @@ -59,13 +59,13 @@ public boolean execute(User user, String label, List<String> args) {
return false;
} else {
//Calculate
user.sendRawMessage("Now recounting. This could take a while, please wait...");
user.sendMessage("island.limits.recount.now-recounting");
new Pipeliner(addon).addIsland(island).thenAccept(results -> {
if (results == null) {
user.sendRawMessage("Already counting...");
user.sendMessage("island.limits.recount.in-progress");
} else {
switch (results.getState()) {
case TIMEOUT -> user.sendRawMessage("Time out when recounting. Is the island really big?");
case TIMEOUT -> user.sendMessage("admin.limits.calc.timeout");
default -> user.sendMessage("admin.limits.calc.finished");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ public boolean canExecute(User user, String label, List<String> args) {
public boolean execute(User user, String label, List<String> args) {
// Set cooldown
setCooldown(user.getUniqueId(), addon.getConfig().getInt("cooldown", 120));
user.sendRawMessage("Now recounting. This could take a while, please wait...");
user.sendMessage("island.limits.recount.now-recounting");
new Pipeliner(addon).addIsland(island).thenAccept(results -> {
if (results == null) {
user.sendRawMessage("Already counting...");
user.sendMessage("island.limits.recount.in-progress");
} else {
switch (results.getState()) {
case TIMEOUT -> user.sendRawMessage("Time out when recounting. Is the island really big?");
case TIMEOUT -> user.sendMessage("admin.limits.calc.timeout");
default -> user.sendMessage("admin.limits.calc.finished");
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ admin:
calc:
parameters: "<player>"
description: "recalculate the island limits for player"
finished: "&aIsland recalc finished successfully!"
finished: "&a Island recalc finished successfully!"

island:
limits:
Expand All @@ -30,4 +30,7 @@ island:
no-limits: "&cNo limits set in this world"
recount:
description: "recounts limits for your island"
now-recounting: "&b Now recounting. This could take a while, please wait..."
in-progress: "&c Island recound is in progress. Please wait..."
time-out: "&c Time out when recounting. Is the island really big?"

0 comments on commit d8c8102

Please sign in to comment.