mirror of
https://github.com/AppleDash/SaneEconomy.git
synced 2024-11-22 18:16:11 +01:00
Merge branch 'master' of github.com:AppleDash/SaneEconomy
This commit is contained in:
commit
d86233af74
@ -22,23 +22,26 @@ public abstract class SaneEconomyCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
try {
|
||||
if (!sender.hasPermission(getPermission())) {
|
||||
throw new NoPermissionException();
|
||||
saneEconomy.getServer().getScheduler().scheduleAsyncDelayedTask(saneEconomy, () -> {
|
||||
try {
|
||||
if (!sender.hasPermission(getPermission())) {
|
||||
throw new NoPermissionException();
|
||||
}
|
||||
|
||||
|
||||
onCommand(sender, args);
|
||||
} catch (UsageException e) {
|
||||
/* Invalid usage in some way, print out exactly what went wrong along with the proper usage. */
|
||||
MessageUtils.sendMessage(sender, e.getMessage());
|
||||
|
||||
|
||||
for (String s : getUsage()) {
|
||||
MessageUtils.sendMessage(sender, "Usage: {1}", s.replace("<command>", label));
|
||||
}
|
||||
} catch (CommandException e) {
|
||||
MessageUtils.sendMessage(sender, e.getMessage());
|
||||
}
|
||||
|
||||
onCommand(sender, args);
|
||||
} catch (UsageException e) {
|
||||
/* Invalid usage in some way, print out exactly what went wrong along with the proper usage. */
|
||||
MessageUtils.sendMessage(sender, e.getMessage());
|
||||
|
||||
for (String s : getUsage()) {
|
||||
MessageUtils.sendMessage(sender, "Usage: {1}", s.replace("<command>", label));
|
||||
}
|
||||
} catch (CommandException e) {
|
||||
MessageUtils.sendMessage(sender, e.getMessage());
|
||||
}
|
||||
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -9,13 +9,14 @@ import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* Created by appledash on 7/19/16.
|
||||
* Blackjack is still best pony.
|
||||
*/
|
||||
public abstract class EconomyStorageBackendCaching implements EconomyStorageBackend {
|
||||
protected HashMap<String, Double> balances = new HashMap<>();
|
||||
protected Map<String, Double> balances = new ConcurrentHashMap<>();
|
||||
private LinkedHashMap<UUID, Double> topPlayerBalances = new LinkedHashMap<>();
|
||||
|
||||
@Override
|
||||
@ -24,7 +25,7 @@ public abstract class EconomyStorageBackendCaching implements EconomyStorageBack
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized double getBalance(Economable economable) {
|
||||
public double getBalance(Economable economable) {
|
||||
if (!accountExists(economable)) {
|
||||
return 0.0D;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public class MessageUtils {
|
||||
* @param fmt String#format format
|
||||
* @param args String#format args
|
||||
*/
|
||||
public static void sendMessage(CommandSender target, String fmt, Object... args) {
|
||||
public static synchronized void sendMessage(CommandSender target, String fmt, Object... args) {
|
||||
fmt = _(fmt);
|
||||
|
||||
String prefix = ChatColor.translateAlternateColorCodes('&', SaneEconomy.getInstance().getConfig().getString("chat.prefix", ""));
|
||||
|
Loading…
Reference in New Issue
Block a user