mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-26 12:36:00 +01:00
Fixed item sub-types not working and players not being removed from classMap upon /ma leave
This commit is contained in:
parent
6079c8828e
commit
d164e43c05
BIN
MobArena.jar
BIN
MobArena.jar
Binary file not shown.
@ -239,6 +239,8 @@ public class Arena
|
|||||||
// Announce and clear sets.
|
// Announce and clear sets.
|
||||||
MAUtils.tellAll(this, Msg.ARENA_END, true);
|
MAUtils.tellAll(this, Msg.ARENA_END, true);
|
||||||
arenaPlayers.clear();
|
arenaPlayers.clear();
|
||||||
|
lobbyPlayers.clear();
|
||||||
|
readyPlayers.clear();
|
||||||
notifyPlayers.clear();
|
notifyPlayers.clear();
|
||||||
rewardedPlayers.clear();
|
rewardedPlayers.clear();
|
||||||
classMap.clear();
|
classMap.clear();
|
||||||
@ -593,6 +595,7 @@ public class Arena
|
|||||||
specPlayers.remove(p);
|
specPlayers.remove(p);
|
||||||
arenaPlayers.remove(p);
|
arenaPlayers.remove(p);
|
||||||
lobbyPlayers.remove(p);
|
lobbyPlayers.remove(p);
|
||||||
|
classMap.remove(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -586,7 +586,7 @@ public class MAUtils
|
|||||||
|
|
||||||
// If this is a weapon, set its durability to "unlimited".
|
// If this is a weapon, set its durability to "unlimited".
|
||||||
if (WEAPONS_TYPE.contains(stack.getType()))
|
if (WEAPONS_TYPE.contains(stack.getType()))
|
||||||
stack.setDurability((short) -32768);
|
stack.setDurability(Short.MIN_VALUE);
|
||||||
|
|
||||||
giveItem(inv, stack);
|
giveItem(inv, stack);
|
||||||
//inv.addItem(stack);
|
//inv.addItem(stack);
|
||||||
@ -600,17 +600,30 @@ public class MAUtils
|
|||||||
|
|
||||||
public static void giveItem(PlayerInventory inv, ItemStack stack)
|
public static void giveItem(PlayerInventory inv, ItemStack stack)
|
||||||
{
|
{
|
||||||
int id = stack.getTypeId();
|
// If the stack isn't too big, just add it
|
||||||
int amount = stack.getAmount();
|
if (stack.getAmount() <= 64)
|
||||||
|
{
|
||||||
|
inv.addItem(stack);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int times = amount / 64;
|
// Otherwise, grab the id, durability and data.
|
||||||
|
int id = stack.getTypeId();
|
||||||
|
int amount = stack.getAmount();
|
||||||
|
short durability = stack.getDurability();
|
||||||
|
Byte data = stack.getData() != null ? stack.getData().getData() : null;
|
||||||
|
|
||||||
|
// Initialize the quotient and remainder.
|
||||||
|
int quotient = amount / 64;
|
||||||
int remainder = amount % 64;
|
int remainder = amount % 64;
|
||||||
|
|
||||||
for (int i = 0; i < times; i++)
|
// Add a bunch of stacks of amount 64.
|
||||||
inv.addItem(new ItemStack(id, 64));
|
for (int i = 0; i < quotient; i++)
|
||||||
|
inv.addItem(new ItemStack(id, 64, durability, data));
|
||||||
|
|
||||||
|
// Add the rest.
|
||||||
if (remainder > 0)
|
if (remainder > 0)
|
||||||
inv.addItem(new ItemStack(id, remainder));
|
inv.addItem(new ItemStack(id, remainder, durability, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void giveRewards(Player p, List<ItemStack> stacks, MobArena plugin)
|
public static void giveRewards(Player p, List<ItemStack> stacks, MobArena plugin)
|
||||||
|
Loading…
Reference in New Issue
Block a user