diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 33d178d01..1560c7054 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -43,6 +43,7 @@ import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; @@ -177,6 +178,26 @@ public class PetManager extends MiniClientPlugin } } + @EventHandler + public void orderThatBone(final PlayerDropItemEvent event) + { + if (event.getItemDrop().getItemStack().getType() == Material.BONE) + { + Bukkit.getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable() + { + public void run() + { + if (event.getPlayer().isOnline()) + { + event.getPlayer().getInventory().remove(Material.BONE); + event.getPlayer().getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 1, ChatColor.RESET + C.cGreen + "Pet Menu")); + event.getPlayer().updateInventory(); + } + } + }); + } + } + @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index 9e0bb27be..4b2353613 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -67,7 +67,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor String name = args[1]; int amount = Integer.parseInt(args[2]); - _donationManager.RewardGems(null, name, amount); + _donationManager.RewardGems(null, name, "purchase", amount); System.out.println("enjin gem"); } else if (args.length == 4 && args[0].equalsIgnoreCase("rank")) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 5b2db80c7..3d197bc1f 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -107,7 +107,7 @@ public class HubManager extends MiniClientPlugin new JumpManager(this); new NewsManager(this); - new GadgetManager(this, new MountManager(this), clientManager, donationManager); + new GadgetManager(this, new MountManager(this)); _partyManager = partyManager; _tutorialManager = new TutorialManager(this, donationManager, taskManager, _textCreator); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/GadgetManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/GadgetManager.java index 6ff2d67dd..ebafe8476 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/GadgetManager.java @@ -2,17 +2,18 @@ package mineplex.hub.gadget; import java.util.HashSet; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import mineplex.core.MiniPlugin; -import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; import mineplex.core.common.util.C; -import mineplex.core.donation.DonationManager; import mineplex.core.itemstack.ItemStackFactory; import mineplex.hub.HubManager; import mineplex.hub.gadget.gadgets.Halloween2013_BatGun; @@ -32,7 +33,7 @@ public class GadgetManager extends MiniPlugin private HashSet _gadgets; - public GadgetManager(HubManager manager, MountManager mountManager, CoreClientManager clientManager, DonationManager donationManager) + public GadgetManager(HubManager manager, MountManager mountManager) { super("Gadget Manager", manager.GetPlugin()); @@ -40,9 +41,9 @@ public class GadgetManager extends MiniPlugin CreateGadgets(); - _gadgetShop = new GadgetShop(this, mountManager, clientManager, donationManager); + _gadgetShop = new GadgetShop(this, mountManager, Manager.GetClients(), Manager.GetDonation()); } - + private void CreateGadgets() { _gadgets = new HashSet(); @@ -59,6 +60,34 @@ public class GadgetManager extends MiniPlugin public void onPlayerJoin(PlayerJoinEvent event) { event.getPlayer().getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.CHEST, (byte)0, 1, ChatColor.RESET + C.cGreen + "Gadget Menu")); + + if (Manager.GetClients().Get(event.getPlayer()).GetRank().Has(Rank.MODERATOR)) + { + for (Gadget gadget : _gadgets) + { + Manager.GetDonation().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(gadget.GetName()); + } + } + } + + @EventHandler + public void orderThatChest(final PlayerDropItemEvent event) + { + if (event.getItemDrop().getItemStack().getType() == Material.CHEST) + { + Bukkit.getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable() + { + public void run() + { + if (event.getPlayer().isOnline()) + { + event.getPlayer().getInventory().remove(Material.CHEST); + event.getPlayer().getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.CHEST, (byte)0, 1, ChatColor.RESET + C.cGreen + "Gadget Menu")); + event.getPlayer().updateInventory(); + } + } + }); + } } @EventHandler diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/types/Gadget.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/types/Gadget.java index 238764fa6..ed027c6ea 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/types/Gadget.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/types/Gadget.java @@ -10,14 +10,12 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; public abstract class Gadget extends SalesPackageBase implements Listener { public GadgetManager Manager; - private HashSet _owners = new HashSet(); protected HashSet _active = new HashSet(); public Gadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data) @@ -30,11 +28,6 @@ public abstract class Gadget extends SalesPackageBase implements Listener Manager.GetPlugin().getServer().getPluginManager().registerEvents(this, Manager.GetPlugin()); } - public HashSet GetOwners() - { - return _owners; - } - public HashSet GetActive() { return _active; @@ -45,24 +38,9 @@ public abstract class Gadget extends SalesPackageBase implements Listener return _active.contains(player); } - public boolean HasGadget(Player player) - { - return _owners.contains(player); - } - - @EventHandler - public void PlayerJoin(PlayerJoinEvent event) - { - if (event.getPlayer().isOp()) - { - _owners.add(event.getPlayer()); - } - } - @EventHandler public void PlayerQuit(PlayerQuitEvent event) { - _owners.remove(event.getPlayer()); Disable(event.getPlayer()); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/types/ItemGadget.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/types/ItemGadget.java index 334fe0457..6d4fa86ed 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/types/ItemGadget.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/types/ItemGadget.java @@ -2,8 +2,11 @@ package mineplex.hub.gadget.types; import java.util.HashSet; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerDropItemEvent; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; @@ -39,6 +42,26 @@ public abstract class ItemGadget extends Gadget UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(GetName()) + ".")); } + @EventHandler + public void orderThatChest(final PlayerDropItemEvent event) + { + if (event.getItemDrop().getItemStack().getType() == GetDisplayMaterial()) + { + Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() + { + public void run() + { + if (event.getPlayer().isOnline()) + { + event.getPlayer().getInventory().remove(GetDisplayMaterial()); + event.getPlayer().getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(GetName()))); + event.getPlayer().updateInventory(); + } + } + }); + } + } + public void RemoveItem(Player player) { player.getInventory().setItem(4, null); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java index deeaa51a3..894e9ebe4 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java @@ -2,6 +2,8 @@ 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; @@ -11,6 +13,7 @@ import org.bukkit.entity.Horse; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; @@ -41,8 +44,6 @@ public class StackerManager extends MiniPlugin implements IThrown private HashSet _disabled = new HashSet(); private HashSet _tempStackShift = new HashSet(); - - private int _slot = 7; @@ -82,7 +83,6 @@ public class StackerManager extends MiniPlugin implements IThrown } } - @EventHandler public void PlayerJoin(PlayerJoinEvent event) { @@ -90,6 +90,26 @@ public class StackerManager extends MiniPlugin implements IThrown C.cYellow + "Stacker" + C.cWhite + " - " + C.cGreen + "Enabled")); } + @EventHandler + public void orderThatItem(final PlayerDropItemEvent event) + { + if (event.getItemDrop().getItemStack().getType() == Material.REDSTONE_TORCH_OFF || event.getItemDrop().getItemStack().getType() == Material.REDSTONE_TORCH_ON) + { + Bukkit.getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable() + { + public void run() + { + if (event.getPlayer().isOnline()) + { + event.getPlayer().getInventory().remove(event.getItemDrop().getItemStack().getType()); + event.getPlayer().getInventory().setItem(_slot, ItemStackFactory.Instance.CreateStack(event.getItemDrop().getItemStack().getType(), (byte)0, 1, ChatColor.RESET + C.cYellow + "Stacker" + C.cWhite + (_disabled.contains(event.getPlayer()) ? C.cWhite + " - " + C.cRed + "Disabled" : " - " + C.cGreen + "Enabled"))); + event.getPlayer().updateInventory(); + } + } + }); + } + } + @EventHandler public void PlayerQuit(PlayerQuitEvent event) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/VisibilityManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/VisibilityManager.java index f25ef2511..26d6dd6d9 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/VisibilityManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/VisibilityManager.java @@ -3,12 +3,15 @@ package mineplex.hub.modules; import java.util.HashMap; import java.util.HashSet; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.InventoryType; +import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -59,6 +62,26 @@ public class VisibilityManager extends MiniPlugin _hide.remove(event.getPlayer()); } + @EventHandler + public void orderThatItem(final PlayerDropItemEvent event) + { + if (event.getItemDrop().getItemStack().getType() == Material.EYE_OF_ENDER || event.getItemDrop().getItemStack().getType() == Material.ENDER_PEARL) + { + Bukkit.getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable() + { + public void run() + { + if (event.getPlayer().isOnline()) + { + event.getPlayer().getInventory().remove(event.getItemDrop().getItemStack().getType()); + event.getPlayer().getInventory().setItem(_slot, ItemStackFactory.Instance.CreateStack(event.getItemDrop().getItemStack().getType(), (byte)0, 1, ChatColor.RESET + C.cYellow + "Show Players" + C.cWhite + " - " + (_hide.contains(event.getPlayer()) ? C.cRed + "Disabled" : C.cGreen + "Enabled"))); + event.getPlayer().updateInventory(); + } + } + }); + } + } + @EventHandler public void ToggleVisibility(PlayerInteractEvent event) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mount/MountManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mount/MountManager.java index 9e3a96c6a..cd29a4227 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/mount/MountManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mount/MountManager.java @@ -8,8 +8,10 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerJoinEvent; import mineplex.core.MiniPlugin; +import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.hub.HubManager; @@ -43,6 +45,18 @@ public class MountManager extends MiniPlugin return _types; } + @EventHandler + public void onPlayerJoin(PlayerJoinEvent event) + { + if (Manager.GetClients().Get(event.getPlayer()).GetRank().Has(Rank.MODERATOR)) + { + for (Mount gadget : _types) + { + Manager.GetDonation().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(gadget.GetName()); + } + } + } + //Disallows two mounts active public void DeregisterAll(Player player) {