mirror of
https://github.com/AppleDash/SaneEconomy.git
synced 2024-11-14 14:15:21 +01:00
Implement possibility to send a player a message when they are given money by an admin.
This commit is contained in:
parent
867535bb4d
commit
71832bfffa
@ -91,6 +91,15 @@ public class EconomyAdminCommand extends SaneCommand {
|
||||
sTargetPlayer,
|
||||
ecoMan.getCurrency().formatAmount(newAmount)
|
||||
);
|
||||
|
||||
if (this.saneEconomy.getConfig().getBoolean("economy.notify-admin-give") && targetPlayer.isOnline()) {
|
||||
this.saneEconomy.getMessenger().sendMessage((Player) targetPlayer, "{1} has given you {2}. Your balance is now {3}.",
|
||||
sender.getName(),
|
||||
ecoMan.getCurrency().formatAmount(amount),
|
||||
ecoMan.getCurrency().formatAmount(newAmount)
|
||||
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -105,6 +114,15 @@ public class EconomyAdminCommand extends SaneCommand {
|
||||
sTargetPlayer,
|
||||
ecoMan.getCurrency().formatAmount(newAmount)
|
||||
);
|
||||
|
||||
if (this.saneEconomy.getConfig().getBoolean("economy.notify-admin-take") && targetPlayer.isOnline()) {
|
||||
this.saneEconomy.getMessenger().sendMessage((Player) targetPlayer, "{1} has taken {2} from you. Your balance is now {3}.",
|
||||
sender.getName(),
|
||||
ecoMan.getCurrency().formatAmount(amount),
|
||||
ecoMan.getCurrency().formatAmount(newAmount)
|
||||
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -126,6 +144,14 @@ public class EconomyAdminCommand extends SaneCommand {
|
||||
));
|
||||
});
|
||||
|
||||
if (this.saneEconomy.getConfig().getBoolean("economy.notify-admin-set") && targetPlayer.isOnline()) {
|
||||
this.saneEconomy.getMessenger().sendMessage((Player) targetPlayer, "{1} has set your balance to {2}.",
|
||||
sender.getName(),
|
||||
ecoMan.getCurrency().formatAmount(amount)
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,6 @@ public class EconomyStorageBackendJSON extends EconomyStorageBackendCaching {
|
||||
private synchronized void saveDatabase() {
|
||||
try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file, false))) {
|
||||
bufferedWriter.write(gson.toJson(balances));
|
||||
bufferedWriter.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Failed to save database", e);
|
||||
}
|
||||
|
@ -18,6 +18,9 @@ economy:
|
||||
notify-start-balance: true
|
||||
server-account: '$SERVER$'
|
||||
baltop-update-interval: 300
|
||||
notify-admin-give: false
|
||||
notify-admin-take: false
|
||||
notify-admin-set: false
|
||||
|
||||
multi-server-sync: false
|
||||
update-check: true
|
||||
|
@ -5,7 +5,7 @@
|
||||
# To be clear: DO NOT change 'message'. Simply add a new, indented 'translation' line below it, with the changed message.
|
||||
# Colors can also be used, by means of prefixing color codes with an '&' symbol.
|
||||
# The order of placeholders can be changed. Anything after the :, like the '02d' in {1:02d} is a Java String.format specifier. If you don't know what that is, I recommend leaving it as-is.
|
||||
# IMPORTANT: If your translation has a colon ( : ) character inside of it, you must enclose the entire part after "message: " in single quotes ( ' ).
|
||||
# IMPORTANT: If your translation has a colon ( : ) character inside of it, you must enclose the entire part after "translation: " in single quotes ( ' ).
|
||||
# If this file doesn't work for some reason, check your console for errors with "SnakeYAML" included in them.
|
||||
messages:
|
||||
- message: "You don't have permission to check the balance of {1}."
|
||||
@ -20,6 +20,9 @@ messages:
|
||||
- message: "Added {1} to {2}. Their balance is now {3}."
|
||||
- message: "Took {1} from {2}. Their balance is now {3}."
|
||||
- message: "Balance for {1} set to {2}."
|
||||
- message: "{1} has given you {2}. Your balance is now {3}."
|
||||
- message: "{1} has taken {2} from you. Your balance is now {3}."
|
||||
- message: "{1} has set your balance to {2}."
|
||||
- message: "You do not have enough money to transfer {1} to {2}."
|
||||
- message: "You have transferred {1} to {2}."
|
||||
- message: "You have received {1} from {2}."
|
||||
@ -37,3 +40,4 @@ messages:
|
||||
- message: "/<command> <page>"
|
||||
- message: "/<command> <give/take/set> [player] <amount>"
|
||||
- message: "/<command> reload-database"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user