Make clan create button functional

This commit is contained in:
AlexTheCoder 2016-07-28 21:02:04 -04:00
parent 16804a860c
commit 841a44b8a6

View File

@ -1,15 +1,15 @@
package mineplex.game.clans.clans.gui.button; package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.shop.item.IButton;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import mineplex.core.common.jsonchat.ClickEvent;
import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C;
import mineplex.core.shop.item.IButton;
public class ClanCreateButton implements IButton public class ClanCreateButton implements IButton
{ {
public ClanCreateButton() public ClanCreateButton()
@ -20,6 +20,14 @@ public class ClanCreateButton implements IButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Create)); if (!UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Create)).isCancelled())
{
return;
}
TextComponent message = new TextComponent("Click Here to create a Clan!");
message.setColor(ChatColor.AQUA);
message.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/c create "));
player.spigot().sendMessage(message);
} }
} }