mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-26 04:25:21 +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.
|
||||
MAUtils.tellAll(this, Msg.ARENA_END, true);
|
||||
arenaPlayers.clear();
|
||||
lobbyPlayers.clear();
|
||||
readyPlayers.clear();
|
||||
notifyPlayers.clear();
|
||||
rewardedPlayers.clear();
|
||||
classMap.clear();
|
||||
@ -593,6 +595,7 @@ public class Arena
|
||||
specPlayers.remove(p);
|
||||
arenaPlayers.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 (WEAPONS_TYPE.contains(stack.getType()))
|
||||
stack.setDurability((short) -32768);
|
||||
stack.setDurability(Short.MIN_VALUE);
|
||||
|
||||
giveItem(inv, stack);
|
||||
//inv.addItem(stack);
|
||||
@ -600,17 +600,30 @@ public class MAUtils
|
||||
|
||||
public static void giveItem(PlayerInventory inv, ItemStack stack)
|
||||
{
|
||||
int id = stack.getTypeId();
|
||||
int amount = stack.getAmount();
|
||||
// If the stack isn't too big, just add it
|
||||
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;
|
||||
|
||||
for (int i = 0; i < times; i++)
|
||||
inv.addItem(new ItemStack(id, 64));
|
||||
|
||||
// Add a bunch of stacks of amount 64.
|
||||
for (int i = 0; i < quotient; i++)
|
||||
inv.addItem(new ItemStack(id, 64, durability, data));
|
||||
|
||||
// Add the rest.
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user