Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex
This commit is contained in:
commit
d62b59776f
@ -37,7 +37,7 @@ public class CosmeticManager extends MiniPlugin
|
||||
private boolean _showInterface = true;
|
||||
private int _interfaceSlot = 4;
|
||||
|
||||
public CosmeticManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, GadgetManager gadgetManager, MountManager mountManager, PetManager petManager)
|
||||
public CosmeticManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, GadgetManager gadgetManager, MountManager mountManager, PetManager petManager, boolean useBooster)
|
||||
{
|
||||
super("Cosmetic Manager", plugin);
|
||||
|
||||
@ -46,7 +46,7 @@ public class CosmeticManager extends MiniPlugin
|
||||
_mountManager = mountManager;
|
||||
_petManager = petManager;
|
||||
|
||||
_shop = new CosmeticShop(this, clientManager, donationManager, _moduleName);
|
||||
_shop = new CosmeticShop(this, clientManager, donationManager, _moduleName, useBooster);
|
||||
}
|
||||
|
||||
public void showInterface(boolean showInterface)
|
||||
|
@ -0,0 +1,44 @@
|
||||
package mineplex.core.cosmetic.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class ActivateGemBoosterEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Player _player;
|
||||
|
||||
private boolean _cancelled = false;
|
||||
|
||||
public ActivateGemBoosterEvent(Player player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel)
|
||||
{
|
||||
_cancelled = cancel;
|
||||
}
|
||||
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
}
|
@ -7,11 +7,12 @@ import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.PetTagPage;
|
||||
import mineplex.core.cosmetic.ui.page.TreasurePage;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent;
|
||||
import mineplex.core.shop.ShopBase;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -19,10 +20,13 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMessageListener
|
||||
{
|
||||
public CosmeticShop(CosmeticManager plugin, CoreClientManager clientManager, DonationManager donationManager, String name)
|
||||
private boolean _useBooster;
|
||||
|
||||
public CosmeticShop(CosmeticManager plugin, CoreClientManager clientManager, DonationManager donationManager, String name, boolean useBooster)
|
||||
{
|
||||
super(plugin, clientManager, donationManager, name, CurrencyType.Gems, CurrencyType.Coins);
|
||||
|
||||
_useBooster = useBooster;
|
||||
plugin.GetPlugin().getServer().getMessenger().registerIncomingPluginChannel(plugin.GetPlugin(), "MC|ItemName", this);
|
||||
}
|
||||
|
||||
@ -49,6 +53,12 @@ public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMes
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void itemGadgetEmptyAmmo(ItemGadgetOutOfAmmoEvent event)
|
||||
{
|
||||
new GadgetPage(Plugin, this, ClientManager, DonationManager, "Gadgets", event.getPlayer()).purchaseGadget(event.getPlayer(), event.getGadget());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateTreasure(UpdateEvent event)
|
||||
{
|
||||
@ -61,4 +71,9 @@ public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMes
|
||||
((TreasurePage) shop).update();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getBoosterEnabled()
|
||||
{
|
||||
return _useBooster;
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
if (Plugin.getInventoryManager().Get(player).getItemCount(gadget.GetName()) <= 0)
|
||||
{
|
||||
PlayDenySound(player);
|
||||
purchaseGadget(player, gadget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1,29 +1,26 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.event.ActivateGemBoosterEvent;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
import mineplex.core.cosmetic.ui.button.DeactivateGadgetButton;
|
||||
import mineplex.core.cosmetic.ui.button.DeactivateMountButton;
|
||||
import mineplex.core.cosmetic.ui.button.DeactivatePetButton;
|
||||
import mineplex.core.cosmetic.ui.button.OpenGadgets;
|
||||
import mineplex.core.cosmetic.ui.button.OpenMorphs;
|
||||
import mineplex.core.cosmetic.ui.button.OpenMounts;
|
||||
import mineplex.core.cosmetic.ui.button.OpenParticles;
|
||||
import mineplex.core.cosmetic.ui.button.OpenPets;
|
||||
import mineplex.core.cosmetic.ui.button.TreasureButton;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.inventory.GemBooster;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.item.SingleButton;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
@ -52,35 +49,48 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
else
|
||||
{
|
||||
*/
|
||||
AddItem(13, new ShopItem(Material.CHEST, C.cGold + treasureChestCount + " Treasure Chests", 1, false));
|
||||
AddItem(13, new ShopItem(Material.CHEST, C.cGold + treasureChestCount + " Treasure Chests (COMING SOON!)", 1, false));
|
||||
//}
|
||||
|
||||
final GemBooster gemBoosterItem = new GemBooster(Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster"));
|
||||
final GemBooster gemBoosterItem = new GemBooster(Shop.getBoosterEnabled(), Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster"));
|
||||
|
||||
if (DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= gemBoosterItem.GetCost(CurrencyType.Coins))
|
||||
{
|
||||
AddButton(15, new ShopItem(
|
||||
gemBoosterItem.GetDisplayMaterial(),
|
||||
gemBoosterItem.GetDisplayName(),
|
||||
gemBoosterItem.GetDescription(),
|
||||
1,
|
||||
false),
|
||||
new SingleButton()
|
||||
|
||||
AddButton(15, new ShopItem(
|
||||
gemBoosterItem.GetDisplayMaterial(),
|
||||
gemBoosterItem.GetDisplayName(),
|
||||
gemBoosterItem.GetDescription(),
|
||||
1,
|
||||
false),
|
||||
new IButton()
|
||||
{
|
||||
@Override
|
||||
public void ClickedLeft(Player player)
|
||||
{
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
if (Shop.getBoosterEnabled())
|
||||
{
|
||||
Shop.OpenPageForPlayer(Player, new ConfirmationPage<CosmeticManager, CosmeticShop>(Plugin, Shop, ClientManager, DonationManager, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Plugin.getInventoryManager().addItemToInventory(Player, "Utility", "Gem Booster", 20);
|
||||
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, Player));
|
||||
}
|
||||
}, null, gemBoosterItem, CurrencyType.Coins, Player));
|
||||
ActivateGemBoosterEvent boosterEvent = new ActivateGemBoosterEvent(player);
|
||||
Bukkit.getServer().getPluginManager().callEvent(boosterEvent);
|
||||
|
||||
if (!boosterEvent.isCancelled())
|
||||
Plugin.getInventoryManager().addItemToInventory(Player, "Utility", "Gem Booster", -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
purchaseGemBooster(gemBoosterItem, player);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@Override
|
||||
public void ClickedRight(Player player)
|
||||
{
|
||||
purchaseGemBooster(gemBoosterItem, player);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= gemBoosterItem.GetCost(CurrencyType.Coins))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -186,6 +196,18 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
}
|
||||
}
|
||||
|
||||
private void purchaseGemBooster(GemBooster gemBoosterItem, Player player)
|
||||
{
|
||||
Shop.OpenPageForPlayer(Player, new ConfirmationPage<CosmeticManager, CosmeticShop>(Plugin, Shop, ClientManager, DonationManager, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Plugin.getInventoryManager().addItemToInventory(Player, "Utility", "Gem Booster", 20);
|
||||
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, Player));
|
||||
}
|
||||
}, null, gemBoosterItem, CurrencyType.Coins, Player));
|
||||
}
|
||||
|
||||
public void openParticles(Player player)
|
||||
{
|
||||
Shop.OpenPageForPlayer(player, new ParticlePage(Plugin, Shop, ClientManager, DonationManager, "Particles", player));
|
||||
|
@ -68,6 +68,7 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
PlayDenySound(Player);
|
||||
|
||||
Shop.OpenPageForPlayer(Player, new PetPage(Plugin, Shop, ClientManager, DonationManager, "Pets", Player));
|
||||
return;
|
||||
}
|
||||
|
||||
PetExtra tag = new PetExtra("Rename " + _pet.GetName() + " to " + _tagName, Material.NAME_TAG, 100);
|
||||
|
@ -324,7 +324,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
}
|
||||
}
|
||||
else if (packet instanceof PacketPlayOutEntityMetadata)
|
||||
{
|
||||
{
|
||||
int entityId = ((PacketPlayOutEntityMetadata)packet).a;
|
||||
|
||||
if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId)
|
||||
|
@ -0,0 +1,41 @@
|
||||
package mineplex.core.gadget.event;
|
||||
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class ItemGadgetOutOfAmmoEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Player _player;
|
||||
private ItemGadget _gadget;
|
||||
|
||||
public ItemGadgetOutOfAmmoEvent(Player player, ItemGadget gadget)
|
||||
{
|
||||
_player = player;
|
||||
_gadget = gadget;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public ItemGadget getGadget()
|
||||
{
|
||||
return _gadget;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -75,12 +76,16 @@ public class ItemPaintballGun extends ItemGadget
|
||||
|
||||
if (block.getType() == Material.CACTUS)
|
||||
return;
|
||||
|
||||
if (block.getType() == Material.SUGAR_CANE_BLOCK)
|
||||
return;
|
||||
}
|
||||
|
||||
List<Block> blocks = new ArrayList<Block>();
|
||||
blocks.addAll(UtilBlock.getInRadius(loc, 1.5d).keySet());
|
||||
|
||||
GadgetBlockEvent gadgetEvent = new GadgetBlockEvent(this, blocks);
|
||||
Bukkit.getServer().getPluginManager().callEvent(gadgetEvent);
|
||||
|
||||
if (gadgetEvent.isCancelled())
|
||||
return;
|
||||
|
@ -20,6 +20,7 @@ import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent;
|
||||
import mineplex.core.gadget.gadgets.Ammo;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
@ -72,7 +73,7 @@ public abstract class ItemGadget extends Gadget
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cWhite + "Your Ammo : " + Manager.getInventoryManager().Get(player).getItemCount(GetName()));
|
||||
|
||||
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(GetName())));
|
||||
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())));
|
||||
|
||||
if (inform)
|
||||
UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(GetName()) + "."));
|
||||
@ -146,13 +147,19 @@ public abstract class ItemGadget extends Gadget
|
||||
|
||||
if (Manager.getInventoryManager().Get(player).getItemCount(GetName()) <= 0)
|
||||
{
|
||||
|
||||
UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left."));
|
||||
Disable(player);
|
||||
|
||||
ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this);
|
||||
Bukkit.getServer().getPluginManager().callEvent(ammoEvent);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Manager.getInventoryManager().addItemToInventory(player, getGadgetType().name(), GetName(), -1);
|
||||
|
||||
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())));
|
||||
|
||||
ActivateCustom(event.getPlayer());
|
||||
}
|
||||
|
||||
|
@ -5,20 +5,25 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
import mineplex.core.shop.item.SalesPackageBase;
|
||||
|
||||
public class GemBooster extends SalesPackageBase
|
||||
{
|
||||
public GemBooster(int gemBoosters)
|
||||
public GemBooster(boolean enabled, int gemBoosters)
|
||||
{
|
||||
super("20 Gem Booster Pack", Material.EMERALD, (byte)0, new String[]
|
||||
{
|
||||
C.cYellow + "1000 Coins",
|
||||
" ",
|
||||
(enabled ? C.cGreen + "Left-Click To Use:" : ""),
|
||||
C.cWhite + "Use these before games start to",
|
||||
C.cWhite + "boost the amount of Gems earned",
|
||||
C.cWhite + "for all players in the game!",
|
||||
" ",
|
||||
C.cGreen + "Right-Click To Purchase:",
|
||||
C.cWhite + "20 Gem Boosters for " + C.cYellow + "1000 Coins",
|
||||
" ",
|
||||
C.cWhite + "Your Gem Boosters: " + C.cGreen + gemBoosters
|
||||
}, 1000, 20);
|
||||
|
||||
|
@ -14,6 +14,7 @@ import java.util.UUID;
|
||||
import net.minecraft.server.v1_7_R4.EntityAgeable;
|
||||
import net.minecraft.server.v1_7_R4.EntityInsentient;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World.Environment;
|
||||
@ -27,6 +28,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
@ -43,6 +45,8 @@ import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.core.creature.event.CreatureKillEntitiesEvent;
|
||||
import mineplex.core.npc.Commands.NpcCommand;
|
||||
import mineplex.core.npc.event.NpcDamageByEntityEvent;
|
||||
import mineplex.core.npc.event.NpcInteractEntityEvent;
|
||||
|
||||
public class NpcManager extends MiniPlugin
|
||||
{
|
||||
@ -118,6 +122,23 @@ public class NpcManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void OnEntityDamage(EntityDamageByEntityEvent event)
|
||||
{
|
||||
if (_npcs.containsKey(event.getEntity().getUniqueId().toString()))
|
||||
{
|
||||
if (event.getDamager() instanceof LivingEntity)
|
||||
{
|
||||
NpcDamageByEntityEvent npcEvent = new NpcDamageByEntityEvent((LivingEntity)event.getEntity(), (LivingEntity)event.getDamager());
|
||||
|
||||
Bukkit.getServer().getPluginManager().callEvent(npcEvent);
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void OnCreatureKillEntities(CreatureKillEntitiesEvent event)
|
||||
{
|
||||
@ -225,6 +246,10 @@ public class NpcManager extends MiniPlugin
|
||||
|
||||
if (_npcs.containsKey(event.getRightClicked().getUniqueId().toString()))
|
||||
{
|
||||
NpcInteractEntityEvent npcEvent = new NpcInteractEntityEvent((LivingEntity)event.getRightClicked(), event.getPlayer());
|
||||
|
||||
Bukkit.getServer().getPluginManager().callEvent(npcEvent);
|
||||
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -521,4 +546,9 @@ public class NpcManager extends MiniPlugin
|
||||
{
|
||||
return _npcs.get(uniqueId.toString());
|
||||
}
|
||||
|
||||
public boolean isNpc(LivingEntity entity)
|
||||
{
|
||||
return _npcs.containsKey(entity.getUniqueId().toString());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package mineplex.core.npc.event;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public class NpcDamageByEntityEvent extends NpcEvent
|
||||
{
|
||||
private LivingEntity _damager;
|
||||
|
||||
public NpcDamageByEntityEvent(LivingEntity npc, LivingEntity damager)
|
||||
{
|
||||
super(npc);
|
||||
|
||||
_damager = damager;
|
||||
}
|
||||
|
||||
public LivingEntity getDamager()
|
||||
{
|
||||
return _damager;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package mineplex.core.npc.event;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class NpcEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private LivingEntity _npc;
|
||||
|
||||
private boolean _cancelled = false;
|
||||
|
||||
public NpcEvent(LivingEntity npc)
|
||||
{
|
||||
_npc = npc;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public LivingEntity getNpc()
|
||||
{
|
||||
return _npc;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel)
|
||||
{
|
||||
_cancelled = cancel;
|
||||
}
|
||||
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package mineplex.core.npc.event;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class NpcInteractEntityEvent extends NpcEvent
|
||||
{
|
||||
private Player _player;
|
||||
|
||||
public NpcInteractEntityEvent(LivingEntity npc, Player player)
|
||||
{
|
||||
super(npc);
|
||||
|
||||
_player = player;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
}
|
@ -93,7 +93,7 @@ public class ServerCommand extends CommandBase<Portal>
|
||||
{
|
||||
UtilPlayer.message(
|
||||
player,
|
||||
F.main(Plugin.GetName(), C.cRed + "You don't have permission to join " + C.cGold + args[0]));
|
||||
F.main(Plugin.GetName(), C.cRed + "You don't have permission to join " + C.cGold + args[0] + " with /server"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class PreferencesShop extends ShopBase<PreferencesManager>
|
||||
{
|
||||
public PreferencesShop(PreferencesManager plugin, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager)
|
||||
public PreferencesShop(PreferencesManager plugin, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager)
|
||||
{
|
||||
super(plugin, clientManager, donationManager, "User Preferences");
|
||||
}
|
||||
|
@ -22,6 +22,9 @@ import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
import mineplex.core.npc.event.NpcDamageByEntityEvent;
|
||||
import mineplex.core.npc.event.NpcInteractEntityEvent;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
|
||||
public abstract class ShopBase<PluginType extends MiniPlugin> implements Listener
|
||||
@ -62,28 +65,22 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void OnPlayerDamageEntity(EntityDamageByEntityEvent event)
|
||||
public void OnPlayerDamageEntity(NpcDamageByEntityEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof LivingEntity)
|
||||
if (event.getDamager() instanceof Player)
|
||||
{
|
||||
if (event.getDamager() instanceof Player)
|
||||
{
|
||||
if (AttemptShopOpen((Player)event.getDamager(), (LivingEntity)event.getEntity()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
if (AttemptShopOpen((Player)event.getDamager(), event.getNpc()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void OnPlayerInteractEntity(PlayerInteractEntityEvent event)
|
||||
public void OnPlayerInteractEntity(NpcInteractEntityEvent event)
|
||||
{
|
||||
if (event.getRightClicked() instanceof LivingEntity)
|
||||
{
|
||||
if (AttemptShopOpen(event.getPlayer(), (LivingEntity)event.getRightClicked()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
if (AttemptShopOpen(event.getPlayer(), (LivingEntity)event.getNpc()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
private boolean AttemptShopOpen(Player player, LivingEntity entity)
|
||||
|
@ -48,29 +48,14 @@ public class StatsManager extends MiniClientPlugin<PlayerStats>
|
||||
}
|
||||
}
|
||||
|
||||
public void incrementStat(Player player, final String statName, int value)
|
||||
public void incrementStat(Player player, final String statName, final int value)
|
||||
{
|
||||
int newValue = Get(player).addStat(statName, value);
|
||||
|
||||
//Event
|
||||
UtilServer.getServer().getPluginManager().callEvent(new StatChangeEvent(player.getName(), statName, newValue - value, newValue));
|
||||
|
||||
String uuidString = player.getUniqueId().toString();
|
||||
|
||||
synchronized (_statSync)
|
||||
{
|
||||
if (!_statUploadQueue.containsKey(uuidString))
|
||||
{
|
||||
_statUploadQueue.put(uuidString, new NautHashMap<String, Integer>());
|
||||
}
|
||||
|
||||
if (!_statUploadQueue.get(uuidString).containsKey(statName))
|
||||
{
|
||||
_statUploadQueue.get(uuidString).put(statName, 0);
|
||||
}
|
||||
|
||||
_statUploadQueue.get(uuidString).put(statName, value);
|
||||
}
|
||||
final String uuidString = player.getUniqueId().toString();
|
||||
|
||||
// Verify stat is in our local cache, if not add it remotely.
|
||||
if (!_stats.containsKey(statName))
|
||||
@ -81,6 +66,15 @@ public class StatsManager extends MiniClientPlugin<PlayerStats>
|
||||
{
|
||||
synchronized (_statSync)
|
||||
{
|
||||
// If many players come in for a new stat, when the first add finishes the others are queued to add again
|
||||
// This makes a second check for the stat name (already added before lock was released)
|
||||
// Then it pops into queue and forgets adding the new stat to db.
|
||||
if (_stats.containsKey(statName))
|
||||
{
|
||||
addToQueue(statName, uuidString, value);
|
||||
return;
|
||||
}
|
||||
|
||||
_repository.addStat(statName);
|
||||
|
||||
_stats.clear();
|
||||
@ -89,10 +83,34 @@ public class StatsManager extends MiniClientPlugin<PlayerStats>
|
||||
{
|
||||
_stats.put(stat.Name, stat.Id);
|
||||
}
|
||||
|
||||
addToQueue(statName, uuidString, value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
synchronized (_statSync)
|
||||
{
|
||||
addToQueue(statName, uuidString, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addToQueue(String statName, String uuidString, int value)
|
||||
{
|
||||
if (!_statUploadQueue.containsKey(uuidString))
|
||||
{
|
||||
_statUploadQueue.put(uuidString, new NautHashMap<String, Integer>());
|
||||
}
|
||||
|
||||
if (!_statUploadQueue.get(uuidString).containsKey(statName))
|
||||
{
|
||||
_statUploadQueue.get(uuidString).put(statName, 0);
|
||||
}
|
||||
|
||||
_statUploadQueue.get(uuidString).put(statName, value);
|
||||
}
|
||||
|
||||
protected void saveStats()
|
||||
|
@ -157,7 +157,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
_mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore, _disguiseManager);
|
||||
_inventoryManager = new InventoryManager(plugin);
|
||||
_gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin));
|
||||
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager);
|
||||
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, false);
|
||||
|
||||
_partyManager = partyManager;
|
||||
_preferences = preferences;
|
||||
|
@ -3,7 +3,6 @@ package mineplex.hub.modules;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -14,17 +13,11 @@ import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
@ -34,8 +27,6 @@ import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.event.StackerEvent;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.mount.event.MountActivateEvent;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
|
@ -761,4 +761,14 @@ public class ServerManager extends MiniPlugin
|
||||
{
|
||||
return _hubManager;
|
||||
}
|
||||
|
||||
public ShopBase<ServerManager> getDrawMyThingShop()
|
||||
{
|
||||
return _serverNpcShopMap.get("Draw My Thing");
|
||||
}
|
||||
|
||||
public ShopBase<ServerManager> getTeamDeathmatchShop()
|
||||
{
|
||||
return _serverNpcShopMap.get("Team Deathmatch");
|
||||
}
|
||||
}
|
||||
|
@ -14,24 +14,30 @@ import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.hub.server.ServerManager;
|
||||
import mineplex.hub.server.ui.button.SelectBHButton;
|
||||
import mineplex.hub.server.ui.button.SelectBRButton;
|
||||
import mineplex.hub.server.ui.button.SelectCSButton;
|
||||
import mineplex.hub.server.ui.button.SelectDMTButton;
|
||||
import mineplex.hub.server.ui.button.SelectDOMButton;
|
||||
import mineplex.hub.server.ui.button.SelectMINButton;
|
||||
import mineplex.hub.server.ui.button.SelectSGButton;
|
||||
import mineplex.hub.server.ui.button.SelectSSMButton;
|
||||
import mineplex.hub.server.ui.button.SelectTDMButton;
|
||||
|
||||
public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
{
|
||||
private List<ItemStack> _superSmashCycle = new ArrayList<ItemStack>();
|
||||
private List<ItemStack> _minigameCycle = new ArrayList<ItemStack>();
|
||||
private List<ItemStack> _turfFortsCycle = new ArrayList<ItemStack>();
|
||||
|
||||
private int _ssmIndex;
|
||||
private int _minigameIndex;
|
||||
private int _turfFortsIndex;
|
||||
|
||||
public ServerGameMenu(ServerManager plugin, QuickShop quickShop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
||||
{
|
||||
super(plugin, quickShop, clientManager, donationManager, name, player, 9);
|
||||
super(plugin, quickShop, clientManager, donationManager, name, player, 27);
|
||||
|
||||
createSuperSmashCycle();
|
||||
createMinigameCycle();
|
||||
createTurfFortsCycle();
|
||||
|
||||
BuildPage();
|
||||
}
|
||||
@ -39,16 +45,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
@Override
|
||||
protected void BuildPage()
|
||||
{
|
||||
this.setItem(1, _superSmashCycle.get(_ssmIndex));
|
||||
this.setItem(2, _minigameCycle.get(_minigameIndex));
|
||||
this.setItem(3, ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Survival Games " + C.cGray + "Last Man Standing", new String[]
|
||||
{
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "Search for chests to find loot and ",
|
||||
ChatColor.RESET + "fight others to be the last man standing. ",
|
||||
ChatColor.RESET + "Beware of the deep freeze!",
|
||||
}));
|
||||
this.setItem(4, ItemStackFactory.Instance.CreateStack(Material.IRON_PICKAXE.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "The Bridges " + C.cGray + "4 Team Survival", new String[]
|
||||
this.setItem(1, ItemStackFactory.Instance.CreateStack(Material.IRON_PICKAXE.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "The Bridges " + C.cGray + "4 Team Survival", new String[]
|
||||
{
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "4 Teams get 10 minutes to prepare.",
|
||||
@ -56,7 +53,18 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
ChatColor.RESET + "breaks loose as you battle to the",
|
||||
ChatColor.RESET + "death with the other teams.",
|
||||
}));
|
||||
this.setItem(5, ItemStackFactory.Instance.CreateStack(Material.ANVIL.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Block Hunt " + C.cGray + "Cat and Mouse", new String[]
|
||||
|
||||
this.setItem(3, ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Survival Games " + C.cGray + "Last Man Standing", new String[]
|
||||
{
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "Search for chests to find loot and ",
|
||||
ChatColor.RESET + "fight others to be the last man standing. ",
|
||||
ChatColor.RESET + "Beware of the deep freeze!",
|
||||
}));
|
||||
|
||||
this.setItem(5, _superSmashCycle.get(_ssmIndex));
|
||||
|
||||
this.setItem(7, ItemStackFactory.Instance.CreateStack(Material.ANVIL.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Block Hunt " + C.cGray + "Cat and Mouse", new String[]
|
||||
{
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "Hide as blocks/animals, upgrade your ",
|
||||
@ -64,15 +72,15 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
ChatColor.RESET + "the Hunters!",
|
||||
}));
|
||||
|
||||
this.setItem(6, ItemStackFactory.Instance.CreateStack(Material.BEACON.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Champions " + C.cGray + "Team Game", new String[]
|
||||
{
|
||||
this.setItem(18, ItemStackFactory.Instance.CreateStack(Material.BOOK_AND_QUILL.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Draw My Thing " + C.cGray + "Pictionary!", new String[]
|
||||
{
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "Customize one of five exciting champions",
|
||||
ChatColor.RESET + "and battle with the opposing team for the",
|
||||
ChatColor.RESET + "control points on the map.",
|
||||
ChatColor.RESET + "Players take turns at drawing a random",
|
||||
ChatColor.RESET + "word. Whoever guesses it within the time",
|
||||
ChatColor.RESET + "limit gets some points!",
|
||||
}));
|
||||
|
||||
this.setItem(7, ItemStackFactory.Instance.CreateStack(98, (byte)2, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Castle Siege " + C.cGray + "Team Game", new String[]
|
||||
this.setItem(20, ItemStackFactory.Instance.CreateStack(98, (byte)2, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Castle Siege " + C.cGray + "Team Game", new String[]
|
||||
{
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "Defenders must protect King Sparklez",
|
||||
@ -80,30 +88,34 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
ChatColor.RESET + "until the sun rises!",
|
||||
}));
|
||||
|
||||
ButtonMap.put(1, new SelectSSMButton(this));
|
||||
ButtonMap.put(2, new SelectMINButton(this));
|
||||
ButtonMap.put(3, new SelectSGButton(this));
|
||||
ButtonMap.put(4, new SelectBRButton(this));
|
||||
ButtonMap.put(5, new SelectBHButton(this));
|
||||
ButtonMap.put(6, new SelectDOMButton(this));
|
||||
ButtonMap.put(7, new SelectCSButton(this));
|
||||
}
|
||||
|
||||
private void createTurfFortsCycle()
|
||||
{
|
||||
_turfFortsCycle.add(ItemStackFactory.Instance.CreateStack(Material.WOOL.getId(), (byte)11, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Turf Forts " + C.cGray + "Arcade Minigame", new String []
|
||||
{
|
||||
this.setItem(22, ItemStackFactory.Instance.CreateStack(Material.BEACON.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Dominate " + C.cGray + "Team Game", new String[]
|
||||
{
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "Use your archery skills to kill your",
|
||||
ChatColor.RESET + "enemies and take over their turf!"
|
||||
ChatColor.RESET + "Customize one of five exciting champions",
|
||||
ChatColor.RESET + "and battle with the opposing team for the",
|
||||
ChatColor.RESET + "control points on the map.",
|
||||
}));
|
||||
|
||||
_turfFortsCycle.add(ItemStackFactory.Instance.CreateStack(Material.WOOL.getId(), (byte)14, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Turf Forts " + C.cGray + "Arcade Minigame", new String []
|
||||
{
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "Use your archery skills to kill your",
|
||||
ChatColor.RESET + "enemies and take over their turf!"
|
||||
}));
|
||||
this.setItem(24, ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Team Deathmatch " + C.cGray + "Team Game", new String[]
|
||||
{
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "Customize one of five exciting champions",
|
||||
ChatColor.RESET + "and battle with the opposing team to the",
|
||||
ChatColor.RESET + "last man standing.",
|
||||
}));
|
||||
|
||||
this.setItem(26, _minigameCycle.get(_minigameIndex));
|
||||
|
||||
ButtonMap.put(1, new SelectBRButton(this));
|
||||
ButtonMap.put(3, new SelectSGButton(this));
|
||||
ButtonMap.put(5, new SelectSSMButton(this));
|
||||
ButtonMap.put(7, new SelectBHButton(this));
|
||||
|
||||
ButtonMap.put(18, new SelectDMTButton(this));
|
||||
ButtonMap.put(20, new SelectCSButton(this));
|
||||
ButtonMap.put(22, new SelectDOMButton(this));
|
||||
ButtonMap.put(24, new SelectTDMButton(this));
|
||||
ButtonMap.put(26, new SelectMINButton(this));
|
||||
}
|
||||
|
||||
private void createMinigameCycle()
|
||||
@ -324,7 +336,6 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
{
|
||||
_ssmIndex++;
|
||||
_minigameIndex++;
|
||||
_turfFortsIndex++;
|
||||
|
||||
if (_ssmIndex >= _superSmashCycle.size())
|
||||
_ssmIndex = 0;
|
||||
@ -332,9 +343,6 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
if (_minigameIndex >= _minigameCycle.size())
|
||||
_minigameIndex = 0;
|
||||
|
||||
if (_turfFortsIndex >= _turfFortsCycle.size())
|
||||
_turfFortsIndex = 0;
|
||||
|
||||
BuildPage();
|
||||
}
|
||||
|
||||
@ -372,4 +380,14 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
{
|
||||
Plugin.getSurvivalGamesShop().attemptShopOpen(player);
|
||||
}
|
||||
|
||||
public void openDMT(Player player)
|
||||
{
|
||||
Plugin.getDrawMyThingShop().attemptShopOpen(player);
|
||||
}
|
||||
|
||||
public void OpenTDM(Player player)
|
||||
{
|
||||
Plugin.getTeamDeathmatchShop().attemptShopOpen(player);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
package mineplex.hub.server.ui;
|
||||
package mineplex.hub.server.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.hub.server.ui.ServerGameMenu;
|
||||
|
||||
public class SelectBHButton implements IButton
|
||||
{
|
@ -1,8 +1,9 @@
|
||||
package mineplex.hub.server.ui;
|
||||
package mineplex.hub.server.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.hub.server.ui.ServerGameMenu;
|
||||
|
||||
public class SelectBRButton implements IButton
|
||||
{
|
@ -1,8 +1,9 @@
|
||||
package mineplex.hub.server.ui;
|
||||
package mineplex.hub.server.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.hub.server.ui.ServerGameMenu;
|
||||
|
||||
public class SelectCSButton implements IButton
|
||||
{
|
@ -0,0 +1,28 @@
|
||||
package mineplex.hub.server.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.hub.server.ui.ServerGameMenu;
|
||||
|
||||
public class SelectDMTButton implements IButton
|
||||
{
|
||||
private ServerGameMenu _menu;
|
||||
|
||||
public SelectDMTButton(ServerGameMenu menu)
|
||||
{
|
||||
_menu = menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedLeft(Player player)
|
||||
{
|
||||
_menu.openDMT(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedRight(Player player)
|
||||
{
|
||||
ClickedLeft(player);
|
||||
}
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
package mineplex.hub.server.ui;
|
||||
package mineplex.hub.server.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.hub.server.ui.ServerGameMenu;
|
||||
|
||||
public class SelectDOMButton implements IButton
|
||||
{
|
@ -1,8 +1,9 @@
|
||||
package mineplex.hub.server.ui;
|
||||
package mineplex.hub.server.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.hub.server.ui.ServerGameMenu;
|
||||
|
||||
public class SelectMINButton implements IButton
|
||||
{
|
@ -1,8 +1,9 @@
|
||||
package mineplex.hub.server.ui;
|
||||
package mineplex.hub.server.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.hub.server.ui.ServerGameMenu;
|
||||
|
||||
public class SelectSGButton implements IButton
|
||||
{
|
@ -1,8 +1,9 @@
|
||||
package mineplex.hub.server.ui;
|
||||
package mineplex.hub.server.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.hub.server.ui.ServerGameMenu;
|
||||
|
||||
public class SelectSSMButton implements IButton
|
||||
{
|
@ -0,0 +1,28 @@
|
||||
package mineplex.hub.server.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.hub.server.ui.ServerGameMenu;
|
||||
|
||||
public class SelectTDMButton implements IButton
|
||||
{
|
||||
private ServerGameMenu _menu;
|
||||
|
||||
public SelectTDMButton(ServerGameMenu menu)
|
||||
{
|
||||
_menu = menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedLeft(Player player)
|
||||
{
|
||||
_menu.OpenTDM(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedRight(Player player)
|
||||
{
|
||||
ClickedLeft(player);
|
||||
}
|
||||
}
|
@ -89,12 +89,12 @@ public class ServerMonitor
|
||||
{
|
||||
if (isServerOffline(serverData))
|
||||
{
|
||||
System.out.println("------=[OFFLINE]=------=[" + serverData.getName() + ":" + serverData.getPublicAddress() + "]=------=[OFFLINE]=------");
|
||||
log("------=[OFFLINE]=------=[" + serverData.getName() + ":" + serverData.getPublicAddress() + "]=------=[OFFLINE]=------");
|
||||
_badServers.put(serverData.getName(), true);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(_badServers.size() + " bad servers.");
|
||||
log(_badServers.size() + " bad servers.");
|
||||
}
|
||||
|
||||
for (Iterator<DedicatedServer> iterator = dedicatedServers.iterator(); iterator.hasNext();)
|
||||
@ -128,7 +128,7 @@ public class ServerMonitor
|
||||
onlineServers.add(minecraftServer.getName());
|
||||
|
||||
if (minecraftServer.getTps() <= 17)
|
||||
System.out.println("[Performance] " + minecraftServer.getName() + ":" + minecraftServer.getPublicAddress() + "] Running poorly at " + minecraftServer.getTps() + " TPS");
|
||||
log("[Performance] " + minecraftServer.getName() + ":" + minecraftServer.getPublicAddress() + "] Running poorly at " + minecraftServer.getTps() + " TPS");
|
||||
}
|
||||
|
||||
for (Iterator<Entry<String, Entry<String, Long>>> iterator = serverTracker.entrySet().iterator(); iterator.hasNext();)
|
||||
@ -176,7 +176,7 @@ public class ServerMonitor
|
||||
{
|
||||
try
|
||||
{
|
||||
System.out.println("Sleeping while processes run...");
|
||||
log("Sleeping while processes run...");
|
||||
Thread.sleep(6000);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
@ -187,7 +187,7 @@ public class ServerMonitor
|
||||
|
||||
if (processWaits >= 10)
|
||||
{
|
||||
System.out.println("Killing stale processes.");
|
||||
log("Killing stale processes.");
|
||||
|
||||
for (Iterator<ProcessRunner> iterator = _processes.iterator(); iterator.hasNext();)
|
||||
{
|
||||
@ -203,7 +203,7 @@ public class ServerMonitor
|
||||
|
||||
try
|
||||
{
|
||||
System.out.println("Natural sleep.");
|
||||
log("Natural sleep.");
|
||||
Thread.sleep(10000);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
@ -290,9 +290,9 @@ public class ServerMonitor
|
||||
if (announce)
|
||||
{
|
||||
if (error)
|
||||
System.out.println("[" + serverName + ":" + serverAddress + "] Kill errored.");
|
||||
log("[" + serverName + ":" + serverAddress + "] Kill errored.");
|
||||
else
|
||||
System.out.println(message);
|
||||
log(message);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -385,9 +385,9 @@ public class ServerMonitor
|
||||
public void run(Boolean error)
|
||||
{
|
||||
if (error)
|
||||
System.out.println("[" + serverName + ":" + serverAddress + "] Errored " + serverName + "(" + groupPrefix+ "-" + serverNum + (free ? "-FREE" : "") + ")");
|
||||
log("[" + serverName + ":" + serverAddress + "] Errored " + serverName + "(" + groupPrefix+ "-" + serverNum + (free ? "-FREE" : "") + ")");
|
||||
else
|
||||
System.out.println("[" + serverName + ":" + serverAddress + "] Added " + serverName + "(" + groupPrefix+ "-" + serverNum + (free ? "-FREE" : "") + ")");
|
||||
log("[" + serverName + ":" + serverAddress + "] Added " + serverName + "(" + groupPrefix+ "-" + serverNum + (free ? "-FREE" : "") + ")");
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -24,7 +24,12 @@ public class RankCommand extends CommandBase<SalesPackageManager>
|
||||
String rank = args[1];
|
||||
boolean perm = Boolean.parseBoolean(args[2]);
|
||||
|
||||
Plugin.getClientManager().SaveRank(playerName, mineplex.core.common.Rank.valueOf(rank), perm);
|
||||
caller.sendMessage(F.main(Plugin.GetName(), playerName + "'s rank has been updated to " + rank + "!"));
|
||||
final Rank rankEnum = Rank.valueOf(rank);
|
||||
|
||||
if (rankEnum == Rank.HERO || rankEnum == Rank.ULTRA)
|
||||
{
|
||||
Plugin.getClientManager().SaveRank(playerName, mineplex.core.common.Rank.valueOf(rank), perm);
|
||||
caller.sendMessage(F.main(Plugin.GetName(), playerName + "'s rank has been updated to " + rank + "!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,308 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.net.SocketAddress;
|
||||
import java.util.Queue;
|
||||
import javax.crypto.SecretKey;
|
||||
|
||||
import net.minecraft.util.com.google.common.collect.Queues;
|
||||
import net.minecraft.util.com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import net.minecraft.util.com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.util.io.netty.channel.Channel;
|
||||
import net.minecraft.util.io.netty.channel.ChannelFutureListener;
|
||||
import net.minecraft.util.io.netty.channel.ChannelHandlerContext;
|
||||
import net.minecraft.util.io.netty.channel.SimpleChannelInboundHandler;
|
||||
import net.minecraft.util.io.netty.channel.local.LocalChannel;
|
||||
import net.minecraft.util.io.netty.channel.local.LocalServerChannel;
|
||||
import net.minecraft.util.io.netty.channel.nio.NioEventLoopGroup;
|
||||
import net.minecraft.util.io.netty.handler.timeout.TimeoutException;
|
||||
import net.minecraft.util.io.netty.util.AttributeKey;
|
||||
import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
|
||||
import net.minecraft.util.org.apache.commons.lang3.Validate;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.Marker;
|
||||
import org.apache.logging.log4j.MarkerManager;
|
||||
// Spigot start
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
// Spigot end
|
||||
|
||||
public class NetworkManager extends SimpleChannelInboundHandler
|
||||
{
|
||||
|
||||
private static final Logger i = LogManager.getLogger();
|
||||
public static final Marker a = MarkerManager.getMarker("NETWORK");
|
||||
public static final Marker b = MarkerManager.getMarker("NETWORK_PACKETS", a);
|
||||
public static final Marker c = MarkerManager.getMarker("NETWORK_STAT", a);
|
||||
public static final AttributeKey d = new AttributeKey("protocol");
|
||||
public static final AttributeKey e = new AttributeKey("receivable_packets");
|
||||
public static final AttributeKey f = new AttributeKey("sendable_packets");
|
||||
public static final NioEventLoopGroup g = new NioEventLoopGroup(0, (new ThreadFactoryBuilder())
|
||||
.setNameFormat("Netty Client IO #%d").setDaemon(true).build());
|
||||
public static final NetworkStatistics h = new NetworkStatistics();
|
||||
private final boolean j;
|
||||
private final Queue k = Queues.newConcurrentLinkedQueue();
|
||||
private final Queue l = Queues.newConcurrentLinkedQueue();
|
||||
private Channel m;
|
||||
// Spigot Start
|
||||
public SocketAddress n;
|
||||
public java.util.UUID spoofedUUID;
|
||||
public Property[] spoofedProfile;
|
||||
public boolean preparing = true;
|
||||
// Spigot End
|
||||
private PacketListener o;
|
||||
private EnumProtocol p;
|
||||
private IChatBaseComponent q;
|
||||
private boolean r;
|
||||
// Spigot Start
|
||||
public static final AttributeKey<Integer> protocolVersion = new AttributeKey<Integer>("protocol_version");
|
||||
public static final ImmutableSet<Integer> SUPPORTED_VERSIONS = ImmutableSet.of(4, 5);
|
||||
public static final int CURRENT_VERSION = 5;
|
||||
|
||||
public static int getVersion(Channel attr)
|
||||
{
|
||||
Integer ver = attr.attr(protocolVersion).get();
|
||||
return (ver != null) ? ver : CURRENT_VERSION;
|
||||
}
|
||||
|
||||
public int getVersion()
|
||||
{
|
||||
return getVersion(this.m);
|
||||
}
|
||||
|
||||
// Spigot End
|
||||
|
||||
public NetworkManager(boolean flag)
|
||||
{
|
||||
this.j = flag;
|
||||
}
|
||||
|
||||
public void channelActive(ChannelHandlerContext channelhandlercontext) throws Exception
|
||||
{ // CraftBukkit - throws Exception
|
||||
super.channelActive(channelhandlercontext);
|
||||
this.m = channelhandlercontext.channel();
|
||||
this.n = this.m.remoteAddress();
|
||||
// Spigot Start
|
||||
this.preparing = false;
|
||||
// Spigot End
|
||||
this.a(EnumProtocol.HANDSHAKING);
|
||||
}
|
||||
|
||||
public void a(EnumProtocol enumprotocol)
|
||||
{
|
||||
this.p = (EnumProtocol) this.m.attr(d).getAndSet(enumprotocol);
|
||||
this.m.attr(e).set(enumprotocol.a(this.j));
|
||||
this.m.attr(f).set(enumprotocol.b(this.j));
|
||||
this.m.config().setAutoRead(true);
|
||||
i.debug("Enabled auto read");
|
||||
}
|
||||
|
||||
public void channelInactive(ChannelHandlerContext channelhandlercontext)
|
||||
{
|
||||
this.close(new ChatMessage("disconnect.endOfStream", new Object[0]));
|
||||
}
|
||||
|
||||
public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable)
|
||||
{
|
||||
ChatMessage chatmessage;
|
||||
|
||||
if (throwable instanceof TimeoutException)
|
||||
{
|
||||
chatmessage = new ChatMessage("disconnect.timeout", new Object[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
chatmessage = new ChatMessage("disconnect.genericReason",
|
||||
new Object[] { "Internal Exception: " + throwable });
|
||||
}
|
||||
|
||||
this.close(chatmessage);
|
||||
if (MinecraftServer.getServer().isDebugging())
|
||||
{
|
||||
throwable.printStackTrace(); // Spigot
|
||||
System.out.println("------------");
|
||||
for (StackTraceElement trace : Thread.currentThread().getStackTrace())
|
||||
{
|
||||
System.out.println(trace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(ChannelHandlerContext channelhandlercontext, Packet packet)
|
||||
{
|
||||
if (this.m.isOpen())
|
||||
{
|
||||
if (packet.a())
|
||||
{
|
||||
packet.handle(this.o);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.k.add(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(PacketListener packetlistener)
|
||||
{
|
||||
Validate.notNull(packetlistener, "packetListener", new Object[0]);
|
||||
i.debug("Set listener of {} to {}", new Object[] { this, packetlistener });
|
||||
this.o = packetlistener;
|
||||
}
|
||||
|
||||
public void handle(Packet packet, GenericFutureListener... agenericfuturelistener)
|
||||
{
|
||||
if (this.m != null && this.m.isOpen())
|
||||
{
|
||||
this.i();
|
||||
this.b(packet, agenericfuturelistener);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.l.add(new QueuedPacket(packet, agenericfuturelistener));
|
||||
}
|
||||
}
|
||||
|
||||
private void b(Packet packet, GenericFutureListener[] agenericfuturelistener)
|
||||
{
|
||||
EnumProtocol enumprotocol = EnumProtocol.a(packet);
|
||||
EnumProtocol enumprotocol1 = (EnumProtocol) this.m.attr(d).get();
|
||||
|
||||
if (enumprotocol1 != enumprotocol)
|
||||
{
|
||||
i.debug("Disabled auto read");
|
||||
this.m.config().setAutoRead(false);
|
||||
}
|
||||
|
||||
if (this.m.eventLoop().inEventLoop())
|
||||
{
|
||||
if (enumprotocol != enumprotocol1)
|
||||
{
|
||||
this.a(enumprotocol);
|
||||
}
|
||||
|
||||
this.m.writeAndFlush(packet).addListeners(agenericfuturelistener)
|
||||
.addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.m.eventLoop().execute(
|
||||
new QueuedProtocolSwitch(this, enumprotocol, enumprotocol1, packet, agenericfuturelistener));
|
||||
}
|
||||
}
|
||||
|
||||
private void i()
|
||||
{
|
||||
if (this.m != null && this.m.isOpen())
|
||||
{
|
||||
while (!this.l.isEmpty())
|
||||
{
|
||||
QueuedPacket queuedpacket = (QueuedPacket) this.l.poll();
|
||||
|
||||
this.b(QueuedPacket.a(queuedpacket), QueuedPacket.b(queuedpacket));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a()
|
||||
{
|
||||
this.i();
|
||||
EnumProtocol enumprotocol = (EnumProtocol) this.m.attr(d).get();
|
||||
|
||||
if (this.p != enumprotocol)
|
||||
{
|
||||
if (this.p != null)
|
||||
{
|
||||
this.o.a(this.p, enumprotocol);
|
||||
}
|
||||
|
||||
this.p = enumprotocol;
|
||||
}
|
||||
|
||||
if (this.o != null)
|
||||
{
|
||||
for (int i = 1000; !this.k.isEmpty() && i >= 0; --i)
|
||||
{
|
||||
Packet packet = (Packet) this.k.poll();
|
||||
|
||||
// CraftBukkit start
|
||||
if (!this.isConnected() || !this.m.config().isAutoRead())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// CraftBukkit end
|
||||
packet.handle(this.o);
|
||||
}
|
||||
|
||||
this.o.a();
|
||||
}
|
||||
|
||||
this.m.flush();
|
||||
}
|
||||
|
||||
public SocketAddress getSocketAddress()
|
||||
{
|
||||
return this.n;
|
||||
}
|
||||
|
||||
public void close(IChatBaseComponent ichatbasecomponent)
|
||||
{
|
||||
// Spigot Start
|
||||
this.preparing = false;
|
||||
// Spigot End
|
||||
if (this.m.isOpen())
|
||||
{
|
||||
this.m.close();
|
||||
this.q = ichatbasecomponent;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean c()
|
||||
{
|
||||
return this.m instanceof LocalChannel || this.m instanceof LocalServerChannel;
|
||||
}
|
||||
|
||||
public void a(SecretKey secretkey)
|
||||
{
|
||||
this.m.pipeline().addBefore("splitter", "decrypt", new PacketDecrypter(MinecraftEncryption.a(2, secretkey)));
|
||||
this.m.pipeline().addBefore("prepender", "encrypt", new PacketEncrypter(MinecraftEncryption.a(1, secretkey)));
|
||||
this.r = true;
|
||||
}
|
||||
|
||||
public boolean isConnected()
|
||||
{
|
||||
return this.m != null && this.m.isOpen();
|
||||
}
|
||||
|
||||
public PacketListener getPacketListener()
|
||||
{
|
||||
return this.o;
|
||||
}
|
||||
|
||||
public IChatBaseComponent f()
|
||||
{
|
||||
return this.q;
|
||||
}
|
||||
|
||||
public void g()
|
||||
{
|
||||
this.m.config().setAutoRead(false);
|
||||
}
|
||||
|
||||
protected void channelRead0(ChannelHandlerContext channelhandlercontext, Object object)
|
||||
{
|
||||
this.a(channelhandlercontext, (Packet) object);
|
||||
}
|
||||
|
||||
static Channel a(NetworkManager networkmanager)
|
||||
{
|
||||
return networkmanager.m;
|
||||
}
|
||||
|
||||
// Spigot Start
|
||||
public SocketAddress getRawAddress()
|
||||
{
|
||||
return this.m.remoteAddress();
|
||||
}
|
||||
// Spigot End
|
||||
}
|
@ -0,0 +1,922 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.channels.GatheringByteChannel;
|
||||
import java.nio.channels.ScatteringByteChannel;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import net.minecraft.util.com.google.common.base.Charsets;
|
||||
import net.minecraft.util.io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.util.io.netty.buffer.ByteBufAllocator;
|
||||
import net.minecraft.util.io.netty.buffer.ByteBufProcessor;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack; // CraftBukkit
|
||||
|
||||
public class PacketDataSerializer extends ByteBuf
|
||||
{
|
||||
|
||||
private final ByteBuf a;
|
||||
// Spigot Start
|
||||
public final int version;
|
||||
|
||||
public PacketDataSerializer(ByteBuf bytebuf)
|
||||
{
|
||||
this(bytebuf, NetworkManager.CURRENT_VERSION);
|
||||
}
|
||||
|
||||
public PacketDataSerializer(ByteBuf bytebuf, int version)
|
||||
{
|
||||
this.a = bytebuf;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
// Spigot End
|
||||
|
||||
public static int a(int i)
|
||||
{
|
||||
return (i & -128) == 0 ? 1 : ((i & -16384) == 0 ? 2 : ((i & -2097152) == 0 ? 3
|
||||
: ((i & -268435456) == 0 ? 4 : 5)));
|
||||
}
|
||||
|
||||
public int a()
|
||||
{
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
|
||||
byte b0;
|
||||
|
||||
do
|
||||
{
|
||||
b0 = this.readByte();
|
||||
i |= (b0 & 127) << j++ * 7;
|
||||
if (j > 5)
|
||||
{
|
||||
throw new RuntimeException("VarInt too big");
|
||||
}
|
||||
}
|
||||
while ((b0 & 128) == 128);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public void b(int i)
|
||||
{
|
||||
while ((i & -128) != 0)
|
||||
{
|
||||
this.writeByte(i & 127 | 128);
|
||||
i >>>= 7;
|
||||
}
|
||||
|
||||
this.writeByte(i);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
if (nbttagcompound == null)
|
||||
{
|
||||
this.writeShort(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] abyte = NBTCompressedStreamTools.a(nbttagcompound);
|
||||
|
||||
this.writeShort((short) abyte.length);
|
||||
this.writeBytes(abyte);
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound b()
|
||||
{
|
||||
short short1 = this.readShort();
|
||||
|
||||
if (short1 < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] abyte = new byte[short1];
|
||||
|
||||
this.readBytes(abyte);
|
||||
return NBTCompressedStreamTools.a(abyte, new NBTReadLimiter(2097152L));
|
||||
}
|
||||
}
|
||||
|
||||
public void a(ItemStack itemstack)
|
||||
{
|
||||
if (itemstack == null || itemstack.getItem() == null)
|
||||
{ // CraftBukkit - NPE fix itemstack.getItem()
|
||||
this.writeShort(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.writeShort(Item.getId(itemstack.getItem()));
|
||||
this.writeByte(itemstack.count);
|
||||
this.writeShort(itemstack.getData());
|
||||
NBTTagCompound nbttagcompound = null;
|
||||
|
||||
if (itemstack.getItem().usesDurability() || itemstack.getItem().s())
|
||||
{
|
||||
nbttagcompound = itemstack.tag;
|
||||
}
|
||||
|
||||
this.a(nbttagcompound);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack c()
|
||||
{
|
||||
ItemStack itemstack = null;
|
||||
short short1 = this.readShort();
|
||||
|
||||
if (short1 >= 0)
|
||||
{
|
||||
byte b0 = this.readByte();
|
||||
short short2 = this.readShort();
|
||||
|
||||
itemstack = new ItemStack(Item.getById(short1), b0, short2);
|
||||
itemstack.tag = this.b();
|
||||
// CraftBukkit start
|
||||
if (itemstack.tag != null)
|
||||
{
|
||||
CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
public String c(int i) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
int j = this.a();
|
||||
|
||||
if (j > i * 4)
|
||||
{
|
||||
throw new IOException("The received encoded string buffer length is longer than maximum allowed (" + j
|
||||
+ " > " + i * 4 + ")");
|
||||
}
|
||||
else if (j < 0)
|
||||
{
|
||||
throw new IOException("The received encoded string buffer length is less than zero! Weird string!");
|
||||
}
|
||||
else
|
||||
{
|
||||
String s = new String(this.readBytes(j).array(), Charsets.UTF_8);
|
||||
|
||||
if (s.length() > i)
|
||||
{
|
||||
throw new IOException("The received string length is longer than maximum allowed (" + j + " > " + i
|
||||
+ ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(String s) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
byte[] abyte = s.getBytes(Charsets.UTF_8);
|
||||
|
||||
if (abyte.length > 32767)
|
||||
{
|
||||
throw new IOException("String too big (was " + s.length() + " bytes encoded, max " + 32767 + ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.b(abyte.length);
|
||||
this.writeBytes(abyte);
|
||||
}
|
||||
}
|
||||
|
||||
public int capacity()
|
||||
{
|
||||
return this.a.capacity();
|
||||
}
|
||||
|
||||
public ByteBuf capacity(int i)
|
||||
{
|
||||
return this.a.capacity(i);
|
||||
}
|
||||
|
||||
public int maxCapacity()
|
||||
{
|
||||
return this.a.maxCapacity();
|
||||
}
|
||||
|
||||
public ByteBufAllocator alloc()
|
||||
{
|
||||
return this.a.alloc();
|
||||
}
|
||||
|
||||
public ByteOrder order()
|
||||
{
|
||||
return this.a.order();
|
||||
}
|
||||
|
||||
public ByteBuf order(ByteOrder byteorder)
|
||||
{
|
||||
return this.a.order(byteorder);
|
||||
}
|
||||
|
||||
public ByteBuf unwrap()
|
||||
{
|
||||
return this.a.unwrap();
|
||||
}
|
||||
|
||||
public boolean isDirect()
|
||||
{
|
||||
return this.a.isDirect();
|
||||
}
|
||||
|
||||
public int readerIndex()
|
||||
{
|
||||
return this.a.readerIndex();
|
||||
}
|
||||
|
||||
public ByteBuf readerIndex(int i)
|
||||
{
|
||||
return this.a.readerIndex(i);
|
||||
}
|
||||
|
||||
public int writerIndex()
|
||||
{
|
||||
return this.a.writerIndex();
|
||||
}
|
||||
|
||||
public ByteBuf writerIndex(int i)
|
||||
{
|
||||
return this.a.writerIndex(i);
|
||||
}
|
||||
|
||||
public ByteBuf setIndex(int i, int j)
|
||||
{
|
||||
return this.a.setIndex(i, j);
|
||||
}
|
||||
|
||||
public int readableBytes()
|
||||
{
|
||||
return this.a.readableBytes();
|
||||
}
|
||||
|
||||
public int writableBytes()
|
||||
{
|
||||
return this.a.writableBytes();
|
||||
}
|
||||
|
||||
public int maxWritableBytes()
|
||||
{
|
||||
return this.a.maxWritableBytes();
|
||||
}
|
||||
|
||||
public boolean isReadable()
|
||||
{
|
||||
return this.a.isReadable();
|
||||
}
|
||||
|
||||
public boolean isReadable(int i)
|
||||
{
|
||||
return this.a.isReadable(i);
|
||||
}
|
||||
|
||||
public boolean isWritable()
|
||||
{
|
||||
return this.a.isWritable();
|
||||
}
|
||||
|
||||
public boolean isWritable(int i)
|
||||
{
|
||||
return this.a.isWritable(i);
|
||||
}
|
||||
|
||||
public ByteBuf clear()
|
||||
{
|
||||
return this.a.clear();
|
||||
}
|
||||
|
||||
public ByteBuf markReaderIndex()
|
||||
{
|
||||
return this.a.markReaderIndex();
|
||||
}
|
||||
|
||||
public ByteBuf resetReaderIndex()
|
||||
{
|
||||
return this.a.resetReaderIndex();
|
||||
}
|
||||
|
||||
public ByteBuf markWriterIndex()
|
||||
{
|
||||
return this.a.markWriterIndex();
|
||||
}
|
||||
|
||||
public ByteBuf resetWriterIndex()
|
||||
{
|
||||
return this.a.resetWriterIndex();
|
||||
}
|
||||
|
||||
public ByteBuf discardReadBytes()
|
||||
{
|
||||
return this.a.discardReadBytes();
|
||||
}
|
||||
|
||||
public ByteBuf discardSomeReadBytes()
|
||||
{
|
||||
return this.a.discardSomeReadBytes();
|
||||
}
|
||||
|
||||
public ByteBuf ensureWritable(int i)
|
||||
{
|
||||
return this.a.ensureWritable(i);
|
||||
}
|
||||
|
||||
public int ensureWritable(int i, boolean flag)
|
||||
{
|
||||
return this.a.ensureWritable(i, flag);
|
||||
}
|
||||
|
||||
public boolean getBoolean(int i)
|
||||
{
|
||||
return this.a.getBoolean(i);
|
||||
}
|
||||
|
||||
public byte getByte(int i)
|
||||
{
|
||||
return this.a.getByte(i);
|
||||
}
|
||||
|
||||
public short getUnsignedByte(int i)
|
||||
{
|
||||
return this.a.getUnsignedByte(i);
|
||||
}
|
||||
|
||||
public short getShort(int i)
|
||||
{
|
||||
return this.a.getShort(i);
|
||||
}
|
||||
|
||||
public int getUnsignedShort(int i)
|
||||
{
|
||||
return this.a.getUnsignedShort(i);
|
||||
}
|
||||
|
||||
public int getMedium(int i)
|
||||
{
|
||||
return this.a.getMedium(i);
|
||||
}
|
||||
|
||||
public int getUnsignedMedium(int i)
|
||||
{
|
||||
return this.a.getUnsignedMedium(i);
|
||||
}
|
||||
|
||||
public int getInt(int i)
|
||||
{
|
||||
return this.a.getInt(i);
|
||||
}
|
||||
|
||||
public long getUnsignedInt(int i)
|
||||
{
|
||||
return this.a.getUnsignedInt(i);
|
||||
}
|
||||
|
||||
public long getLong(int i)
|
||||
{
|
||||
return this.a.getLong(i);
|
||||
}
|
||||
|
||||
public char getChar(int i)
|
||||
{
|
||||
return this.a.getChar(i);
|
||||
}
|
||||
|
||||
public float getFloat(int i)
|
||||
{
|
||||
return this.a.getFloat(i);
|
||||
}
|
||||
|
||||
public double getDouble(int i)
|
||||
{
|
||||
return this.a.getDouble(i);
|
||||
}
|
||||
|
||||
public ByteBuf getBytes(int i, ByteBuf bytebuf)
|
||||
{
|
||||
return this.a.getBytes(i, bytebuf);
|
||||
}
|
||||
|
||||
public ByteBuf getBytes(int i, ByteBuf bytebuf, int j)
|
||||
{
|
||||
return this.a.getBytes(i, bytebuf, j);
|
||||
}
|
||||
|
||||
public ByteBuf getBytes(int i, ByteBuf bytebuf, int j, int k)
|
||||
{
|
||||
return this.a.getBytes(i, bytebuf, j, k);
|
||||
}
|
||||
|
||||
public ByteBuf getBytes(int i, byte[] abyte)
|
||||
{
|
||||
return this.a.getBytes(i, abyte);
|
||||
}
|
||||
|
||||
public ByteBuf getBytes(int i, byte[] abyte, int j, int k)
|
||||
{
|
||||
return this.a.getBytes(i, abyte, j, k);
|
||||
}
|
||||
|
||||
public ByteBuf getBytes(int i, ByteBuffer bytebuffer)
|
||||
{
|
||||
return this.a.getBytes(i, bytebuffer);
|
||||
}
|
||||
|
||||
public ByteBuf getBytes(int i, OutputStream outputstream, int j) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
return this.a.getBytes(i, outputstream, j);
|
||||
}
|
||||
|
||||
public int getBytes(int i, GatheringByteChannel gatheringbytechannel, int j) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
return this.a.getBytes(i, gatheringbytechannel, j);
|
||||
}
|
||||
|
||||
public ByteBuf setBoolean(int i, boolean flag)
|
||||
{
|
||||
return this.a.setBoolean(i, flag);
|
||||
}
|
||||
|
||||
public ByteBuf setByte(int i, int j)
|
||||
{
|
||||
return this.a.setByte(i, j);
|
||||
}
|
||||
|
||||
public ByteBuf setShort(int i, int j)
|
||||
{
|
||||
return this.a.setShort(i, j);
|
||||
}
|
||||
|
||||
public ByteBuf setMedium(int i, int j)
|
||||
{
|
||||
return this.a.setMedium(i, j);
|
||||
}
|
||||
|
||||
public ByteBuf setInt(int i, int j)
|
||||
{
|
||||
return this.a.setInt(i, j);
|
||||
}
|
||||
|
||||
public ByteBuf setLong(int i, long j)
|
||||
{
|
||||
return this.a.setLong(i, j);
|
||||
}
|
||||
|
||||
public ByteBuf setChar(int i, int j)
|
||||
{
|
||||
return this.a.setChar(i, j);
|
||||
}
|
||||
|
||||
public ByteBuf setFloat(int i, float f)
|
||||
{
|
||||
return this.a.setFloat(i, f);
|
||||
}
|
||||
|
||||
public ByteBuf setDouble(int i, double d0)
|
||||
{
|
||||
return this.a.setDouble(i, d0);
|
||||
}
|
||||
|
||||
public ByteBuf setBytes(int i, ByteBuf bytebuf)
|
||||
{
|
||||
return this.a.setBytes(i, bytebuf);
|
||||
}
|
||||
|
||||
public ByteBuf setBytes(int i, ByteBuf bytebuf, int j)
|
||||
{
|
||||
return this.a.setBytes(i, bytebuf, j);
|
||||
}
|
||||
|
||||
public ByteBuf setBytes(int i, ByteBuf bytebuf, int j, int k)
|
||||
{
|
||||
return this.a.setBytes(i, bytebuf, j, k);
|
||||
}
|
||||
|
||||
public ByteBuf setBytes(int i, byte[] abyte)
|
||||
{
|
||||
return this.a.setBytes(i, abyte);
|
||||
}
|
||||
|
||||
public ByteBuf setBytes(int i, byte[] abyte, int j, int k)
|
||||
{
|
||||
return this.a.setBytes(i, abyte, j, k);
|
||||
}
|
||||
|
||||
public ByteBuf setBytes(int i, ByteBuffer bytebuffer)
|
||||
{
|
||||
return this.a.setBytes(i, bytebuffer);
|
||||
}
|
||||
|
||||
public int setBytes(int i, InputStream inputstream, int j) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
return this.a.setBytes(i, inputstream, j);
|
||||
}
|
||||
|
||||
public int setBytes(int i, ScatteringByteChannel scatteringbytechannel, int j) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
return this.a.setBytes(i, scatteringbytechannel, j);
|
||||
}
|
||||
|
||||
public ByteBuf setZero(int i, int j)
|
||||
{
|
||||
return this.a.setZero(i, j);
|
||||
}
|
||||
|
||||
public boolean readBoolean()
|
||||
{
|
||||
return this.a.readBoolean();
|
||||
}
|
||||
|
||||
public byte readByte()
|
||||
{
|
||||
return this.a.readByte();
|
||||
}
|
||||
|
||||
public short readUnsignedByte()
|
||||
{
|
||||
return this.a.readUnsignedByte();
|
||||
}
|
||||
|
||||
public short readShort()
|
||||
{
|
||||
return this.a.readShort();
|
||||
}
|
||||
|
||||
public int readUnsignedShort()
|
||||
{
|
||||
return this.a.readUnsignedShort();
|
||||
}
|
||||
|
||||
public int readMedium()
|
||||
{
|
||||
return this.a.readMedium();
|
||||
}
|
||||
|
||||
public int readUnsignedMedium()
|
||||
{
|
||||
return this.a.readUnsignedMedium();
|
||||
}
|
||||
|
||||
public int readInt()
|
||||
{
|
||||
return this.a.readInt();
|
||||
}
|
||||
|
||||
public long readUnsignedInt()
|
||||
{
|
||||
return this.a.readUnsignedInt();
|
||||
}
|
||||
|
||||
public long readLong()
|
||||
{
|
||||
return this.a.readLong();
|
||||
}
|
||||
|
||||
public char readChar()
|
||||
{
|
||||
return this.a.readChar();
|
||||
}
|
||||
|
||||
public float readFloat()
|
||||
{
|
||||
return this.a.readFloat();
|
||||
}
|
||||
|
||||
public double readDouble()
|
||||
{
|
||||
return this.a.readDouble();
|
||||
}
|
||||
|
||||
public ByteBuf readBytes(int i)
|
||||
{
|
||||
return this.a.readBytes(i);
|
||||
}
|
||||
|
||||
public ByteBuf readSlice(int i)
|
||||
{
|
||||
return this.a.readSlice(i);
|
||||
}
|
||||
|
||||
public ByteBuf readBytes(ByteBuf bytebuf)
|
||||
{
|
||||
return this.a.readBytes(bytebuf);
|
||||
}
|
||||
|
||||
public ByteBuf readBytes(ByteBuf bytebuf, int i)
|
||||
{
|
||||
return this.a.readBytes(bytebuf, i);
|
||||
}
|
||||
|
||||
public ByteBuf readBytes(ByteBuf bytebuf, int i, int j)
|
||||
{
|
||||
return this.a.readBytes(bytebuf, i, j);
|
||||
}
|
||||
|
||||
public ByteBuf readBytes(byte[] abyte)
|
||||
{
|
||||
return this.a.readBytes(abyte);
|
||||
}
|
||||
|
||||
public ByteBuf readBytes(byte[] abyte, int i, int j)
|
||||
{
|
||||
return this.a.readBytes(abyte, i, j);
|
||||
}
|
||||
|
||||
public ByteBuf readBytes(ByteBuffer bytebuffer)
|
||||
{
|
||||
return this.a.readBytes(bytebuffer);
|
||||
}
|
||||
|
||||
public ByteBuf readBytes(OutputStream outputstream, int i) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
return this.a.readBytes(outputstream, i);
|
||||
}
|
||||
|
||||
public int readBytes(GatheringByteChannel gatheringbytechannel, int i) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
return this.a.readBytes(gatheringbytechannel, i);
|
||||
}
|
||||
|
||||
public ByteBuf skipBytes(int i)
|
||||
{
|
||||
return this.a.skipBytes(i);
|
||||
}
|
||||
|
||||
public ByteBuf writeBoolean(boolean flag)
|
||||
{
|
||||
return this.a.writeBoolean(flag);
|
||||
}
|
||||
|
||||
public ByteBuf writeByte(int i)
|
||||
{
|
||||
return this.a.writeByte(i);
|
||||
}
|
||||
|
||||
public ByteBuf writeShort(int i)
|
||||
{
|
||||
return this.a.writeShort(i);
|
||||
}
|
||||
|
||||
public ByteBuf writeMedium(int i)
|
||||
{
|
||||
return this.a.writeMedium(i);
|
||||
}
|
||||
|
||||
public ByteBuf writeInt(int i)
|
||||
{
|
||||
return this.a.writeInt(i);
|
||||
}
|
||||
|
||||
public ByteBuf writeLong(long i)
|
||||
{
|
||||
return this.a.writeLong(i);
|
||||
}
|
||||
|
||||
public ByteBuf writeChar(int i)
|
||||
{
|
||||
return this.a.writeChar(i);
|
||||
}
|
||||
|
||||
public ByteBuf writeFloat(float f)
|
||||
{
|
||||
return this.a.writeFloat(f);
|
||||
}
|
||||
|
||||
public ByteBuf writeDouble(double d0)
|
||||
{
|
||||
return this.a.writeDouble(d0);
|
||||
}
|
||||
|
||||
public ByteBuf writeBytes(ByteBuf bytebuf)
|
||||
{
|
||||
return this.a.writeBytes(bytebuf);
|
||||
}
|
||||
|
||||
public ByteBuf writeBytes(ByteBuf bytebuf, int i)
|
||||
{
|
||||
return this.a.writeBytes(bytebuf, i);
|
||||
}
|
||||
|
||||
public ByteBuf writeBytes(ByteBuf bytebuf, int i, int j)
|
||||
{
|
||||
return this.a.writeBytes(bytebuf, i, j);
|
||||
}
|
||||
|
||||
public ByteBuf writeBytes(byte[] abyte)
|
||||
{
|
||||
return this.a.writeBytes(abyte);
|
||||
}
|
||||
|
||||
public ByteBuf writeBytes(byte[] abyte, int i, int j)
|
||||
{
|
||||
return this.a.writeBytes(abyte, i, j);
|
||||
}
|
||||
|
||||
public ByteBuf writeBytes(ByteBuffer bytebuffer)
|
||||
{
|
||||
return this.a.writeBytes(bytebuffer);
|
||||
}
|
||||
|
||||
public int writeBytes(InputStream inputstream, int i) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
return this.a.writeBytes(inputstream, i);
|
||||
}
|
||||
|
||||
public int writeBytes(ScatteringByteChannel scatteringbytechannel, int i) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
return this.a.writeBytes(scatteringbytechannel, i);
|
||||
}
|
||||
|
||||
public ByteBuf writeZero(int i)
|
||||
{
|
||||
return this.a.writeZero(i);
|
||||
}
|
||||
|
||||
public int indexOf(int i, int j, byte b0)
|
||||
{
|
||||
return this.a.indexOf(i, j, b0);
|
||||
}
|
||||
|
||||
public int bytesBefore(byte b0)
|
||||
{
|
||||
return this.a.bytesBefore(b0);
|
||||
}
|
||||
|
||||
public int bytesBefore(int i, byte b0)
|
||||
{
|
||||
return this.a.bytesBefore(i, b0);
|
||||
}
|
||||
|
||||
public int bytesBefore(int i, int j, byte b0)
|
||||
{
|
||||
return this.a.bytesBefore(i, j, b0);
|
||||
}
|
||||
|
||||
public int forEachByte(ByteBufProcessor bytebufprocessor)
|
||||
{
|
||||
return this.a.forEachByte(bytebufprocessor);
|
||||
}
|
||||
|
||||
public int forEachByte(int i, int j, ByteBufProcessor bytebufprocessor)
|
||||
{
|
||||
return this.a.forEachByte(i, j, bytebufprocessor);
|
||||
}
|
||||
|
||||
public int forEachByteDesc(ByteBufProcessor bytebufprocessor)
|
||||
{
|
||||
return this.a.forEachByteDesc(bytebufprocessor);
|
||||
}
|
||||
|
||||
public int forEachByteDesc(int i, int j, ByteBufProcessor bytebufprocessor)
|
||||
{
|
||||
return this.a.forEachByteDesc(i, j, bytebufprocessor);
|
||||
}
|
||||
|
||||
public ByteBuf copy()
|
||||
{
|
||||
return this.a.copy();
|
||||
}
|
||||
|
||||
public ByteBuf copy(int i, int j)
|
||||
{
|
||||
return this.a.copy(i, j);
|
||||
}
|
||||
|
||||
public ByteBuf slice()
|
||||
{
|
||||
return this.a.slice();
|
||||
}
|
||||
|
||||
public ByteBuf slice(int i, int j)
|
||||
{
|
||||
return this.a.slice(i, j);
|
||||
}
|
||||
|
||||
public ByteBuf duplicate()
|
||||
{
|
||||
return this.a.duplicate();
|
||||
}
|
||||
|
||||
public int nioBufferCount()
|
||||
{
|
||||
return this.a.nioBufferCount();
|
||||
}
|
||||
|
||||
public ByteBuffer nioBuffer()
|
||||
{
|
||||
return this.a.nioBuffer();
|
||||
}
|
||||
|
||||
public ByteBuffer nioBuffer(int i, int j)
|
||||
{
|
||||
return this.a.nioBuffer(i, j);
|
||||
}
|
||||
|
||||
public ByteBuffer internalNioBuffer(int i, int j)
|
||||
{
|
||||
return this.a.internalNioBuffer(i, j);
|
||||
}
|
||||
|
||||
public ByteBuffer[] nioBuffers()
|
||||
{
|
||||
return this.a.nioBuffers();
|
||||
}
|
||||
|
||||
public ByteBuffer[] nioBuffers(int i, int j)
|
||||
{
|
||||
return this.a.nioBuffers(i, j);
|
||||
}
|
||||
|
||||
public boolean hasArray()
|
||||
{
|
||||
return this.a.hasArray();
|
||||
}
|
||||
|
||||
public byte[] array()
|
||||
{
|
||||
return this.a.array();
|
||||
}
|
||||
|
||||
public int arrayOffset()
|
||||
{
|
||||
return this.a.arrayOffset();
|
||||
}
|
||||
|
||||
public boolean hasMemoryAddress()
|
||||
{
|
||||
return this.a.hasMemoryAddress();
|
||||
}
|
||||
|
||||
public long memoryAddress()
|
||||
{
|
||||
return this.a.memoryAddress();
|
||||
}
|
||||
|
||||
public String toString(Charset charset)
|
||||
{
|
||||
return this.a.toString(charset);
|
||||
}
|
||||
|
||||
public String toString(int i, int j, Charset charset)
|
||||
{
|
||||
return this.a.toString(i, j, charset);
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
return this.a.hashCode();
|
||||
}
|
||||
|
||||
public boolean equals(Object object)
|
||||
{
|
||||
return this.a.equals(object);
|
||||
}
|
||||
|
||||
public int compareTo(ByteBuf bytebuf)
|
||||
{
|
||||
return this.a.compareTo(bytebuf);
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.a.toString();
|
||||
}
|
||||
|
||||
public ByteBuf retain(int i)
|
||||
{
|
||||
return this.a.retain(i);
|
||||
}
|
||||
|
||||
public ByteBuf retain()
|
||||
{
|
||||
return this.a.retain();
|
||||
}
|
||||
|
||||
public int refCnt()
|
||||
{
|
||||
return this.a.refCnt();
|
||||
}
|
||||
|
||||
public boolean release()
|
||||
{
|
||||
return this.a.release();
|
||||
}
|
||||
|
||||
public boolean release(int i)
|
||||
{
|
||||
return this.a.release(i);
|
||||
}
|
||||
}
|
@ -116,7 +116,7 @@ public class Arcade extends JavaPlugin
|
||||
PetManager petManager = new PetManager(this, _clientManager, _donationManager, creature, webServerAddress);
|
||||
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager);
|
||||
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager);
|
||||
CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager);
|
||||
CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, true);
|
||||
cosmeticManager.setInterfaceSlot(7);
|
||||
|
||||
//Arcade Manager
|
||||
|
@ -26,7 +26,6 @@ import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import nautilus.game.arcade.game.games.hideseek.HideSeek;
|
||||
import nautilus.game.arcade.game.games.micro.Micro;
|
||||
import nautilus.game.arcade.game.games.milkcow.MilkCow;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.quiver.Quiver;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeams;
|
||||
|
@ -41,6 +41,7 @@ import org.bukkit.scoreboard.Scoreboard;
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
@ -51,6 +52,7 @@ import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.UtilText.TextAlign;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.cosmetic.event.ActivateGemBoosterEvent;
|
||||
import mineplex.core.donation.Donor;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.packethandler.IPacketRunnable;
|
||||
@ -1178,29 +1180,18 @@ public class GameLobbyManager implements IPacketRunnable, Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void GemBoosterInteract(PlayerInteractEvent event)
|
||||
public void GemBoosterInteract(ActivateGemBoosterEvent event)
|
||||
{
|
||||
if (Manager.IsTournamentServer())
|
||||
if (Manager.IsTournamentServer() || Manager.GetGame() == null || Manager.GetGame().GetState() != GameState.Recruit)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
event.getPlayer().sendMessage(F.main("Arcade", "You can't use Gem Boosters right now."));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player.getItemInHand() == null)
|
||||
return;
|
||||
|
||||
if (player.getItemInHand().getType() != Material.EMERALD)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame().GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
if (Manager.getInventoryManager().Get(player).getItemCount("Gem Booster") <= 0)
|
||||
return;
|
||||
|
||||
Manager.GetGame().AddGemBooster(player);
|
||||
Manager.GetGame().AddGemBooster(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
|
Loading…
Reference in New Issue
Block a user