poprawka logowania komend
This commit is contained in:
@@ -148,7 +148,7 @@ public class MscroleAdminCommand implements CommandExecutor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getCurrencyManager().addBalance(target, amount);
|
plugin.getCurrencyManager().addBalance(target, amount, sender.getName());
|
||||||
sender.sendMessage(plugin.getPrefix() + plugin.getMessageManager().getMessage("currency-given").replace("{amount}", String.valueOf(amount)).replace("{receiver}", target.getName()));
|
sender.sendMessage(plugin.getPrefix() + plugin.getMessageManager().getMessage("currency-given").replace("{amount}", String.valueOf(amount)).replace("{receiver}", target.getName()));
|
||||||
target.sendMessage(plugin.getPrefix() + plugin.getMessageManager().getMessage("currency-received-from-admin").replace("{amount}", String.valueOf(amount)));
|
target.sendMessage(plugin.getPrefix() + plugin.getMessageManager().getMessage("currency-received-from-admin").replace("{amount}", String.valueOf(amount)));
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ public class MscroleAdminCommand implements CommandExecutor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getCurrencyManager().subtractBalance(target, amount);
|
plugin.getCurrencyManager().subtractBalance(target, amount, sender.getName());
|
||||||
sender.sendMessage(plugin.getPrefix() + plugin.getMessageManager().getMessage("currency-taken").replace("{amount}", String.valueOf(amount)).replace("{player}", target.getName()));
|
sender.sendMessage(plugin.getPrefix() + plugin.getMessageManager().getMessage("currency-taken").replace("{amount}", String.valueOf(amount)).replace("{player}", target.getName()));
|
||||||
target.sendMessage(plugin.getPrefix() + plugin.getMessageManager().getMessage("currency-taken-by-admin").replace("{amount}", String.valueOf(amount)));
|
target.sendMessage(plugin.getPrefix() + plugin.getMessageManager().getMessage("currency-taken-by-admin").replace("{amount}", String.valueOf(amount)));
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ public class MscroleAdminCommand implements CommandExecutor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getCurrencyManager().setBalance(target, amount);
|
plugin.getCurrencyManager().setBalance(target, amount, sender.getName());
|
||||||
sender.sendMessage(plugin.getPrefix() + plugin.getMessageManager().getMessage("balance-set").replace("{player}", target.getName()).replace("{amount}", String.valueOf(amount)));
|
sender.sendMessage(plugin.getPrefix() + plugin.getMessageManager().getMessage("balance-set").replace("{player}", target.getName()).replace("{amount}", String.valueOf(amount)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,8 +118,8 @@ public class MscroleCommand implements CommandExecutor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getCurrencyManager().subtractBalance(player, amount);
|
plugin.getCurrencyManager().subtractBalance(player, amount, player.getName());
|
||||||
plugin.getCurrencyManager().addBalance(target, amount);
|
plugin.getCurrencyManager().addBalance(target, amount, player.getName());
|
||||||
|
|
||||||
player.sendMessage(plugin.getPrefix() + plugin.getMessageManager().getMessage("currency-sent").replace("{amount}", String.valueOf(amount)).replace("{receiver}", target.getName()));
|
player.sendMessage(plugin.getPrefix() + plugin.getMessageManager().getMessage("currency-sent").replace("{amount}", String.valueOf(amount)).replace("{receiver}", target.getName()));
|
||||||
target.sendMessage(plugin.getPrefix() + plugin.getMessageManager().getMessage("currency-received").replace("{amount}", String.valueOf(amount)).replace("{sender}", player.getName()));
|
target.sendMessage(plugin.getPrefix() + plugin.getMessageManager().getMessage("currency-received").replace("{amount}", String.valueOf(amount)).replace("{sender}", player.getName()));
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class GuiListener implements Listener {
|
|||||||
if (price > 0) {
|
if (price > 0) {
|
||||||
int balance = plugin.getCurrencyManager().getBalance(player);
|
int balance = plugin.getCurrencyManager().getBalance(player);
|
||||||
if (balance >= price) {
|
if (balance >= price) {
|
||||||
plugin.getCurrencyManager().subtractBalance(player, price);
|
plugin.getCurrencyManager().subtractBalance(player, price, "CONSOLE");
|
||||||
for (String command : commands) {
|
for (String command : commands) {
|
||||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), command.replace("%player%", player.getName()));
|
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), command.replace("%player%", player.getName()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class PlayerJoinListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (!player.hasPlayedBefore()) {
|
if (!player.hasPlayedBefore()) {
|
||||||
int startingBalance = plugin.getConfig().getInt("starting-balance", 1000);
|
int startingBalance = plugin.getConfig().getInt("starting-balance", 1000);
|
||||||
plugin.getCurrencyManager().setBalance(player, startingBalance);
|
plugin.getCurrencyManager().setBalance(player, startingBalance, "CONSOLE");
|
||||||
player.sendMessage(plugin.getPrefix() + plugin.getMessageManager().getMessage("player-join").replace("{player}", player.getName()).replace("{amount}", String.valueOf(startingBalance)));
|
player.sendMessage(plugin.getPrefix() + plugin.getMessageManager().getMessage("player-join").replace("{player}", player.getName()).replace("{amount}", String.valueOf(startingBalance)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,31 +23,31 @@ public class CurrencyManager {
|
|||||||
return dataManager.getConfig().getInt("balances." + uuid.toString(), 0);
|
return dataManager.getConfig().getInt("balances." + uuid.toString(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBalance(Player player, int amount) {
|
public void setBalance(Player player, int amount, String actor) {
|
||||||
setBalance(player.getUniqueId(), amount);
|
setBalance(player.getUniqueId(), amount, actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBalance(UUID uuid, int amount) {
|
public void setBalance(UUID uuid, int amount, String actor) {
|
||||||
dataManager.getConfig().set("balances." + uuid.toString(), amount);
|
dataManager.getConfig().set("balances." + uuid.toString(), amount);
|
||||||
dataManager.saveConfig();
|
dataManager.saveConfig();
|
||||||
plugin.logToFile("[Currency] Set balance of " + uuid.toString() + " to " + amount);
|
plugin.logToFile("[Currency] Actor: " + actor + " set balance of " + uuid.toString() + " to " + amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBalance(Player player, int amount) {
|
public void addBalance(Player player, int amount, String actor) {
|
||||||
addBalance(player.getUniqueId(), amount);
|
addBalance(player.getUniqueId(), amount, actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBalance(UUID uuid, int amount) {
|
public void addBalance(UUID uuid, int amount, String actor) {
|
||||||
setBalance(uuid, getBalance(uuid) + amount);
|
setBalance(uuid, getBalance(uuid) + amount, actor);
|
||||||
plugin.logToFile("[Currency] Added " + amount + " to " + uuid.toString());
|
plugin.logToFile("[Currency] Actor: " + actor + " added " + amount + " to " + uuid.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void subtractBalance(Player player, int amount) {
|
public void subtractBalance(Player player, int amount, String actor) {
|
||||||
subtractBalance(player.getUniqueId(), amount);
|
subtractBalance(player.getUniqueId(), amount, actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void subtractBalance(UUID uuid, int amount) {
|
public void subtractBalance(UUID uuid, int amount, String actor) {
|
||||||
setBalance(uuid, getBalance(uuid) - amount);
|
setBalance(uuid, getBalance(uuid) - amount, actor);
|
||||||
plugin.logToFile("[Currency] Subtracted " + amount + " from " + uuid.toString());
|
plugin.logToFile("[Currency] Actor: " + actor + " subtracted " + amount + " from " + uuid.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user