diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/eco/Withdraw.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/eco/Withdraw.java index 6434ab9a..b158f680 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/eco/Withdraw.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/eco/Withdraw.java @@ -1,9 +1,7 @@ package net.Indyuce.mmocore.api.eco; -import java.util.HashSet; -import java.util.Set; -import java.util.UUID; - +import io.lumine.mythic.lib.api.event.PlayerLogoutEvent; +import io.lumine.mythic.lib.api.util.SmartGive; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.ConfigMessage; import net.Indyuce.mmocore.util.item.CurrencyItemBuilder; @@ -16,10 +14,11 @@ import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.ItemStack; -import io.lumine.mythic.lib.api.util.SmartGive; +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; public class Withdraw implements Listener { private static final Set withdrawing = new HashSet<>(); @@ -90,13 +89,18 @@ public class Withdraw implements Listener { Bukkit.getScheduler().runTask(MMOCore.plugin, () -> { MMOCore.plugin.economy.getEconomy().withdrawPlayer(player, worth); - withdrawAlgorythm(worth); + withdrawAlgorithm(worth); player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1); ConfigMessage.fromKey("withdrew").addPlaceholders("worth", worth).send(player); }); } + @Deprecated public void withdrawAlgorythm(int worth) { + withdrawAlgorithm(worth); + } + + public void withdrawAlgorithm(int worth) { int note = worth / 10 * 10; int coins = worth - note; @@ -109,12 +113,8 @@ public class Withdraw implements Listener { smart.give(coinsItem); } - /* - * extra safety - */ - @EventHandler - public void c(PlayerQuitEvent event) { - if (event.getPlayer().equals(player)) - close(); - } + @EventHandler + public void c(PlayerLogoutEvent event) { + if (event.getPlayer().equals(player)) close(); + } } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java index 31275fce..f7e361ec 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java @@ -55,7 +55,7 @@ public class WithdrawCommand extends RegisteredCommand { } MMOCore.plugin.economy.getEconomy().withdrawPlayer(player, amount); - request.withdrawAlgorythm(amount); + request.withdrawAlgorithm(amount); player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1); ConfigMessage.fromKey("withdrew", "worth", amount).send(player); return true; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java index 47bc7492..45488891 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.party.provided; +import io.lumine.mythic.lib.api.event.PlayerLogoutEvent; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.ConfigMessage; import net.Indyuce.mmocore.api.event.social.PartyChatEvent; @@ -10,7 +11,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerQuitEvent; public class PartyListener implements Listener { private final MMOCorePartyModule module; @@ -42,10 +42,9 @@ public class PartyListener implements Listener { } @EventHandler(priority = EventPriority.LOW) - public void leavePartyOnQuit(PlayerQuitEvent event) { + public void leavePartyOnQuit(PlayerLogoutEvent event) { final PlayerData playerData = PlayerData.get(event.getPlayer()); final AbstractParty party = playerData.getParty(); - if (party != null) - ((Party) party).removeMember(playerData); + if (party != null) ((Party) party).removeMember(playerData); } }