From 59f93d46ec6095d99500af3b3143031cc3f8eba4 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Thu, 4 Dec 2014 05:05:27 -0800 Subject: [PATCH] Refactored IButton Added ComplexButton Added Clans farming. Added Clans Recipes. Added Clans gameplay. Added shop files structure. --- .../mineplex/core/common/CurrencyType.java | 2 +- .../ui/button/ActivateGadgetButton.java | 16 +- .../ui/button/ActivateMountButton.java | 18 +- .../cosmetic/ui/button/ActivatePetButton.java | 17 +- .../core/cosmetic/ui/button/CloseButton.java | 12 +- .../ui/button/DeactivateGadgetButton.java | 16 +- .../ui/button/DeactivateMountButton.java | 16 +- .../ui/button/DeactivatePetButton.java | 14 +- .../core/cosmetic/ui/button/GadgetButton.java | 12 +- .../core/cosmetic/ui/button/MountButton.java | 25 +- .../core/cosmetic/ui/button/OpenCostumes.java | 3 - .../core/cosmetic/ui/button/OpenGadgets.java | 12 +- .../core/cosmetic/ui/button/OpenMorphs.java | 15 +- .../core/cosmetic/ui/button/OpenMounts.java | 15 +- .../cosmetic/ui/button/OpenParticles.java | 15 +- .../core/cosmetic/ui/button/OpenPets.java | 16 +- .../core/cosmetic/ui/button/PetButton.java | 12 +- .../cosmetic/ui/button/RenamePetButton.java | 18 +- .../cosmetic/ui/button/SelectTagButton.java | 12 +- .../cosmetic/ui/button/TreasureButton.java | 16 +- .../mineplex/core/cosmetic/ui/page/Menu.java | 25 - .../core/cosmetic/ui/page/MountPage.java | 20 +- .../core/cosmetic/ui/page/PetPage.java | 14 - .../core/preferences/ui/PreferencesPage.java | 101 +--- .../mineplex/core/punish/UI/PunishButton.java | 11 +- .../mineplex/core/punish/UI/PunishPage.java | 8 +- .../punish/UI/RemovePunishmentButton.java | 13 +- .../core/shop/item/ComplexButton.java | 31 ++ .../src/mineplex/core/shop/item/IButton.java | 5 +- .../mineplex/core/shop/item/SingleButton.java | 12 +- .../core/shop/page/ConfirmationPage.java | 42 +- .../mineplex/core/shop/page/ShopPageBase.java | 27 +- .../src/mineplex/game/clans/Clans.java | 4 +- .../src/mineplex/game/clans/Farming.java | 75 +++ .../src/mineplex/game/clans/Recipes.java | 220 ++++++++ .../clans/clans/ClansDataAccessLayer.java | 3 - .../game/clans/clans/ClansManager.java | 6 + .../game/clans/gameplay/DieCommand.java | 21 + .../game/clans/gameplay/Gameplay.java | 480 ++++++++++++++++++ .../game/clans/shop/BuildingPage.java | 20 + .../game/clans/shop/BuildingShop.java | 22 + .../src/mineplex/hub/queue/ui/QueuePage.java | 31 +- .../hub/server/ui/button/SelectBHButton.java | 12 +- .../hub/server/ui/button/SelectBRButton.java | 12 +- .../hub/server/ui/button/SelectCSButton.java | 12 +- .../hub/server/ui/button/SelectDMTButton.java | 14 +- .../hub/server/ui/button/SelectDOMButton.java | 14 +- .../hub/server/ui/button/SelectMINButton.java | 14 +- .../hub/server/ui/button/SelectMSButton.java | 14 +- .../hub/server/ui/button/SelectSGButton.java | 14 +- .../hub/server/ui/button/SelectSSMButton.java | 14 +- .../hub/server/ui/button/SelectTDMButton.java | 12 +- .../shop/button/DeleteCustomBuildButton.java | 12 +- .../shop/button/DeselectItemButton.java | 17 +- .../button/EditAndSaveCustomBuildButton.java | 12 +- .../shop/button/PurchaseItemButton.java | 14 +- .../shop/button/PurchaseSkillButton.java | 14 +- .../shop/button/SelectClassButton.java | 12 +- .../shop/button/SelectCustomBuildButton.java | 14 +- .../shop/button/SelectItemButton.java | 16 +- .../shop/button/SelectSkillButton.java | 15 +- 61 files changed, 1167 insertions(+), 564 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/shop/item/ComplexButton.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Farming.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Recipes.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/DieCommand.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/BuildingPage.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/BuildingShop.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/CurrencyType.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/CurrencyType.java index 5d66457df..f32ced62d 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/CurrencyType.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/CurrencyType.java @@ -6,7 +6,7 @@ public enum CurrencyType { Tokens(" Tokens", Material.EMERALD), Coins(" Coins", Material.DOUBLE_PLANT), - Gems("Gems", Material.DIAMOND); + Gems(" Gems", Material.EMERALD); private String _prefix; private Material _displayMaterial; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateGadgetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateGadgetButton.java index a6a818eae..b9541fcbf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateGadgetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateGadgetButton.java @@ -4,9 +4,9 @@ import org.bukkit.entity.Player; import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.gadget.types.Gadget; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ComplexButton; -public class ActivateGadgetButton implements IButton +public class ActivateGadgetButton extends ComplexButton { private Gadget _gadget; private GadgetPage _page; @@ -28,4 +28,16 @@ public class ActivateGadgetButton implements IButton { _page.handleRightClick(player, _gadget); } + + @Override + public void ClickedShiftLeft(Player player) + { + _page.activateGadget(player, _gadget); + } + + @Override + public void ClickedShiftRight(Player player) + { + _page.handleRightClick(player, _gadget); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateMountButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateMountButton.java index 2ef7d0e3b..031cc87f7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateMountButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateMountButton.java @@ -5,9 +5,9 @@ import org.bukkit.entity.Player; import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.MountPage; import mineplex.core.mount.Mount; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; -public class ActivateMountButton implements IButton +public class ActivateMountButton extends SingleButton { private Mount _mount; private MountPage _page; @@ -17,16 +17,12 @@ public class ActivateMountButton implements IButton _mount = mount; _page = page; } - + @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { - _page.activateMount(player, _mount); - } - - @Override - public void ClickedRight(Player player) - { - _page.activateMount(player, _mount); + _page.PlayAcceptSound(player); + _mount.Enable(player); + _page.getShop().OpenPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivatePetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivatePetButton.java index 68d2294a1..cd7cff9d0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivatePetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivatePetButton.java @@ -2,11 +2,12 @@ package mineplex.core.cosmetic.ui.button; import org.bukkit.entity.Player; +import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.PetPage; import mineplex.core.pet.Pet; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; -public class ActivatePetButton implements IButton +public class ActivatePetButton extends SingleButton { private Pet _pet; private PetPage _page; @@ -18,14 +19,10 @@ public class ActivatePetButton implements IButton } @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { - _page.activatePet(player, _pet); - } - - @Override - public void ClickedRight(Player player) - { - _page.activatePet(player, _pet); + _page.PlayAcceptSound(player); + _page.getPlugin().getPetManager().AddPetOwner(player, _pet.GetPetType(), player.getLocation()); + _page.getShop().OpenPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/CloseButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/CloseButton.java index ed48a635a..f9d116a77 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/CloseButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/CloseButton.java @@ -2,18 +2,12 @@ package mineplex.core.cosmetic.ui.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; -public class CloseButton implements IButton +public class CloseButton extends SingleButton { @Override - public void ClickedLeft(Player player) - { - player.closeInventory(); - } - - @Override - public void ClickedRight(Player player) + public void Clicked(Player player) { player.closeInventory(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateGadgetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateGadgetButton.java index a7f9d2044..c608686c7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateGadgetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateGadgetButton.java @@ -4,9 +4,9 @@ import org.bukkit.entity.Player; import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.gadget.types.Gadget; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ComplexButton; -public class DeactivateGadgetButton implements IButton +public class DeactivateGadgetButton extends ComplexButton { private Gadget _gadget; private GadgetPage _page; @@ -28,4 +28,16 @@ public class DeactivateGadgetButton implements IButton { _page.handleRightClick(player, _gadget); } + + @Override + public void ClickedShiftLeft(Player player) + { + _page.deactivateGadget(player, _gadget); + } + + @Override + public void ClickedShiftRight(Player player) + { + _page.handleRightClick(player, _gadget); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateMountButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateMountButton.java index 8af3cfba1..feb6114f8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateMountButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateMountButton.java @@ -2,11 +2,11 @@ package mineplex.core.cosmetic.ui.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.core.shop.page.ShopPageBase; import mineplex.core.mount.Mount; -public class DeactivateMountButton implements IButton +public class DeactivateMountButton extends SingleButton { private Mount _mount; private ShopPageBase _page; @@ -16,17 +16,9 @@ public class DeactivateMountButton implements IButton _mount = mount; _page = page; } - + @Override - public void ClickedLeft(Player player) - { - _page.PlayAcceptSound(player); - _mount.Disable(player); - _page.Refresh(); - } - - @Override - public void ClickedRight(Player player) + public void Clicked(Player player) { _page.PlayAcceptSound(player); _mount.Disable(player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivatePetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivatePetButton.java index 4bb78ad53..a8518f575 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivatePetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivatePetButton.java @@ -3,10 +3,10 @@ package mineplex.core.cosmetic.ui.button; import org.bukkit.entity.Player; import mineplex.core.pet.PetManager; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.core.shop.page.ShopPageBase; -public class DeactivatePetButton implements IButton +public class DeactivatePetButton extends SingleButton { private ShopPageBase _page; private PetManager _petManager; @@ -18,15 +18,7 @@ public class DeactivatePetButton implements IButton } @Override - public void ClickedLeft(Player player) - { - _page.PlayAcceptSound(player); - _petManager.RemovePet(player, true); - _page.Refresh(); - } - - @Override - public void ClickedRight(Player player) + public void Clicked(Player player) { _page.PlayAcceptSound(player); _petManager.RemovePet(player, true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/GadgetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/GadgetButton.java index df218c8b7..3d10c2700 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/GadgetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/GadgetButton.java @@ -4,9 +4,9 @@ import org.bukkit.entity.Player; import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.gadget.types.Gadget; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; -public class GadgetButton implements IButton +public class GadgetButton extends SingleButton { private Gadget _gadget; private GadgetPage _page; @@ -16,15 +16,9 @@ public class GadgetButton implements IButton _gadget = gadget; _page = page; } - - @Override - public void ClickedLeft(Player player) - { - _page.purchaseGadget(player, _gadget); - } @Override - public void ClickedRight(Player player) + public void Clicked(Player player) { _page.purchaseGadget(player, _gadget); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/MountButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/MountButton.java index 305296478..adc7b1464 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/MountButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/MountButton.java @@ -2,11 +2,15 @@ package mineplex.core.cosmetic.ui.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; +import mineplex.core.shop.page.ConfirmationPage; +import mineplex.core.common.CurrencyType; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.page.MountPage; import mineplex.core.mount.Mount; -public class MountButton implements IButton +public class MountButton extends SingleButton { private Mount _mount; private MountPage _page; @@ -16,16 +20,17 @@ public class MountButton implements IButton _mount = mount; _page = page; } - - @Override - public void ClickedLeft(Player player) - { - _page.purchaseMount(player, _mount); - } @Override - public void ClickedRight(Player player) + public void Clicked(final Player player) { - _page.purchaseMount(player, _mount); + _page.getShop().OpenPageForPlayer(player, new ConfirmationPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), new Runnable() + { + public void run() + { + _page.getPlugin().getInventoryManager().addItemToInventory(null, player, "Mount", _mount.GetName(), 1); + _page.Refresh(); + } + }, _page, _mount, CurrencyType.Coins, player)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenCostumes.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenCostumes.java index f6b6a7e5a..a41ee33c4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenCostumes.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenCostumes.java @@ -5,9 +5,6 @@ import org.bukkit.entity.Player; import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.shop.item.SingleButton; -/** - * Created by shaun on 14-09-15. - */ public class OpenCostumes extends SingleButton { private Menu _menu; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGadgets.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGadgets.java index e3ea3c3dc..8654ff9f1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGadgets.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGadgets.java @@ -1,9 +1,11 @@ package mineplex.core.cosmetic.ui.button; +import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.shop.item.IButton; import org.bukkit.entity.Player; +import org.bukkit.event.inventory.InventoryClickEvent; public class OpenGadgets implements IButton { @@ -13,16 +15,10 @@ public class OpenGadgets implements IButton { _page = page; } - - @Override - public void ClickedLeft(Player player) - { - _page.openGadgets(player); - } @Override - public void ClickedRight(Player player) + public void Clicked(InventoryClickEvent event) { - _page.openGadgets(player); + _page.getShop().OpenPageForPlayer((Player)event.getWhoClicked(), new GadgetPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Gadgets", (Player)event.getWhoClicked())); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMorphs.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMorphs.java index 029f28ea8..ec03a17fe 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMorphs.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMorphs.java @@ -1,11 +1,12 @@ package mineplex.core.cosmetic.ui.button; import mineplex.core.cosmetic.ui.page.Menu; -import mineplex.core.shop.item.IButton; +import mineplex.core.cosmetic.ui.page.MorphPage; +import mineplex.core.shop.item.SingleButton; import org.bukkit.entity.Player; -public class OpenMorphs implements IButton +public class OpenMorphs extends SingleButton { private Menu _page; @@ -15,14 +16,8 @@ public class OpenMorphs implements IButton } @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { - _page.openMorphs(player); - } - - @Override - public void ClickedRight(Player player) - { - _page.openMorphs(player); + _page.getShop().OpenPageForPlayer(player, new MorphPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Morphs", player)); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java index 7b4d66c74..2771098a7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java @@ -1,11 +1,12 @@ package mineplex.core.cosmetic.ui.button; import mineplex.core.cosmetic.ui.page.Menu; -import mineplex.core.shop.item.IButton; +import mineplex.core.cosmetic.ui.page.MorphPage; +import mineplex.core.shop.item.SingleButton; import org.bukkit.entity.Player; -public class OpenMounts implements IButton +public class OpenMounts extends SingleButton { private Menu _page; @@ -15,14 +16,8 @@ public class OpenMounts implements IButton } @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { - _page.openMounts(player); - } - - @Override - public void ClickedRight(Player player) - { - _page.openMounts(player); + _page.getShop().OpenPageForPlayer(player, new MorphPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Mounts", player)); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java index 8e43f4616..5fbe092bc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java @@ -1,11 +1,12 @@ package mineplex.core.cosmetic.ui.button; import mineplex.core.cosmetic.ui.page.Menu; -import mineplex.core.shop.item.IButton; +import mineplex.core.cosmetic.ui.page.MorphPage; +import mineplex.core.shop.item.SingleButton; import org.bukkit.entity.Player; -public class OpenParticles implements IButton +public class OpenParticles extends SingleButton { private Menu _page; @@ -13,16 +14,10 @@ public class OpenParticles implements IButton { _page = page; } - - @Override - public void ClickedLeft(Player player) - { - _page.openParticles(player); - } @Override - public void ClickedRight(Player player) + public void Clicked(Player player) { - _page.openParticles(player); + _page.getShop().OpenPageForPlayer(player, new MorphPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Particles", player)); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java index aed01a6b2..b2b8e43b9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java @@ -1,11 +1,12 @@ package mineplex.core.cosmetic.ui.button; import mineplex.core.cosmetic.ui.page.Menu; -import mineplex.core.shop.item.IButton; +import mineplex.core.cosmetic.ui.page.MorphPage; +import mineplex.core.shop.item.SingleButton; import org.bukkit.entity.Player; -public class OpenPets implements IButton +public class OpenPets extends SingleButton { private Menu _page; @@ -13,16 +14,9 @@ public class OpenPets implements IButton { _page = page; } - @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { - _page.openPets(player); - } - - @Override - public void ClickedRight(Player player) - { - _page.openPets(player); + _page.getShop().OpenPageForPlayer(player, new MorphPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Pets", player)); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/PetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/PetButton.java index fc7c5562c..1991c4417 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/PetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/PetButton.java @@ -4,9 +4,9 @@ import org.bukkit.entity.Player; import mineplex.core.pet.Pet; import mineplex.core.cosmetic.ui.page.PetPage; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; -public class PetButton implements IButton +public class PetButton extends SingleButton { private Pet _pet; private PetPage _page; @@ -16,15 +16,9 @@ public class PetButton implements IButton _pet = pet; _page = page; } - - @Override - public void ClickedLeft(Player player) - { - _page.purchasePet(player, _pet); - } @Override - public void ClickedRight(Player player) + public void Clicked(Player player) { _page.purchasePet(player, _pet); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/RenamePetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/RenamePetButton.java index 9ea81994a..496459c40 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/RenamePetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/RenamePetButton.java @@ -1,11 +1,13 @@ package mineplex.core.cosmetic.ui.button; +import org.bukkit.entity.Creature; import org.bukkit.entity.Player; import mineplex.core.cosmetic.ui.page.PetPage; -import mineplex.core.shop.item.IButton; +import mineplex.core.pet.Pet; +import mineplex.core.shop.item.SingleButton; -public class RenamePetButton implements IButton +public class RenamePetButton extends SingleButton { private PetPage _page; @@ -13,16 +15,12 @@ public class RenamePetButton implements IButton { _page = page; } - - @Override - public void ClickedLeft(Player player) - { - _page.renameCurrentPet(player); - } @Override - public void ClickedRight(Player player) + public void Clicked(Player player) { - _page.renameCurrentPet(player); + _page.PlayAcceptSound(player); + Creature currentPet = _page.getPlugin().getPetManager().getActivePet(player.getName()); + _page.renamePet(player, new Pet(currentPet.getCustomName(), currentPet.getType(), 1), false); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/SelectTagButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/SelectTagButton.java index 2271e2e56..e90ae129b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/SelectTagButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/SelectTagButton.java @@ -3,9 +3,9 @@ package mineplex.core.cosmetic.ui.button; import org.bukkit.entity.Player; import mineplex.core.cosmetic.ui.page.PetTagPage; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; -public class SelectTagButton implements IButton +public class SelectTagButton extends SingleButton { private PetTagPage _page; @@ -13,15 +13,9 @@ public class SelectTagButton implements IButton { _page = page; } - - @Override - public void ClickedLeft(Player player) - { - _page.SelectTag(); - } @Override - public void ClickedRight(Player player) + public void Clicked(Player player) { _page.SelectTag(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/TreasureButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/TreasureButton.java index 7db4aaf2b..4c057de59 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/TreasureButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/TreasureButton.java @@ -3,9 +3,9 @@ package mineplex.core.cosmetic.ui.button; import org.bukkit.entity.Player; import mineplex.core.cosmetic.ui.page.Menu; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ComplexButton; -public class TreasureButton implements IButton +public class TreasureButton extends ComplexButton { private Menu _menu; private boolean _hasEnoughChests; @@ -40,4 +40,16 @@ public class TreasureButton implements IButton if (_canPurchaseKey) _menu.attemptPurchaseKey(player); } + + @Override + public void ClickedShiftLeft(Player player) + { + ClickedLeft(player); + } + + @Override + public void ClickedShiftRight(Player player) + { + ClickedRight(player); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 39f9c5bbc..689d4cc38 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -201,31 +201,6 @@ public class Menu extends ShopPageBase }); } } - - public void openParticles(Player player) - { - Shop.OpenPageForPlayer(player, new ParticlePage(Plugin, Shop, ClientManager, DonationManager, "Particles", player)); - } - - public void openGadgets(Player player) - { - Shop.OpenPageForPlayer(player, new GadgetPage(Plugin, Shop, ClientManager, DonationManager, "Gadgets", player)); - } - - public void openMorphs(Player player) - { - Shop.OpenPageForPlayer(player, new MorphPage(Plugin, Shop, ClientManager, DonationManager, "Morphs", player)); - } - - public void openMounts(Player player) - { - Shop.OpenPageForPlayer(player, new MountPage(Plugin, Shop, ClientManager, DonationManager, "Mounts", player)); - } - - public void openPets(Player player) - { - Shop.OpenPageForPlayer(player, new PetPage(Plugin, Shop, ClientManager, DonationManager, "Pets", player)); - } public void openCostumes(Player player) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java index f37853345..d3509de89 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java @@ -17,6 +17,7 @@ import mineplex.core.cosmetic.ui.button.DeactivateMountButton; import mineplex.core.cosmetic.ui.button.MountButton; import mineplex.core.donation.DonationManager; import mineplex.core.mount.Mount; +import mineplex.core.shop.ShopBase; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.SingleButton; import mineplex.core.shop.page.ConfirmationPage; @@ -85,23 +86,4 @@ public class MountPage extends ShopPageBase } }); } - - public void purchaseMount(final Player player, final Mount mount) - { - Shop.OpenPageForPlayer(Player, new ConfirmationPage(Plugin, Shop, ClientManager, DonationManager, new Runnable() - { - public void run() - { - Plugin.getInventoryManager().addItemToInventory(null, Player, "Mount", mount.GetName(), 1); - Refresh(); - } - }, this, mount, CurrencyType.Coins, Player)); - } - - public void activateMount(Player player, Mount _mount) - { - PlayAcceptSound(player); - _mount.Enable(player); - Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player)); - } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index 53e92f4ef..7e59a73f9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -137,13 +137,6 @@ public class PetPage extends ShopPageBase { renamePet(player, pet, true); } - - public void renameCurrentPet(Player player) - { - PlayAcceptSound(player); - Creature currentPet = Plugin.getPetManager().getActivePet(player.getName()); - renamePet(player, new Pet(currentPet.getCustomName(), currentPet.getType(), 1), false); - } public void renamePet(Player player, Pet pet, boolean petPurchase) { @@ -161,13 +154,6 @@ public class PetPage extends ShopPageBase Shop.SetCurrentPageForPlayer(Player, petTagPage); } - public void activatePet(Player player, Pet pet) - { - PlayAcceptSound(player); - Plugin.getPetManager().AddPetOwner(player, pet.GetPetType(), player.getLocation()); - Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player)); - } - public void deactivatePet(Player player) { PlayAcceptSound(player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java index 16f5ac716..04219156b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java @@ -3,6 +3,7 @@ package mineplex.core.preferences.ui; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.event.inventory.InventoryClickEvent; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; @@ -50,150 +51,90 @@ public class PreferencesPage extends ShopPageBase> extends ShopPageBase implements Runnable { @@ -59,30 +61,18 @@ public class ConfirmationPage 0.9) + event.getBlock().getWorld().dropItemNaturally( + event.getBlock().getLocation().add(0.5, 0.5, 0.5), + ItemStackFactory.Instance.CreateStack(Material.APPLE)); + + if (Math.random() > 0.999) + event.getBlock().getWorld().dropItemNaturally( + event.getBlock().getLocation().add(0.5, 0.5, 0.5), + ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE)); + } + + @EventHandler + public void BlockPlace(BlockPlaceEvent event) + { + if (event.isCancelled()) + return; + + if ( + event.getBlock().getTypeId() != 59 && + event.getBlock().getTypeId() != 83 && + event.getBlock().getTypeId() != 104 && + event.getBlock().getTypeId() != 105 && + event.getBlock().getTypeId() != 127 && + event.getBlock().getTypeId() != 141 && + event.getBlock().getTypeId() != 142 + ) + return; + + if (event.getBlock().getLocation().getY() < event.getBlock().getWorld().getSeaLevel() - 12) + { + UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot plant " + + F.item(ItemStackFactory.Instance.GetName(event.getPlayer().getItemInHand(), true)) + " this deep underground.")); + event.setCancelled(true); + } + + else if (event.getBlock().getLocation().getY() > event.getBlock().getWorld().getSeaLevel() + 24) + { + UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot plant " + + F.item(ItemStackFactory.Instance.GetName(event.getPlayer().getItemInHand(), true)) + " at this altitude.")); + event.setCancelled(true); + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Recipes.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Recipes.java new file mode 100644 index 000000000..a0fc7dbd1 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Recipes.java @@ -0,0 +1,220 @@ +package mineplex.game.clans; + +import mineplex.core.MiniPlugin; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; + +import org.bukkit.Material; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.inventory.PrepareItemCraftEvent; +import org.bukkit.inventory.CraftingInventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.ShapedRecipe; +import org.bukkit.plugin.java.JavaPlugin; + +public class Recipes extends MiniPlugin +{ + public Recipes(JavaPlugin plugin) + { + super("Recipes", plugin); + + ShapedRecipe goldAxe = new ShapedRecipe(new ItemStack(Material.GOLD_AXE, 1)); + goldAxe.shape("#MM","#SM","#S#"); + goldAxe.setIngredient('M', Material.GOLD_BLOCK); + goldAxe.setIngredient('S', Material.STICK); + UtilServer.getServer().addRecipe(goldAxe); + + ShapedRecipe diamondAxe = new ShapedRecipe(new ItemStack(Material.DIAMOND_AXE, 1)); + diamondAxe.shape("#MM","#SM","#S#"); + diamondAxe.setIngredient('M', Material.DIAMOND_BLOCK); + diamondAxe.setIngredient('S', Material.STICK); + UtilServer.getServer().addRecipe(diamondAxe); + + ShapedRecipe goldSword = new ShapedRecipe(new ItemStack(Material.GOLD_SWORD, 1)); + goldSword.shape("M","M","S"); + goldSword.setIngredient('M', Material.GOLD_BLOCK); + goldSword.setIngredient('S', Material.STICK); + UtilServer.getServer().addRecipe(goldSword); + + ShapedRecipe diamondSword = new ShapedRecipe(new ItemStack(Material.DIAMOND_SWORD, 1)); + diamondSword.shape("M","M","S"); + diamondSword.setIngredient('M', Material.DIAMOND_BLOCK); + diamondSword.setIngredient('S', Material.STICK); + UtilServer.getServer().addRecipe(diamondSword); + + //Iron Door + ShapedRecipe ironDoor = new ShapedRecipe(new ItemStack(Material.IRON_DOOR, 1)); + ironDoor.shape("I","I"); + ironDoor.setIngredient('I', Material.IRON_INGOT); + UtilServer.getServer().addRecipe(ironDoor); + + //Chain Helm + ShapedRecipe chainHelm = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_HELMET, 1)); + + chainHelm.shape("SIS","I#I"); + + chainHelm.setIngredient('I', Material.IRON_INGOT); + chainHelm.setIngredient('S', Material.GOLD_INGOT); + + UtilServer.getServer().addRecipe(chainHelm); + + //Chain Chest + ShapedRecipe chainChest = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_CHESTPLATE, 1)); + + chainChest.shape("I#I","SIS","ISI"); + + chainChest.setIngredient('I', Material.IRON_INGOT); + chainChest.setIngredient('S', Material.GOLD_INGOT); + + UtilServer.getServer().addRecipe(chainChest); + + //Chain Legs + ShapedRecipe chainLegs = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_LEGGINGS, 1)); + + chainLegs.shape("ISI","S#S","I#I"); + + chainLegs.setIngredient('I', Material.IRON_INGOT); + chainLegs.setIngredient('S', Material.GOLD_INGOT); + + UtilServer.getServer().addRecipe(chainLegs); + + //Chain Boots + ShapedRecipe chainBoots = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_BOOTS, 1)); + + chainBoots.shape("S#S","I#I"); + + chainBoots.setIngredient('I', Material.IRON_INGOT); + chainBoots.setIngredient('S', Material.GOLD_INGOT); + + UtilServer.getServer().addRecipe(chainBoots); + + //Chain Helm + ShapedRecipe chainHelm2 = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_HELMET, 1)); + + chainHelm2.shape("SIS","I#I"); + + chainHelm2.setIngredient('I', Material.GOLD_INGOT); + chainHelm2.setIngredient('S', Material.IRON_INGOT); + + UtilServer.getServer().addRecipe(chainHelm2); + + //Chain Chest + ShapedRecipe chainChest2 = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_CHESTPLATE, 1)); + + chainChest2.shape("I#I","SIS","ISI"); + + chainChest2.setIngredient('I', Material.GOLD_INGOT); + chainChest2.setIngredient('S', Material.IRON_INGOT); + + UtilServer.getServer().addRecipe(chainChest2); + + //Chain Legs + ShapedRecipe chainLegs2 = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_LEGGINGS, 1)); + + chainLegs2.shape("ISI","S#S","I#I"); + + chainLegs2.setIngredient('I', Material.GOLD_INGOT); + chainLegs2.setIngredient('S', Material.IRON_INGOT); + + UtilServer.getServer().addRecipe(chainLegs2); + + //Chain Boots + ShapedRecipe chainBoots2 = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_BOOTS, 1)); + + chainBoots2.shape("S#S","I#I"); + + chainBoots2.setIngredient('I', Material.GOLD_INGOT); + chainBoots2.setIngredient('S', Material.IRON_INGOT); + + UtilServer.getServer().addRecipe(chainBoots2); + } + + @EventHandler(priority = EventPriority.HIGH) + public void ReplaceDoor(PrepareItemCraftEvent event) + { + if (event.getRecipe().getResult() == null) + return; + + Material type = event.getRecipe().getResult().getType(); + + if (type != Material.WOOD_DOOR && type != Material.WOODEN_DOOR) + return; + + if (!(event.getInventory() instanceof CraftingInventory)) + return; + + CraftingInventory inv = (CraftingInventory)event.getInventory(); + + //Feedback + ItemStack result = ItemStackFactory.Instance.CreateStack(Material.IRON_DOOR); + inv.setResult(result); + } + + @EventHandler(priority = EventPriority.HIGH) + public void DenySword(PrepareItemCraftEvent event) + { + if (event.getRecipe().getResult() == null) + return; + + Material type = event.getRecipe().getResult().getType(); + + if (type != Material.DIAMOND_SWORD && type != Material.GOLD_SWORD && + type != Material.DIAMOND_AXE && type != Material.GOLD_AXE) + return; + + if (!(event.getInventory() instanceof CraftingInventory)) + return; + + CraftingInventory inv = (CraftingInventory)event.getInventory(); + + for (ItemStack cur : inv.getMatrix()) + if (cur != null) + if (cur.getType() == Material.GOLD_BLOCK || cur.getType() == Material.DIAMOND_BLOCK) + return; + + String name = ItemStackFactory.Instance.GetName(event.getRecipe().getResult(), true); + String matName = "Gold"; + if (type == Material.DIAMOND_AXE || type == Material.DIAMOND_SWORD) + matName = "Diamond"; + + //Feedback + ItemStack result = ItemStackFactory.Instance.CreateStack(36, (byte)0, 1, "§r" + C.cGray + "Recipe changed for " + F.item(name) + ".", + new String[] {C.cGray + "Use " + F.item(matName + " Blocks") + " instead of " + F.item(matName + " Ingots") + "."}); + + inv.setResult(result); + } + + @EventHandler(priority = EventPriority.HIGH) + public void DenyGeneral(PrepareItemCraftEvent event) + { + if (event.getRecipe().getResult() == null) + return; + + Material type = event.getRecipe().getResult().getType(); + + if ( + type != Material.GOLDEN_APPLE && + type != Material.GOLDEN_CARROT && + type != Material.ENDER_CHEST && + type != Material.ENCHANTMENT_TABLE && + type != Material.BREWING_STAND && + type != Material.TNT) + return; + + if (!(event.getInventory() instanceof CraftingInventory)) + return; + + CraftingInventory inv = (CraftingInventory)event.getInventory(); + + String name = ItemStackFactory.Instance.GetName(event.getRecipe().getResult(), true); + + //Feedback + ItemStack result = ItemStackFactory.Instance.CreateStack(36, (byte)0, 1, + "§r" + C.cGray + "Crafting of " + F.item(name) + " is disabled.", new String[] {}); + + inv.setResult(result); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java index 916cd910f..6f33e43e5 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java @@ -1,7 +1,5 @@ package mineplex.game.clans.clans; -import java.util.ArrayList; - import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.block.Block; @@ -12,7 +10,6 @@ import mineplex.core.common.util.UtilWorld; import mineplex.game.clans.clans.ClanInfo.Role; import mineplex.game.clans.clans.repository.ClanRepository; import mineplex.game.clans.clans.repository.ClanTerritory; -import mineplex.game.clans.clans.repository.tokens.ClanMemberToken; import mineplex.game.clans.clans.repository.tokens.ClanToken; public class ClansDataAccessLayer diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java index f13994d3f..3d6fed798 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java @@ -36,6 +36,7 @@ import mineplex.game.clans.clans.repository.tokens.ClanMemberToken; import mineplex.game.clans.clans.repository.tokens.ClanTerritoryToken; import mineplex.game.clans.clans.repository.tokens.ClanToken; import mineplex.game.clans.fields.Field; +import mineplex.game.clans.gameplay.Gameplay; import mineplex.minecraft.game.classcombat.Class.ClassManager; import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager; @@ -111,6 +112,7 @@ public class ClansManager extends MiniClientPlugin implements IRelat DamageManager damageManager = new DamageManager(plugin, _combatManager, new NpcManager(plugin, creature), disguiseManager); + new Gameplay(plugin, this, blockRestore, damageManager); ProjectileManager throwManager = new ProjectileManager(plugin); Fire fire = new Fire(plugin, _condition, damageManager); ItemFactory itemFactory = new ItemFactory(plugin, blockRestore, _condition, damageManager, energy, fire, throwManager, webServerAddress); @@ -177,6 +179,10 @@ public class ClansManager extends MiniClientPlugin implements IRelat if (_classManager.Get(event.getPlayer()) != null && _classManager.Get(event.getPlayer()).GetGameClass() != null) { CustomBuildToken activeBuild = _classManager.Get(event.getPlayer()).GetActiveCustomBuild(_classManager.Get(event.getPlayer()).GetGameClass()); + + if (activeBuild == null) + return; + activeBuild.PlayerName = event.getPlayer().getName(); // 0 is set aside for active build so we just dupe build to this row whenever we update it. diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/DieCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/DieCommand.java new file mode 100644 index 000000000..84d80a4b0 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/DieCommand.java @@ -0,0 +1,21 @@ +package mineplex.game.clans.gameplay; + +import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; + +public class DieCommand extends CommandBase +{ + public DieCommand(Gameplay plugin) + { + super(plugin, Rank.ALL, "die"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.getDamageManager().NewDamageEvent(caller, null, null, DamageCause.SUICIDE, 5000, false, true, true, null, null); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java new file mode 100644 index 000000000..576dd5dde --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java @@ -0,0 +1,480 @@ +package mineplex.game.clans.gameplay; + +import java.util.HashMap; +import java.util.HashSet; + +import mineplex.core.MiniPlugin; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.minecraft.game.core.damage.DamageManager; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.game.clans.clans.ClansManager; + +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.Effect; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Biome; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.block.BlockIgniteEvent; +import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerBucketFillEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.LeatherArmorMeta; +import org.bukkit.plugin.java.JavaPlugin; + +public class Gameplay extends MiniPlugin +{ + private ClansManager _clansManager; + private BlockRestore _blockRestore; + private DamageManager _damageManager; + + private HashMap _bucketWater = new HashMap(); + + public Gameplay(JavaPlugin plugin, ClansManager clansManager, BlockRestore blockRestore, DamageManager damageManager) + { + super("PvP Gameplay", plugin); + + _clansManager = clansManager; + _blockRestore = blockRestore; + _damageManager = damageManager; + } + + @EventHandler + public void BucketEmpty(PlayerBucketEmptyEvent event) + { + event.setCancelled(true); + + Block block = event.getBlockClicked().getRelative(event.getBlockFace()); + + if (event.getBucket() == Material.WATER_BUCKET) + { + block.setTypeIdAndData(8, (byte)1, true); + _blockRestore.Add(event.getBlockClicked().getRelative(event.getBlockFace()), 8, (byte)0, 1000); + _bucketWater.put(block, System.currentTimeMillis()); + } + + if (event.getBucket() == Material.LAVA_BUCKET) + { + block.setTypeIdAndData(10, (byte)6, true); + _blockRestore.Add(event.getBlockClicked().getRelative(event.getBlockFace()), 10, (byte)0, 2000); + } + + + event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.BUCKET)); + UtilInv.Update(event.getPlayer()); + } + + @EventHandler + public void BucketFill(PlayerBucketFillEvent event) + { + event.setCancelled(true); + + if (event.getItemStack().getType() == Material.WATER_BUCKET) + if (!_bucketWater.containsKey(event.getBlockClicked())) + event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.WATER_BUCKET)); + + UtilInv.Update(event.getPlayer()); + } + + @EventHandler + public void BucketWaterExpire(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + HashSet remove = new HashSet(); + + for (Block cur : _bucketWater.keySet()) + if (UtilTime.elapsed(_bucketWater.get(cur), 2000)) + remove.add(cur); + + for (Block cur : remove) + _bucketWater.remove(cur); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void ObsidianCancel(BlockPlaceEvent event) + { + if (event.getBlock().getType() == Material.OBSIDIAN) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.item("Obsidian") + ".")); + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void CommandPlace(BlockPlaceEvent event) + { + if (event.getBlock().getType() == Material.COMMAND || + event.getBlock().getType() == Material.NOTE_BLOCK || + event.getBlock().getType() == Material.REDSTONE_LAMP_ON) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.item("Proximity Devices") + ".")); + event.setCancelled(true); + } + } + + @EventHandler + public void WebBreak(BlockDamageEvent event) + { + if (event.isCancelled()) + return; + + if (event.getBlock().getType() == Material.WEB) + event.setInstaBreak(true); + } + + @EventHandler + public void LapisPlace(BlockPlaceEvent event) + { + if (event.isCancelled()) + return; + + if (event.getBlock().getType() != Material.LAPIS_BLOCK) + return; + + event.setCancelled(true); + + UtilInv.remove(event.getPlayer(), Material.LAPIS_BLOCK, (byte)0, 1); + + final Block block = event.getBlock(); + + _plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() + { + public void run() + { + block.setTypeId(8); + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 8); + block.getWorld().playSound(block.getLocation(), Sound.SPLASH, 2f, 1f); + } + }, 0); + } + + @EventHandler + public void EnderChestBreak(BlockBreakEvent event) + { + if (event.isCancelled()) + return; + + if (event.getBlock().getType() != Material.ENDER_CHEST) + return; + + event.setCancelled(true); + + event.getBlock().setTypeId(0); + event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().add(0.5, 0.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.ENDER_CHEST)); + } + + @EventHandler + public void IronDoor(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + return; + + if (event.getClickedBlock().getTypeId() != 71) + return; + + Block block = event.getClickedBlock(); + + //Knock + if (event.isCancelled()) + { + if (!Recharge.Instance.use(event.getPlayer(), "Door Knock", 500, false, false)) + return; + + block.getWorld().playEffect(block.getLocation(), Effect.ZOMBIE_CHEW_WOODEN_DOOR, 0); + } + + //Open + else + { + if (block.getData() >= 8) + block = block.getRelative(BlockFace.DOWN); + + if (block.getData() < 4) block.setData((byte)(block.getData()+4), true); + else block.setData((byte)(block.getData()-4), true); + + //Effect + block.getWorld().playEffect(block.getLocation(), Effect.DOOR_TOGGLE, 0); + } + } + + @EventHandler + public void BrewingDisable(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + return; + + if (event.getClickedBlock().getTypeId() != 117) + return; + + event.setCancelled(true); + } + + @EventHandler + public void BrewingBreak(BlockBreakEvent event) + { + if (event.isCancelled()) + return; + + if (event.getBlock().getType() != Material.BREWING_STAND) + return; + + event.setCancelled(true); + + event.getBlock().setTypeId(0); + event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().add(0.5, 0.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.BREWING_STAND)); + } + + @EventHandler + public void AnvilDisable(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + return; + + if (event.getClickedBlock().getType() != Material.ANVIL) + return; + + event.setCancelled(true); + } + + @EventHandler + public void BonemealCancel(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + Player player = event.getPlayer(); + + if (player.getItemInHand() == null) + return; + + if (player.getItemInHand().getType() != Material.INK_SACK) + return; + + if (player.getItemInHand().getData() == null) + return; + + if (player.getItemInHand().getData().getData() != 15) + return; + + event.setCancelled(true); + } + + @EventHandler + public void WildfireSpread(BlockBurnEvent event) + { + if (event.isCancelled()) + return; + + event.setCancelled(true); + + for (int x=-1 ; x<=1 ; x++) + for (int y=-1 ; y<=1 ; y++) + for (int z=-1 ; z<=1 ; z++) + { + //Self + if (x == 0 && y == 0 && z == 0) + { + event.getBlock().setType(Material.FIRE); + + if (event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.GRASS) + event.getBlock().getRelative(BlockFace.DOWN).setType(Material.DIRT); + + return; + } + + Block block = event.getBlock().getRelative(x, y, z); + + if (block.getRelative(BlockFace.DOWN).getType() == Material.GRASS) + block.getRelative(BlockFace.DOWN).setType(Material.DIRT); + + //Surroundings + if (!( + (x == 0 && y == 0) || + (x == 0 && z == 0) || + (y == 0 && z == 0) + )) + continue; + + if (block.getTypeId() == 0) + block.setType(Material.FIRE); + } + } + + @EventHandler + public void WildfireDirt(BlockIgniteEvent event) + { + if (event.isCancelled()) + return; + + if (event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.GRASS) + event.getBlock().getRelative(BlockFace.DOWN).setType(Material.DIRT); + } + + @EventHandler(priority = EventPriority.LOW) + public void WildfireCancel(BlockIgniteEvent event) + { + if (event.isCancelled()) + return; + + if (event.getBlock().getBiome() == Biome.JUNGLE || event.getBlock().getBiome() == Biome.JUNGLE_HILLS) + if (event.getCause() == IgniteCause.SPREAD) + event.setCancelled(true); + } + + /* + @EventHandler (priority = EventPriority.HIGHEST) + public void MoneyLossSteal(CombatDeathEvent event) + { + if (!(event.GetEvent().getEntity() instanceof Player)) + return; + + Player player = (Player)event.GetEvent().getEntity(); + + int balance = Clients().Get(player).Game().GetEconomyBalance(); + + int lose = (int) (0.04 * balance); + + //Balance + Clients().Get(player).Game().SetEconomyBalance(balance - lose); + + CombatLog log = event.GetLog(); + if (log.GetKiller() != null) + { + //Inform + UtilPlayer.message(UtilPlayer.searchExact(log.GetKiller().getName()), F.main("Death", "You stole " + F.count((lose) + " Coins") + " from " + F.name(player.getName()) + ".")); + + //Inform + UtilPlayer.message(player, F.main("Death", "You lost " + F.count((lose) + " Coins") + " to " + F.name(log.GetKiller().getName()) + ".")); + } + else + { + //Inform + UtilPlayer.message(player, F.main("Death", "You lost " + F.count((lose) + " Coins") + " for dying.")); + } + } + */ + + @EventHandler + public void SpawnDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.FALL) + return; + + if (!_clansManager.getClanUtility().isSpecial(event.GetDamageeEntity().getLocation(), "Spawn")) + return; + + event.SetCancelled("Spawn Fall"); + } + + @EventHandler + public void Repair(PlayerInteractEvent event) + { + if (event.getClickedBlock() == null) + return; + + if (event.getClickedBlock().getType() != Material.ANVIL) + return; + + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + return; + + Player player = event.getPlayer(); + + if (UtilMath.offset(player.getLocation(), event.getClickedBlock().getLocation()) > 2) + { + UtilPlayer.message(player, F.main("Repair", "You are too far from the " + F.item("Anvil") + ".")); + return; + } + + if (player.getItemInHand() == null) + return; + + ItemStack item = player.getItemInHand(); + + if (item.getDurability() <= 0) + { + UtilPlayer.message(player, F.main("Repair", "Your " + F.item(item == null ? ChatColor.YELLOW + "Hand" : item.getItemMeta().getDisplayName()) + " does not need repairs.")); + return; + } + + if (!UtilGear.isRepairable(item)) + { + UtilPlayer.message(player, F.main("Repair", "You cannot repair " + F.item(item.getItemMeta().getDisplayName()) + ".")); + return; + } + + String creator = ItemStackFactory.Instance.GetLoreVar(item, "Owner"); + + if (creator != null) + { + if (creator.length() > 2) + creator = creator.substring(2, creator.length()); + + if (!creator.equals(player.getName())) + { + UtilPlayer.message(player, F.main("Repair", "You cannot repair " + F.item(item.getItemMeta().getDisplayName()) + " by " + F.name(creator) + ".")); + return; + } + } + + //Repair! + UtilPlayer.message(player, F.main("Repair", "You repaired " + F.item(item.getItemMeta().getDisplayName()) + ".")); + item.setDurability((short)0); + UtilInv.Update(player); + + //Break + if (Math.random() > 0.85) + event.getClickedBlock().setData((byte) (event.getClickedBlock().getData() + 4)); + + if (event.getClickedBlock().getData() >= 12) + { + player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, 145); + event.getClickedBlock().setTypeIdAndData(0, (byte)0, true); + } + + //Record + int repairs = 1 + ItemStackFactory.Instance.GetLoreVar(item, "Repaired", 0); + + ItemStackFactory.Instance.SetLoreVar(item, "Repaired", "" + repairs); + + //Effect + player.playSound(player.getLocation(), Sound.ANVIL_USE, 1f, 1f); + } + + public DamageManager getDamageManager() + { + return _damageManager; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/BuildingPage.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/BuildingPage.java new file mode 100644 index 000000000..607cbca6e --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/BuildingPage.java @@ -0,0 +1,20 @@ +package mineplex.game.clans.shop; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.page.ShopPageBase; +import mineplex.game.clans.clans.ClansManager; + +public class BuildingPage extends ShopPageBase +{ + public BuildingPage(ClansManager plugin, BuildingShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player) + { + super(plugin, shop, clientManager, donationManager, "Building Supplies", player); + } + + @Override + protected void BuildPage() + { + + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/BuildingShop.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/BuildingShop.java new file mode 100644 index 000000000..8813b6497 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/BuildingShop.java @@ -0,0 +1,22 @@ +package mineplex.game.clans.shop; + +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.shop.ShopBase; +import mineplex.core.shop.page.ShopPageBase; +import mineplex.game.clans.clans.ClansManager; + +public class BuildingShop extends ShopBase +{ + public BuildingShop(ClansManager plugin, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager) + { + super(plugin, clientManager, donationManager, "Building Materials"); + } + + @Override + protected ShopPageBase> BuildPagesFor(Player player) + { + return new BuildingPage(Plugin, this, ClientManager, DonationManager, player); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/queue/ui/QueuePage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/queue/ui/QueuePage.java index f16cdcfe8..ec464962e 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/queue/ui/QueuePage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/queue/ui/QueuePage.java @@ -16,6 +16,7 @@ import mineplex.hub.queue.QueueManager; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.event.inventory.InventoryClickEvent; public class QueuePage extends ShopPageBase { @@ -72,30 +73,18 @@ public class QueuePage extends ShopPageBase IButton okClicked = new IButton() { @Override - public void ClickedLeft(Player player) + public void Clicked(InventoryClickEvent event) { - OkClicked(player); - } - - @Override - public void ClickedRight(Player player) - { - OkClicked(player); + OkClicked((Player)event.getWhoClicked()); } }; IButton cancelClicked = new IButton() { @Override - public void ClickedLeft(Player player) + public void Clicked(InventoryClickEvent event) { - CancelClicked(player); - } - - @Override - public void ClickedRight(Player player) - { - CancelClicked(player); + CancelClicked((Player)event.getWhoClicked()); } }; @@ -114,15 +103,9 @@ public class QueuePage extends ShopPageBase IButton queueButton = new IButton() { @Override - public void ClickedLeft(Player player) + public void Clicked(InventoryClickEvent event) { - queuePlayer("Dominate", player); - } - - @Override - public void ClickedRight(Player player) - { - queuePlayer("Dominate", player); + queuePlayer("Dominate", (Player)event.getWhoClicked()); } }; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBHButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBHButton.java index 4f90b6f58..7a4559a6e 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBHButton.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBHButton.java @@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.hub.server.ui.ServerGameMenu; -public class SelectBHButton implements IButton +public class SelectBHButton extends SingleButton { private ServerGameMenu _menu; @@ -13,15 +13,9 @@ public class SelectBHButton implements IButton { _menu = menu; } - - @Override - public void ClickedLeft(Player player) - { - _menu.OpenBH(player); - } @Override - public void ClickedRight(Player player) + public void Clicked(Player player) { _menu.OpenBH(player); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBRButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBRButton.java index 7c31ed4a7..1c8535d2e 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBRButton.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBRButton.java @@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.hub.server.ui.ServerGameMenu; -public class SelectBRButton implements IButton +public class SelectBRButton extends SingleButton { private ServerGameMenu _menu; @@ -13,15 +13,9 @@ public class SelectBRButton implements IButton { _menu = menu; } - - @Override - public void ClickedLeft(Player player) - { - _menu.OpenBR(player); - } @Override - public void ClickedRight(Player player) + public void Clicked(Player player) { _menu.OpenBR(player); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectCSButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectCSButton.java index 185e42d7e..5615ad0b7 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectCSButton.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectCSButton.java @@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.hub.server.ui.ServerGameMenu; -public class SelectCSButton implements IButton +public class SelectCSButton extends SingleButton { private ServerGameMenu _menu; @@ -15,14 +15,8 @@ public class SelectCSButton implements IButton } @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { _menu.openCS(player); } - - @Override - public void ClickedRight(Player player) - { - ClickedLeft(player); - } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectDMTButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectDMTButton.java index b310df634..a6d850f38 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectDMTButton.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectDMTButton.java @@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.hub.server.ui.ServerGameMenu; -public class SelectDMTButton implements IButton +public class SelectDMTButton extends SingleButton { private ServerGameMenu _menu; @@ -13,16 +13,10 @@ public class SelectDMTButton implements IButton { _menu = menu; } - + @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { _menu.openDMT(player); } - - @Override - public void ClickedRight(Player player) - { - ClickedLeft(player); - } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectDOMButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectDOMButton.java index a6523f3d9..7b652aab4 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectDOMButton.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectDOMButton.java @@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.hub.server.ui.ServerGameMenu; -public class SelectDOMButton implements IButton +public class SelectDOMButton extends SingleButton { private ServerGameMenu _menu; @@ -13,16 +13,10 @@ public class SelectDOMButton implements IButton { _menu = menu; } - + @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { _menu.OpenDOM(player); } - - @Override - public void ClickedRight(Player player) - { - ClickedLeft(player); - } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectMINButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectMINButton.java index 99aad932d..66a192fd2 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectMINButton.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectMINButton.java @@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.hub.server.ui.ServerGameMenu; -public class SelectMINButton implements IButton +public class SelectMINButton extends SingleButton { private ServerGameMenu _menu; @@ -13,16 +13,10 @@ public class SelectMINButton implements IButton { _menu = menu; } - + @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { _menu.OpenMIN(player); } - - @Override - public void ClickedRight(Player player) - { - ClickedLeft(player); - } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectMSButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectMSButton.java index 40c5739e9..074527093 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectMSButton.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectMSButton.java @@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.hub.server.ui.ServerGameMenu; -public class SelectMSButton implements IButton +public class SelectMSButton extends SingleButton { private ServerGameMenu _menu; @@ -13,16 +13,10 @@ public class SelectMSButton implements IButton { _menu = menu; } - + @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { _menu.openMS(player); } - - @Override - public void ClickedRight(Player player) - { - ClickedLeft(player); - } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectSGButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectSGButton.java index ceca7fc55..00abd1be5 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectSGButton.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectSGButton.java @@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.hub.server.ui.ServerGameMenu; -public class SelectSGButton implements IButton +public class SelectSGButton extends SingleButton { private ServerGameMenu _menu; @@ -13,16 +13,10 @@ public class SelectSGButton implements IButton { _menu = menu; } - + @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { _menu.OpenSG(player); } - - @Override - public void ClickedRight(Player player) - { - ClickedLeft(player); - } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectSSMButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectSSMButton.java index b4cd28f25..7243acd9e 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectSSMButton.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectSSMButton.java @@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.hub.server.ui.ServerGameMenu; -public class SelectSSMButton implements IButton +public class SelectSSMButton extends SingleButton { private ServerGameMenu _menu; @@ -13,16 +13,10 @@ public class SelectSSMButton implements IButton { _menu = menu; } - + @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { _menu.OpenSSM(player); } - - @Override - public void ClickedRight(Player player) - { - ClickedLeft(player); - } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectTDMButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectTDMButton.java index c4aca5e28..20c522104 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectTDMButton.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectTDMButton.java @@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.hub.server.ui.ServerGameMenu; -public class SelectTDMButton implements IButton +public class SelectTDMButton extends SingleButton { private ServerGameMenu _menu; @@ -15,14 +15,8 @@ public class SelectTDMButton implements IButton } @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { _menu.OpenTDM(player); } - - @Override - public void ClickedRight(Player player) - { - ClickedLeft(player); - } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/DeleteCustomBuildButton.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/DeleteCustomBuildButton.java index 327a038a1..f4752631e 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/DeleteCustomBuildButton.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/DeleteCustomBuildButton.java @@ -2,11 +2,11 @@ package mineplex.minecraft.game.classcombat.shop.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage; -public class DeleteCustomBuildButton implements IButton +public class DeleteCustomBuildButton extends SingleButton { private CustomBuildPage _page; private CustomBuildToken _customBuild; @@ -18,14 +18,8 @@ public class DeleteCustomBuildButton implements IButton } @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { _page.DeleteCustomBuild(_customBuild); } - - @Override - public void ClickedRight(Player player) - { - ClickedLeft(player); - } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/DeselectItemButton.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/DeselectItemButton.java index 763832364..c348a94ca 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/DeselectItemButton.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/DeselectItemButton.java @@ -2,11 +2,11 @@ package mineplex.minecraft.game.classcombat.shop.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.minecraft.game.classcombat.item.Item; import mineplex.minecraft.game.classcombat.shop.page.SkillPage; -public class DeselectItemButton implements IButton +public class DeselectItemButton extends SingleButton { private SkillPage _page; private Item _item; @@ -18,17 +18,10 @@ public class DeselectItemButton implements IButton _item = item; _index = index; } - - @Override - public void ClickedLeft(Player player) - { - _page.DeselectItem(player, _item, _index); - } - - @Override - public void ClickedRight(Player player) - { + @Override + public void Clicked(Player player) + { _page.DeselectItem(player, _item, _index); } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/EditAndSaveCustomBuildButton.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/EditAndSaveCustomBuildButton.java index cadd5d874..0cad598bc 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/EditAndSaveCustomBuildButton.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/EditAndSaveCustomBuildButton.java @@ -2,11 +2,11 @@ package mineplex.minecraft.game.classcombat.shop.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage; -public class EditAndSaveCustomBuildButton implements IButton +public class EditAndSaveCustomBuildButton extends SingleButton { private CustomBuildPage _page; private CustomBuildToken _customBuild; @@ -18,14 +18,8 @@ public class EditAndSaveCustomBuildButton implements IButton } @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { _page.EditAndSaveCustomBuild(_customBuild); } - - @Override - public void ClickedRight(Player player) - { - ClickedLeft(player); - } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/PurchaseItemButton.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/PurchaseItemButton.java index 68e9b9fa0..c1967364e 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/PurchaseItemButton.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/PurchaseItemButton.java @@ -1,12 +1,12 @@ package mineplex.minecraft.game.classcombat.shop.button; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.minecraft.game.classcombat.item.Item; import mineplex.minecraft.game.classcombat.shop.page.SkillPage; import org.bukkit.entity.Player; -public class PurchaseItemButton implements IButton +public class PurchaseItemButton extends SingleButton { private SkillPage _page; private Item _item; @@ -16,16 +16,10 @@ public class PurchaseItemButton implements IButton _page = page; _item = item; } - + @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { _page.PurchaseItem(player, _item); } - - @Override - public void ClickedRight(Player player) - { - ClickedLeft(player); - } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/PurchaseSkillButton.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/PurchaseSkillButton.java index 75a2ed7bc..117caf5a9 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/PurchaseSkillButton.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/PurchaseSkillButton.java @@ -1,12 +1,12 @@ package mineplex.minecraft.game.classcombat.shop.button; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.minecraft.game.classcombat.Skill.ISkill; import mineplex.minecraft.game.classcombat.shop.page.SkillPage; import org.bukkit.entity.Player; -public class PurchaseSkillButton implements IButton +public class PurchaseSkillButton extends SingleButton { private SkillPage _page; private ISkill _skill; @@ -16,16 +16,10 @@ public class PurchaseSkillButton implements IButton _page = page; _skill = skill; } - + @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { _page.PurchaseSkill(player, _skill); } - - @Override - public void ClickedRight(Player player) - { - ClickedLeft(player); - } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectClassButton.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectClassButton.java index 2a82c64da..fc6cd6e4b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectClassButton.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectClassButton.java @@ -2,11 +2,11 @@ package mineplex.minecraft.game.classcombat.shop.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.minecraft.game.classcombat.Class.IPvpClass; import mineplex.minecraft.game.classcombat.shop.page.ArmorPage; -public class SelectClassButton implements IButton +public class SelectClassButton extends SingleButton { ArmorPage _page; private IPvpClass _pvpClass; @@ -18,13 +18,7 @@ public class SelectClassButton implements IButton } @Override - public void ClickedLeft(Player player) - { - _page.SelectClass(player, _pvpClass); - } - - @Override - public void ClickedRight(Player player) + public void Clicked(Player player) { _page.SelectClass(player, _pvpClass); } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectCustomBuildButton.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectCustomBuildButton.java index 368980ff6..cd6c28c27 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectCustomBuildButton.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectCustomBuildButton.java @@ -2,11 +2,11 @@ package mineplex.minecraft.game.classcombat.shop.button; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.SingleButton; import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage; -public class SelectCustomBuildButton implements IButton +public class SelectCustomBuildButton extends SingleButton { private CustomBuildPage _page; private CustomBuildToken _customBuild; @@ -16,16 +16,10 @@ public class SelectCustomBuildButton implements IButton _page = page; _customBuild = customBuild; } - + @Override - public void ClickedLeft(Player player) + public void Clicked(Player player) { _page.SelectCustomBuild(_customBuild); } - - @Override - public void ClickedRight(Player player) - { - ClickedLeft(player); - } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectItemButton.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectItemButton.java index 79491279c..7ae9a97ff 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectItemButton.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectItemButton.java @@ -3,11 +3,11 @@ package mineplex.minecraft.game.classcombat.shop.button; import org.bukkit.Sound; import org.bukkit.entity.Player; -import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ComplexButton; import mineplex.minecraft.game.classcombat.item.Item; import mineplex.minecraft.game.classcombat.shop.page.SkillPage; -public class SelectItemButton implements IButton +public class SelectItemButton extends ComplexButton { private SkillPage _page; private Item _item; @@ -37,4 +37,16 @@ public class SelectItemButton implements IButton { _page.DeselectItem(player, _item); } + + @Override + public void ClickedShiftLeft(Player player) + { + ClickedLeft(player); + } + + @Override + public void ClickedShiftRight(Player player) + { + ClickedRight(player); + } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectSkillButton.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectSkillButton.java index 0246d7537..ce19eb281 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectSkillButton.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/button/SelectSkillButton.java @@ -3,11 +3,12 @@ package mineplex.minecraft.game.classcombat.shop.button; import org.bukkit.Sound; import org.bukkit.entity.Player; +import mineplex.core.shop.item.ComplexButton; import mineplex.core.shop.item.IButton; import mineplex.minecraft.game.classcombat.Skill.ISkill; import mineplex.minecraft.game.classcombat.shop.page.SkillPage; -public class SelectSkillButton implements IButton +public class SelectSkillButton extends ComplexButton { private SkillPage _page; private ISkill _skill; @@ -39,4 +40,16 @@ public class SelectSkillButton implements IButton { _page.DeselectSkill(player, _skill); } + + @Override + public void ClickedShiftLeft(Player player) + { + ClickedLeft(player); + } + + @Override + public void ClickedShiftRight(Player player) + { + ClickedRight(player); + } }