parent
343d7bbbde
commit
d8c8102010
|
@ -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;
|
||||
|
@ -23,8 +22,7 @@ public class Results {
|
|||
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;
|
||||
|
||||
|
@ -41,6 +39,7 @@ public class Results {
|
|||
public Multiset<Material> getMdCount() {
|
||||
return mdCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the state
|
||||
*/
|
||||
|
@ -48,4 +47,11 @@ public class Results {
|
|||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the entityCount
|
||||
*/
|
||||
public Multiset<EntityType> getEntityCount() {
|
||||
return entityCount;
|
||||
}
|
||||
|
||||
}
|
|
@ -14,7 +14,7 @@ import world.bentobox.limits.calculators.Pipeliner;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author YellowZaki
|
||||
* @author YellowZaki, tastybento
|
||||
*/
|
||||
public class CalcCommand extends CompositeCommand {
|
||||
|
||||
|
@ -59,13 +59,13 @@ public class CalcCommand extends CompositeCommand {
|
|||
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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,13 +60,13 @@ public class RecountCommand extends CompositeCommand {
|
|||
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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
@ -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?"
|
||||
|
||||
|
|
Loading…
Reference in New Issue