diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/ClansCommandShop.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/ClansCommandShop.java index c7bec2d37..b336793a6 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/ClansCommandShop.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/ClansCommandShop.java @@ -9,6 +9,7 @@ import mineplex.core.shop.ShopBase; import mineplex.core.shop.page.ShopPageBase; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.gui.page.ClansMainPage; +import mineplex.game.clans.clans.gui.page.ClansPage; public class ClansCommandShop extends ShopBase { @@ -20,6 +21,6 @@ public class ClansCommandShop extends ShopBase @Override protected ShopPageBase> buildPagesFor(Player player) { - return new ClansMainPage(getPlugin(), this, getClientManager(), getDonationManager(), player); + return new ClansPage(getPlugin(), this, getClientManager(), getDonationManager(), player); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanButton.java index 13cdcb2f1..ba87bcaf2 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanButton.java @@ -2,6 +2,7 @@ package mineplex.game.clans.clans.gui.button; import org.bukkit.entity.Player; +import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.shop.item.IButton; import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClanRole; @@ -41,4 +42,20 @@ public abstract class ClanButton implements IButton { return _clanRole; } + + protected void displayText(String header, String message) + { + UtilTextMiddle.display(header, message, _player); + } + + protected void displayClan(String header, String message, boolean displayForClicker) + { + for (Player player : _clanInfo.getOnlinePlayers()) + { + if (displayForClicker || !player.equals(getPlayer())) + UtilTextMiddle.display(header, message, player); + } + + _clansManager.messageClan(_clanInfo, message); + } } 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 new file mode 100644 index 000000000..e03629243 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanEnergyButton.java @@ -0,0 +1,22 @@ +package mineplex.game.clans.clans.gui.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClanRole; +import mineplex.game.clans.clans.ClansManager; + +public class ClanEnergyButton extends ClanButton +{ + public ClanEnergyButton(ClansManager clansManager, Player player, ClanInfo clanInfo, ClanRole clanRole) + { + super(clansManager, player, clanInfo, clanRole); + } + + @Override + public void onClick(Player player, ClickType clickType) + { + + } +} 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 091b88e3a..e2bb47f11 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,8 +1,51 @@ package mineplex.game.clans.clans.gui.button; -/** - * Created by phina on 10/31/2015. - */ -public class ClanTerritoryButton +import org.bukkit.ChatColor; +import org.bukkit.Chunk; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.shop.item.IButton; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClanRole; +import mineplex.game.clans.clans.ClansManager; + +public class ClanTerritoryButton extends ClanButton { + public ClanTerritoryButton(ClansManager clansManager, Player player, ClanInfo clanInfo, ClanRole clanRole) + { + super(clansManager, player, clanInfo, clanRole); + } + + @Override + public void onClick(Player player, ClickType clickType) + { + if (clickType == ClickType.LEFT) + { + player.closeInventory(); + + Chunk chunk = player.getLocation().getChunk(); + String chunkName = UtilWorld.chunkToStrClean(chunk); + displayText(C.cGreen + "Territory", "You claimed the chunk " + chunkName); + displayClan(C.cGreen + "Territory", C.cYellow + getPlayer().getName() + ChatColor.RESET + " claimed the chunk " + chunkName, false); + } + else if (clickType == ClickType.SHIFT_LEFT) + { + player.closeInventory(); + + Chunk chunk = player.getLocation().getChunk(); + String chunkName = UtilWorld.chunkToStrClean(chunk); + displayText(C.cGreen + "Territory", "You unclaimed the chunk " + chunkName); + displayClan(C.cGreen + "Territory", C.cYellow + getPlayer().getName() + ChatColor.RESET + " unclaimed the chunk " + chunkName, false); + } + else if (clickType == ClickType.SHIFT_RIGHT) + { + player.closeInventory(); + + displayText(C.cGreen + "Territory", "You unclaimed all chunks"); + displayClan(C.cGreen + "Territory", C.cYellow + getPlayer().getName() + ChatColor.RESET + " unclaimed all chunks", false); + } + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClansPage.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClansPage.java new file mode 100644 index 000000000..1426a7ddd --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClansPage.java @@ -0,0 +1,136 @@ +package mineplex.game.clans.clans.gui.page; + +import java.util.ArrayList; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ShopItem; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClanRole; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.gui.ClansCommandShop; +import mineplex.game.clans.clans.gui.button.ClanCreateButton; +import mineplex.game.clans.clans.gui.button.ClanEnergyButton; +import mineplex.game.clans.clans.gui.button.ClanInviteButton; +import mineplex.game.clans.clans.gui.button.ClanLeaveButton; +import mineplex.game.clans.clans.gui.button.ClanTerritoryButton; +import mineplex.game.clans.clans.gui.button.ClanWhoButton; + +public class ClansPage extends ClansCommandPageBase +{ + private boolean _useResourceIcons; + + public ClansPage(ClansManager plugin, ClansCommandShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) + { + super(plugin, shop, clientManager, donationManager, "Manage Clan", player, 54); + + _useResourceIcons = false; + } + + @Override + public void buildNoClan() + { + // Clan Create + ShopItem clanCreate = new ShopItem(Material.BOOK_AND_QUILL, "Create Clan", new String[] {}, 1, false, false); + addButton(2, clanCreate, new ClanCreateButton()); + + // Clan Join + ShopItem clanJoin = new ShopItem(Material.BOOK, "Join Clan", new String[] {}, 1, false, false); + addButton(4, clanJoin, new IButton() + { + @Override + public void onClick(Player player, ClickType clickType) + { + getShop().openPageForPlayer(getPlayer(), new ClansJoinPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), getPlayer())); + } + }); + + // Clan Who + ShopItem clanWho = new ShopItem(Material.MAP, "Lookup Clan", new String[] {}, 1, false, false); + addButton(6, clanWho, new ClanWhoButton()); + } + + @Override + public void buildClan(ClanInfo clanInfo, ClanRole clanRole) + { + // Invites + { + String inviteName = "Invites"; + Material inviteMaterial = _useResourceIcons ? Material.MONSTER_EGG : Material.RED_ROSE; + byte inviteDate = _useResourceIcons ? (byte) 0 : 0; + ArrayList inviteLore = new ArrayList(); + inviteLore.add("Text about inviting players"); + inviteLore.add(" "); + inviteLore.add("Click to Invite Player"); + + ShopItem inviteItem = new ShopItem(inviteMaterial, inviteDate, inviteName, inviteLore.toArray(new String[0]), 1, false, false); + ClanInviteButton inviteButton = new ClanInviteButton(getPlayer()); + addButton(0, inviteItem, inviteButton); + } + + // Territory + { + String territoryName = "Territory"; + Material territoryMaterial = _useResourceIcons ? Material.MONSTER_EGG : Material.GRASS; + byte territoryData = _useResourceIcons ? (byte) 0 : 0; + ArrayList territoryLore = new ArrayList(); + territoryLore.add("Territory Information"); + territoryLore.add(" "); + territoryLore.add(ChatColor.RESET + C.cGray + "Left Click " + C.cWhite + "Claim Land"); + territoryLore.add(ChatColor.RESET + C.cGray + "Shift-Left Click " + C.cWhite + "Unclaim Land"); + territoryLore.add(ChatColor.RESET + C.cGray + "Shift-Right Click " + C.cWhite + "Unclaim All Land"); + + ShopItem territoryItem = new ShopItem(territoryMaterial, territoryData, territoryName, territoryLore.toArray(new String[0]), 1, false, false); + ClanTerritoryButton territoryButton = new ClanTerritoryButton(getPlugin(), getPlayer(), clanInfo, clanRole); + addButton(2, territoryItem, territoryButton); + } + + // Energy + { + String energyName = "Energy"; + Material energyMaterial = _useResourceIcons ? Material.MONSTER_EGG : Material.GOLD_BLOCK; + byte energyData = _useResourceIcons ? (byte) 0 : 0; + ArrayList energyLore = new ArrayList(); + + ShopItem energyItem = new ShopItem(energyMaterial, energyData, energyName, energyLore.toArray(new String[0]), 1, false, false); + ClanEnergyButton energyButton = new ClanEnergyButton(getPlugin(), getPlayer(), clanInfo, clanRole); + addButton(4, energyItem, energyButton); + } + + // Leave + { + String leaveName = "Leave"; + Material leaveMaterial = _useResourceIcons ? Material.MONSTER_EGG : Material.TNT; + byte leaveData = _useResourceIcons ? (byte) 0 : 0; + ArrayList leaveLore = new ArrayList(); + + ShopItem leaveItem = new ShopItem(leaveMaterial, leaveData, leaveName, leaveLore.toArray(new String[0]), 1, false, false); + ClanLeaveButton leaveButton = new ClanLeaveButton(getPlugin(), getPlayer(), clanInfo, clanRole); + addButton(6, leaveItem, leaveButton); + } + + // Commands + { + String commandsName = "Commands"; + Material commandsMaterial = _useResourceIcons ? Material.MONSTER_EGG : Material.PAPER; + byte commandsData = _useResourceIcons ? (byte) 0 : 0; + ArrayList commandsLore = new ArrayList(); + + ShopItem commandsItem = new ShopItem(commandsMaterial, commandsData, commandsName, commandsLore.toArray(new String[0]), 1, false, false); + setItem(8, commandsItem); + } + + // Players + + // Allies + + // Wars + } +}