Added resetting money when joining/leaving island (untested)

This commit is contained in:
Florian CUNY 2018-10-30 18:22:26 +01:00
parent b1320906b0
commit 0346ea8a23
6 changed files with 8 additions and 7 deletions

View File

@ -72,7 +72,7 @@ public class AdminDeleteCommand extends ConfirmableCommand {
target.getPlayer().getInventory().clear();
}
if (getSettings().isUseEconomy() && getIWM().isOnLeaveResetMoney(getWorld())) {
// TODO: needs Vault
getPlugin().getVault().ifPresent(vault -> vault.getEconomy().withdrawPlayer(target.getPlayer(), vault.getEconomy().getBalance(target.getPlayer())));
}
}
getIslands().deleteIsland(oldIsland, true);

View File

@ -82,7 +82,7 @@ public class IslandResetCommand extends ConfirmableCommand {
user.getPlayer().getInventory().clear();
}
if (getSettings().isUseEconomy() && getIWM().isOnLeaveResetMoney(getWorld())) {
// TODO: needs Vault
getPlugin().getVault().ifPresent(vault -> vault.getEconomy().withdrawPlayer(user.getPlayer(), vault.getEconomy().getBalance(user.getPlayer())));
}
// Add a reset
getPlayers().addReset(getWorld(), user.getUniqueId());

View File

@ -85,7 +85,7 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand {
user.getPlayer().getInventory().clear();
}
if (getSettings().isUseEconomy() && (getIWM().isOnLeaveResetMoney(getWorld()) || getIWM().isOnJoinResetMoney(getWorld()))) {
// TODO: needs Vault
getPlugin().getVault().ifPresent(vault -> vault.getEconomy().withdrawPlayer(user.getPlayer(), vault.getEconomy().getBalance(user.getPlayer())));
}
// Add the player as a team member of the new island
getIslands().setJoinTeam(teamIsland, playerUUID);

View File

@ -62,7 +62,8 @@ public class IslandTeamKickCommand extends ConfirmableCommand {
}
private void kick(User user, UUID targetUUID) {
User.getInstance(targetUUID).sendMessage("commands.island.team.kick.leader-kicked");
User target = User.getInstance(targetUUID);
target.sendMessage("commands.island.team.kick.leader-kicked");
getIslands().removePlayer(getWorld(), targetUUID);
// Remove money inventory etc.
if (getIWM().isOnLeaveResetEnderChest(getWorld())) {
@ -72,7 +73,7 @@ public class IslandTeamKickCommand extends ConfirmableCommand {
user.getPlayer().getInventory().clear();
}
if (getSettings().isUseEconomy() && getIWM().isOnLeaveResetMoney(getWorld())) {
// TODO: needs Vault
getPlugin().getVault().ifPresent(vault -> vault.getEconomy().withdrawPlayer(target.getPlayer(), vault.getEconomy().getBalance(target.getPlayer())));
}
user.sendMessage("general.success");

View File

@ -54,7 +54,7 @@ public class IslandTeamLeaveCommand extends ConfirmableCommand {
user.getPlayer().getInventory().clear();
}
if (getSettings().isUseEconomy() && getIWM().isOnLeaveResetMoney(getWorld())) {
// TODO: needs Vault
getPlugin().getVault().ifPresent(vault -> vault.getEconomy().withdrawPlayer(user.getPlayer(), vault.getEconomy().getBalance(user.getPlayer())));
}
user.sendMessage("general.success");
}

View File

@ -568,7 +568,7 @@ public class IslandsManager {
user.getPlayer().getInventory().clear();
}
if (plugin.getSettings().isUseEconomy() && plugin.getIWM().isOnJoinResetMoney(world)) {
// TODO: needs Vault
plugin.getVault().ifPresent(vault -> vault.getEconomy().withdrawPlayer(user.getPlayer(), vault.getEconomy().getBalance(user.getPlayer())));
}
}
}