diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddAllyButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddAllyButton.java index 58b7d88c3..0ffc86737 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddAllyButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddAllyButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -13,8 +15,10 @@ public class ClanAddAllyButton implements IButton @Override public void onClick(Player player, ClickType clickType) { - player.closeInventory(); + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.AddAlly)).isCancelled()) + return; + player.closeInventory(); JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to add an Ally").click(ClickEvent.SUGGEST_COMMAND, "/c ally "); message.sendToPlayer(player); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddTrustedButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddTrustedButton.java index 505eb674b..6a8d8a552 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddTrustedButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddTrustedButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -13,6 +15,9 @@ public class ClanAddTrustedButton implements IButton @Override public void onClick(Player player, ClickType clickType) { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.AddTrusted)).isCancelled()) + return; + player.closeInventory(); JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to trust a clan").click(ClickEvent.SUGGEST_COMMAND, "/c trust "); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddWarButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddWarButton.java index 22e4ce7ef..d0faaa721 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddWarButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddWarButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -13,6 +15,8 @@ public class ClanAddWarButton implements IButton @Override public void onClick(Player player, ClickType clickType) { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.AddWar)).isCancelled()) + return; player.closeInventory(); JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to war a clan").click(ClickEvent.SUGGEST_COMMAND, "/war "); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanCreateButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanCreateButton.java index ea75bfc73..39815a0f8 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanCreateButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanCreateButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -18,5 +20,6 @@ public class ClanCreateButton implements IButton @Override public void onClick(Player player, ClickType clickType) { + UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Create)); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanDisbandButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanDisbandButton.java index 5450e21a8..6165d054b 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanDisbandButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanDisbandButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -18,6 +20,8 @@ public class ClanDisbandButton extends ClanButton @Override public void onClick(Player player, ClickType clickType) { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Disband)).isCancelled()) + return; getPlayer().closeInventory(); getClansManager().getClanUtility().delete(getPlayer()); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanEnergyButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanEnergyButton.java index ae2d56236..20038637d 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanEnergyButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanEnergyButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -18,6 +20,6 @@ public class ClanEnergyButton extends ClanButton @Override public void onClick(Player player, ClickType clickType) { - + UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Energy)); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanInviteButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanInviteButton.java index afd3eff2b..f32e20b19 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanInviteButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanInviteButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -23,6 +25,8 @@ public class ClanInviteButton extends ClanButton @Override public void onClick(Player player, ClickType clickType) { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Invite)).isCancelled()) + return; getShop().openPageForPlayer(getPlayer(), new ClanInvitePage(getClansManager(), getShop(), getClansManager().getClientManager(), _donationManager, player)); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanJoinButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanJoinButton.java index f3e451d0a..fb8c78623 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanJoinButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanJoinButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -21,6 +23,8 @@ public class ClanJoinButton implements IButton @Override public void onClick(Player player, ClickType clickType) { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Join)).isCancelled()) + return; player.closeInventory(); _clansManager.getClanUtility().join(player, _clanInfo); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanLeaveButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanLeaveButton.java index 114f3eb79..fbf261c8e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanLeaveButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanLeaveButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -18,7 +20,22 @@ public class ClanLeaveButton extends ClanButton @Override public void onClick(Player player, ClickType clickType) { - getPlayer().closeInventory(); - getClansManager().getClanUtility().leave(getPlayer()); + if(clickType.equals(ClickType.SHIFT_RIGHT)) //disband + { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Disband)).isCancelled()) + return; + + getPlayer().closeInventory(); + getClansManager().getClanUtility().delete(getPlayer()); + + }else if(clickType.equals(ClickType.SHIFT_LEFT)) //leave + { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Leave)).isCancelled()) + return; + + getPlayer().closeInventory(); + getClansManager().getClanUtility().leave(getPlayer()); + } + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanMemeberButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanMemeberButton.java index da1194fe2..0570693d2 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanMemeberButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanMemeberButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -24,6 +26,8 @@ public class ClanMemeberButton extends ClanButton @Override public void onClick(Player player, ClickType clickType) { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Member)).isCancelled()) + return; if (clickType == ClickType.LEFT) { // Promote diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanTerritoryButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanTerritoryButton.java index 27c4ac02e..363c78f01 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanTerritoryButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanTerritoryButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.ChatColor; import org.bukkit.Chunk; import org.bukkit.entity.Player; @@ -23,6 +25,8 @@ public class ClanTerritoryButton extends ClanButton @Override public void onClick(Player player, ClickType clickType) { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Territory)).isCancelled()) + return; // if (_clansManager.getNetherManager().isInNether(player)) // { // _clansManager.message(player, "You are not allowed to do anything with Territory while in " + F.clansNether("The Nether") + "."); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanWhoButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanWhoButton.java index 20385402b..ce482aeed 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanWhoButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanWhoButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -13,6 +15,8 @@ public class ClanWhoButton implements IButton @Override public void onClick(Player player, ClickType clickType) { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Who)).isCancelled()) + return; player.closeInventory(); JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to lookup a clan").click(ClickEvent.SUGGEST_COMMAND, "/c who "); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/events/ClansButtonClickEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/events/ClansButtonClickEvent.java new file mode 100644 index 000000000..72bad2675 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/events/ClansButtonClickEvent.java @@ -0,0 +1,65 @@ +package mineplex.game.clans.clans.gui.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ClansButtonClickEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private ButtonType _type; + + private boolean _cancelled; + + public ClansButtonClickEvent(Player player, ButtonType type) + { + _player = player; + _type = type; + } + + public Player getPlayer() + { + return _player; + } + + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public boolean isCancelled() + { + return _cancelled; + } + + public ButtonType getButtonType() { return _type} + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + + public enum ButtonType + { + AddAlly, + AddTrusted, + AddWar, + Create, + Disband, + Energy, + Invite, + Join, + Leave, + Member, + Territory, + Who; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/ClansMainTutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/ClansMainTutorial.java index cae94dc9c..8b052fd69 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/ClansMainTutorial.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/ClansMainTutorial.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.util.List; import java.util.UUID; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.DyeColor; import org.bukkit.GameMode; import org.bukkit.Location; @@ -378,4 +379,10 @@ public class ClansMainTutorial extends Tutorial { return _mapManager; } + + @EventHandler (priority = EventPriority.LOWEST) + public void onClick(ClansButtonClickEvent event) { + if(isInTutorial(event.getPlayer())) + event.setCancelled(true); + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClaimLandGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClaimLandGoal.java index fed391cb0..09fe9f7d6 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClaimLandGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClaimLandGoal.java @@ -2,6 +2,7 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; import java.util.List; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -15,6 +16,7 @@ import mineplex.game.clans.clans.event.PlayerPreClaimTerritoryEvent; import mineplex.game.clans.tutorial.TutorialRegion; import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective; +import org.bukkit.event.EventPriority; public class ClaimLandGoal extends ObjectiveGoal { @@ -54,4 +56,11 @@ public class ClaimLandGoal extends ObjectiveGoal event.setCancelled(true); } } + + + @EventHandler (priority = EventPriority.HIGHEST) + public void onClick(ClansButtonClickEvent event) { + if(contains(event.getPlayer()) && event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Territory)) + event.setCancelled(false); + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanDetailsGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanDetailsGoal.java index 3b84a1fd3..fed068ddf 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanDetailsGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanDetailsGoal.java @@ -1,5 +1,6 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -8,6 +9,7 @@ import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.event.ClansCommandExecutedEvent; import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective; +import org.bukkit.event.EventPriority; public class ClanDetailsGoal extends ObjectiveGoal { @@ -51,4 +53,11 @@ public class ClanDetailsGoal extends ObjectiveGoal } } } + + + @EventHandler (priority = EventPriority.HIGHEST) + public void onClick(ClansButtonClickEvent event) { + if(contains(event.getPlayer()) && (event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Who))) + event.setCancelled(false); + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanManagementGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanManagementGoal.java index 68deb498c..c97a1f2de 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanManagementGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanManagementGoal.java @@ -5,10 +5,12 @@ import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.event.ClansCommandExecutedEvent; import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import mineplex.game.clans.tutorial.objective.ObjectiveGoal; import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; /** * Created by Adam on 29/03/2016. @@ -42,4 +44,11 @@ public class ClanManagementGoal extends ObjectiveGoal } } } + + + @EventHandler (priority = EventPriority.HIGHEST) + public void onClick(ClansButtonClickEvent event) { + if(contains(event.getPlayer()) && event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Energy)) + event.setCancelled(false); + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/CreateClanGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/CreateClanGoal.java index c05793033..c3a041d8a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/CreateClanGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/CreateClanGoal.java @@ -1,5 +1,6 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -7,6 +8,7 @@ import mineplex.game.clans.tutorial.objective.ObjectiveGoal; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.event.ClanCreationCompleteEvent; import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective; +import org.bukkit.event.EventPriority; public class CreateClanGoal extends ObjectiveGoal { @@ -39,4 +41,11 @@ public class CreateClanGoal extends ObjectiveGoal finish(event.getFounder()); } } + + + @EventHandler (priority = EventPriority.HIGHEST) + public void onClick(ClansButtonClickEvent event) { + if(contains(event.getPlayer()) && event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Create)) + event.setCancelled(false); + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/SetHomeGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/SetHomeGoal.java index 041126606..82095acd9 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/SetHomeGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/SetHomeGoal.java @@ -48,7 +48,7 @@ public class SetHomeGoal extends ObjectiveGoal // we need to save this for later when the player teleports home! getObjective().getPlugin().getTutorialSession(event.getPlayer()).setHomeLocation(event.getPlayer().getLocation()); - + finish(event.getPlayer()); UtilPlayer.message(event.getPlayer(), F.main("Clans", "You have successfully set your Clan's Home to " + UtilWorld.locToStrClean(event.getPlayer().getLocation()) + ".")); @@ -57,7 +57,7 @@ public class SetHomeGoal extends ObjectiveGoal { UtilPlayer.message(event.getPlayer(), F.main("Tutorial", "You must set your home in your own land claim.")); } - + event.setCancelled(true); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/ExplainEnergyGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/ExplainEnergyGoal.java index 2577ffb0f..1c000e52a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/ExplainEnergyGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/ExplainEnergyGoal.java @@ -1,5 +1,6 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.energy; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -9,6 +10,8 @@ import mineplex.core.common.util.UtilTextMiddle; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.tutorial.objective.ObjectiveGoal; import mineplex.game.clans.tutorial.tutorials.clans.objective.EnergyObjective; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; public class ExplainEnergyGoal extends ObjectiveGoal { @@ -40,4 +43,11 @@ public class ExplainEnergyGoal extends ObjectiveGoal protected void customFinish(Player player) { } + + + @EventHandler(priority = EventPriority.HIGHEST) + public void onClick(ClansButtonClickEvent event) { + if(contains(event.getPlayer()) && event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Energy)) + event.setCancelled(false); + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/DisbandClanGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/DisbandClanGoal.java index a69e6139d..fedb379bf 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/DisbandClanGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/DisbandClanGoal.java @@ -1,6 +1,7 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.finalobj; import mineplex.game.clans.clans.event.ClanDisbandedEvent; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -44,4 +45,11 @@ public class DisbandClanGoal extends ObjectiveGoal ClansManager.getInstance().getClanDataAccess().delete(ClansManager.getInstance().getClan(event.getDisbander()), null); finish(event.getDisbander()); } + + + @EventHandler (priority = EventPriority.HIGHEST) + public void onClick(ClansButtonClickEvent event) { + if(contains(event.getPlayer()) && event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Disband)) + event.setCancelled(false); + } }