Final polish on builder box

This commit is contained in:
AlexTheCoder 2017-06-15 23:06:38 -04:00
parent e8a4e23f05
commit 1ea0b4d33a

View File

@ -20,7 +20,9 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.common.Pair;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.game.clans.clans.ClansManager;
@ -48,6 +50,7 @@ public class BuilderBoxInventory implements Listener
_replace.put(Pair.create(Material.RED_ROSE, (byte)8), new ItemStack(Material.RED_ROSE));
_replace.put(Pair.create(Material.COBBLE_WALL, (byte)0), new ItemStack(Material.COBBLE_WALL));
_replace.put(Pair.create(Material.JACK_O_LANTERN, (byte)0), new ItemStack(Material.GLOWSTONE));
_replace.put(Pair.create(Material.SMOOTH_BRICK, (byte)0), new ItemStack(Material.SMOOTH_BRICK));
UtilServer.RegisterEvents(this);
}
@ -77,6 +80,10 @@ public class BuilderBoxInventory implements Listener
{
after.setData((short)0);
}
else if (after.getType() == Material.SMOOTH_BRICK)
{
after.setData(UtilMath.randomElement(new Short[] {1, 3}).shortValue());
}
else
{
after.setData(UtilMath.randomElement(DyeColor.values()).getWoolData());
@ -139,6 +146,7 @@ public class BuilderBoxInventory implements Listener
if (totalChanged > 0)
{
ClansManager.getInstance().getInventoryManager().addItemToInventory((Player)event.getPlayer(), BoxType.BUILDER_BOX.getItemName(), -1);
UtilPlayer.message(event.getPlayer(), F.main("Builder's Box", "You have redeemed your box contents!"));
}
}
}