Fix item glitching.
Let's see you glitch items out now, suckers!
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
name: MobArena
|
name: MobArena
|
||||||
author: garbagemule
|
author: garbagemule
|
||||||
main: com.garbagemule.MobArena.MobArena
|
main: com.garbagemule.MobArena.MobArena
|
||||||
version: 0.95.5.27
|
version: 0.95.5.28
|
||||||
softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault]
|
softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault]
|
||||||
commands:
|
commands:
|
||||||
ma:
|
ma:
|
||||||
|
|||||||
@@ -15,9 +15,8 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.*;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
|
||||||
import org.bukkit.permissions.PermissionAttachment;
|
import org.bukkit.permissions.PermissionAttachment;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
@@ -625,6 +624,11 @@ public class ArenaImpl implements Arena
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear inventory if player is an arena player
|
||||||
|
if (arenaPlayers.contains(p)) {
|
||||||
|
clearInv(p);
|
||||||
|
}
|
||||||
|
|
||||||
removeClassPermissions(p);
|
removeClassPermissions(p);
|
||||||
removePotionEffects(p);
|
removePotionEffects(p);
|
||||||
|
|
||||||
@@ -658,7 +662,10 @@ public class ArenaImpl implements Arena
|
|||||||
ArenaPlayerDeathEvent event = new ArenaPlayerDeathEvent(p, this, last);
|
ArenaPlayerDeathEvent event = new ArenaPlayerDeathEvent(p, this, last);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
arenaPlayers.remove(p);
|
// Clear the player's inventory
|
||||||
|
if (arenaPlayers.remove(p)) {
|
||||||
|
clearInv(p);
|
||||||
|
}
|
||||||
|
|
||||||
if (!settings.getBoolean("auto-respawn", true)) {
|
if (!settings.getBoolean("auto-respawn", true)) {
|
||||||
deadPlayers.add(p);
|
deadPlayers.add(p);
|
||||||
@@ -671,6 +678,15 @@ public class ArenaImpl implements Arena
|
|||||||
endArena();
|
endArena();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void clearInv(Player p) {
|
||||||
|
InventoryView view = p.getOpenInventory();
|
||||||
|
if (view != null) {
|
||||||
|
view.setCursor(new ItemStack(0));
|
||||||
|
view.getBottomInventory().clear();
|
||||||
|
view.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playerRespawn(Player p) {
|
public void playerRespawn(Player p) {
|
||||||
if (settings.getBoolean("auto-respawn", true)) {
|
if (settings.getBoolean("auto-respawn", true)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user