From fecd3c1eaa266c23c6a92931c4ac7e5d049f34da Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 4 Apr 2016 23:28:38 +1000 Subject: [PATCH] Final changes --- .../game/clans/clans/ClansManager.java | 49 ++++++----- .../clans/clans/regions/ClansRegions.java | 2 +- .../game/clans/gameplay/Gameplay.java | 85 ++++++++++--------- .../game/clans/spawn/travel/TravelPage.java | 16 ++-- .../game/clans/tutorial/TutorialManager.java | 2 + .../clans/tutorial/command/FinishCommand.java | 2 +- .../clans/tutorial/command/StartCommand.java | 2 +- .../tutorial/command/TutorialCommand.java | 2 +- .../tutorials/clans/ClansMainTutorial.java | 17 ++-- .../hub/server/ui/clans/ClansServerPage.java | 14 ++- .../hub/server/ui/clans/ClansServerShop.java | 2 +- .../src/nautilus/game/arcade/GameType.java | 1 - 12 files changed, 109 insertions(+), 85 deletions(-) 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 233b267e2..4eccc43ce 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 @@ -357,27 +357,27 @@ public class ClansManager extends MiniClientPluginimplements IRelati List jumpOffHolograms = Arrays.asList( // West Spawn - new Location(Spawn.getSpawnWorld(), 8, 204, 359), - new Location(Spawn.getSpawnWorld(), 34, 204, 390), - new Location(Spawn.getSpawnWorld(), 8, 204, 418), - new Location(Spawn.getSpawnWorld(), -25, 204, 390), + new Location(Spawn.getSpawnWorld(), 8, 200, 359), + new Location(Spawn.getSpawnWorld(), 34, 200, 390), + new Location(Spawn.getSpawnWorld(), 8, 200, 418), + new Location(Spawn.getSpawnWorld(), -25, 200, 390), // East Spawn - new Location(Spawn.getSpawnWorld(), 34, 207, -393), - new Location(Spawn.getSpawnWorld(), 8, 207, -365), - new Location(Spawn.getSpawnWorld(), -25, 207, -393), - new Location(Spawn.getSpawnWorld(), 8, 207, -424) + new Location(Spawn.getSpawnWorld(), 34, 200, -393), + new Location(Spawn.getSpawnWorld(), 8, 200, -365), + new Location(Spawn.getSpawnWorld(), -25, 200, -393), + new Location(Spawn.getSpawnWorld(), 8, 200, -424) ); List welcomeHolograms = Arrays.asList( - new Location(Spawn.getSpawnWorld(), 17, 204, 390), - new Location(Spawn.getSpawnWorld(), 8, 204, 399), - new Location(Spawn.getSpawnWorld(), 0, 204, 390), - new Location(Spawn.getSpawnWorld(), 8, 204, 381), - new Location(Spawn.getSpawnWorld(), 8, 207, -384), - new Location(Spawn.getSpawnWorld(), 0, 207, -393), - new Location(Spawn.getSpawnWorld(), 8, 207, -402), - new Location(Spawn.getSpawnWorld(), 17, 207, -393) + new Location(Spawn.getSpawnWorld(), 17, 200, 390), + new Location(Spawn.getSpawnWorld(), 8, 200, 399), + new Location(Spawn.getSpawnWorld(), 0, 200, 390), + new Location(Spawn.getSpawnWorld(), 8, 200, 381), + new Location(Spawn.getSpawnWorld(), 8, 200, -384), + new Location(Spawn.getSpawnWorld(), 0, 200, -393), + new Location(Spawn.getSpawnWorld(), 8, 200, -402), + new Location(Spawn.getSpawnWorld(), 17, 200, -393) ); for (Location location : jumpOffHolograms) @@ -824,9 +824,14 @@ public class ClansManager extends MiniClientPluginimplements IRelati } List recipients = new ArrayList<>(); + + String message = event.getMessage();//_chat.getFilteredMessage(event.getPlayer(), event.getMessage()); for (Player other : event.getRecipients()) { + if (_tutorial.inTutorial(other)) + continue; + ClanInfo otherClan = _clanUtility.getClanByPlayer(other); if (otherClan == null) @@ -835,14 +840,12 @@ public class ClansManager extends MiniClientPluginimplements IRelati } else { - String message = _chat.getFilteredMessage(event.getPlayer(), event.getMessage()); ClanRelation rel = _clanUtility.rel(clan, otherClan); - other.sendMessage(rank + rel.getColor(true) + clan.getName() + " " + rel.getColor(false) + event.getPlayer().getName() + " " + C.cWhite + message); } } - recipients.forEach(p -> p.sendMessage(String.format(rank + C.cGold + clan.getName() + " " + C.cYellow + "%s " + C.cWhite + "%s", event.getPlayer().getName(), event.getMessage()))); + recipients.forEach(p -> p.sendMessage(String.format(rank + C.cGold + clan.getName() + " " + C.cYellow + "%s " + C.cWhite + "%s", event.getPlayer().getName(), message))); recipients.clear(); } @@ -1168,12 +1171,14 @@ public class ClansManager extends MiniClientPluginimplements IRelati @EventHandler(priority = EventPriority.HIGHEST) public void onJoin(PlayerLoginEvent event) { - if (true) + Rank rank = _clientManager.Get(event.getPlayer()).GetRank(); + + if (rank.has(Rank.MODERATOR)) { - return; + event.allow(); + event.setResult(PlayerLoginEvent.Result.ALLOWED); } - Rank rank = _clientManager.Get(event.getPlayer()).GetRank(); if (UtilServer.getPlayers().length >= UtilServer.getServer().getMaxPlayers() && !rank.has(Rank.ADMIN) && !event.getPlayer().isWhitelisted() && !event.getPlayer().isOp()) { event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Clans Beta is full! Try again soon"); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/regions/ClansRegions.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/regions/ClansRegions.java index 8ee9a773c..ee09e4677 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/regions/ClansRegions.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/regions/ClansRegions.java @@ -42,7 +42,7 @@ public class ClansRegions extends MiniPlugin public final static int SPAWN_RADIUS = 3; // Radius of spawn claim area (measured in chunks) public final static int SHOP_RADIUS = 5; // Radius of shop claim area (measured in chunks) public final static int FIELDS_RADIUS = 7; // Radius of fields claim area (measured in chunks) - public final static int BORDERLANDS_RADIUS = 50; // Radius of borderlands claim area (measured in chunks) + public final static int BORDERLANDS_RADIUS = 85; // Radius of borderlands claim area (measured in chunks) public static final int BORDER_RADIUS = 1319; private ClansManager _manager; 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 index eee7092d4..392273fa9 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java @@ -54,6 +54,7 @@ import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -582,46 +583,50 @@ public class Gameplay extends MiniPlugin } } -// @EventHandler(priority = EventPriority.LOWEST) -// public void replantTree(BlockBreakEvent event) -// { -// final Block block = event.getBlock(); -// -// if (_clansManager.getClanUtility().getClaim(block.getLocation()) != null) -// { -// return; -// } -// -// if (!UtilItem.isLog(block.getType())) -// { -// return; -// } -// -// if (UtilItem.isLog(block.getRelative(BlockFace.DOWN).getType())) -// { -// return; -// } -// -// if (UtilItem.isLeaf(block.getRelative(BlockFace.DOWN).getType())) -// { -// return; -// } -// -// if (block.getRelative(BlockFace.DOWN).getType() != Material.DIRT && block.getRelative(BlockFace.DOWN).getType() != Material.GRASS) -// { -// return; -// } -// -// final byte data = block.getData(); -// -// UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() { -// public void run() -// { -// block.setType(Material.SAPLING); -// block.setData(data); -// } -// }, 20 * 5); -// } + @EventHandler(priority = EventPriority.LOWEST) + public void replantTree(BlockBreakEvent event) + { + final Block block = event.getBlock(); + + if (_clansManager.getClanUtility().getClaim(block.getLocation()) != null) + { + return; + } + + if (!UtilItem.isLog(block.getType())) + { + return; + } + + if (UtilItem.isLog(block.getRelative(BlockFace.DOWN).getType())) + { + return; + } + + if (UtilItem.isLeaf(block.getRelative(BlockFace.DOWN).getType())) + { + return; + } + + if (block.getRelative(BlockFace.DOWN).getType() != Material.DIRT && block.getRelative(BlockFace.DOWN).getType() != Material.GRASS) + { + return; + } + + final byte data = block.getData(); + + UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() { + public void run() + { + Material mat = block.getRelative(BlockFace.DOWN).getType(); + if (mat == Material.DIRT || mat == Material.GRASS) + { + block.setType(Material.SAPLING); + block.setData(data); + } + } + }, 20 * 10); + } @EventHandler public void killRain(WeatherChangeEvent event) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/travel/TravelPage.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/travel/TravelPage.java index d111c78d8..6140d1ad2 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/travel/TravelPage.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/travel/TravelPage.java @@ -38,7 +38,7 @@ public class TravelPage extends ShopPageBase @Override protected void buildPage() { - addTravelLocation(Spawn.getNorthSpawn(), getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, (getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? C.cRedB : C.cGreenB) + "East Spawn", new String[] { + addTravelLocation(Spawn.getNorthSpawn(), getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, (getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? C.cRedB : C.cGreenB) + "North Spawn", new String[] { C.cWhite + "Spawns are locations where", C.cWhite + "you respawn after dying.", " ", @@ -46,9 +46,9 @@ public class TravelPage extends ShopPageBase C.cWhite + "as they are Safe Zones.", getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? " " : "", getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? C.cRed + "You are already here." : "", - }, 14 + 10, getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? (byte) 3 : (byte) 0); + }, 4, getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? (byte) 3 : (byte) 0); - addTravelLocation(Spawn.getSouthSpawn(), getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, (getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? C.cRedB : C.cGreenB) + "West Spawn", new String[] { + addTravelLocation(Spawn.getSouthSpawn(), getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, (getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? C.cRedB : C.cGreenB) + "South Spawn", new String[] { C.cWhite + "Spawns are locations where", C.cWhite + "you respawn after dying.", " ", @@ -56,23 +56,23 @@ public class TravelPage extends ShopPageBase C.cWhite + "as they are Safe Zones.", getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? " " : "", getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? C.cRed + "You are already here." : "", - }, 12 + 8, getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? (byte) 3 : (byte) 0); + }, 22 + 9 + 9, getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? (byte) 3 : (byte) 0); - addTravelLocation(Spawn.getWestTown(), ClanIcon.CASTLE.getMaterial(), C.cDGreenB + "North Shop", new String[] { + addTravelLocation(Spawn.getWestTown(), ClanIcon.CASTLE.getMaterial(), C.cDGreenB + "West Shop", new String[] { C.cWhite + "Shops are locations where you", C.cWhite + "can buy and sell all sorts of goods.", " ", C.cWhite + "You cannot be attacked here,", C.cWhite + "as they are Safe Zones.", - }, 4, ClanIcon.CASTLE.getData()); + }, 12 + 8, ClanIcon.CASTLE.getData()); - addTravelLocation(Spawn.getEastTown(), ClanIcon.CASTLE.getMaterial(), C.cDGreenB + "South Shop", new String[] { + addTravelLocation(Spawn.getEastTown(), ClanIcon.CASTLE.getMaterial(), C.cDGreenB + "East Shop", new String[] { C.cWhite + "Shops are locations where you", C.cWhite + "can buy and sell all sorts of goods.", " ", C.cWhite + "You cannot be attacked here,", C.cWhite + "as they are Safe Zones.", - }, 22 + 9 + 9, ClanIcon.CASTLE.getData()); + }, 14 + 10, ClanIcon.CASTLE.getData()); final ClanInfo clan = _plugin.getClan(getPlayer()); Outpost outpost = _plugin.getSiegeManager().getOutpostManager().Get(clan); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialManager.java index 3fc5c825b..29609b670 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialManager.java @@ -65,7 +65,9 @@ public class TutorialManager extends MiniPlugin implements ScoreboardElement Player recipient = recipients.next(); if (inTutorial(recipient)) + { recipients.remove(); + } } return Boolean.FALSE; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/FinishCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/FinishCommand.java index be204fd2e..92decfb05 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/FinishCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/FinishCommand.java @@ -10,7 +10,7 @@ public class FinishCommand extends CommandBase { public FinishCommand(TutorialManager plugin) { - super(plugin, Rank.MODERATOR, "finish", "end"); + super(plugin, Rank.DEVELOPER, "finish", "end"); } @Override diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/StartCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/StartCommand.java index 859503bbc..2e100d21b 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/StartCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/StartCommand.java @@ -13,7 +13,7 @@ public class StartCommand extends CommandBase { public StartCommand(TutorialManager plugin) { - super(plugin, Rank.MODERATOR, "start"); + super(plugin, Rank.DEVELOPER, "start"); } @Override diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/TutorialCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/TutorialCommand.java index a2814ddd3..cf38bd009 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/TutorialCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/TutorialCommand.java @@ -13,7 +13,7 @@ public class TutorialCommand extends MultiCommandBase { public TutorialCommand(TutorialManager plugin) { - super(plugin, Rank.MODERATOR, "tutorial", "tut"); + super(plugin, Rank.DEVELOPER, "tutorial", "tut"); AddCommand(new StartCommand(plugin)); AddCommand(new FinishCommand(plugin)); 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 af19d1e42..21352c599 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 @@ -129,16 +129,19 @@ public class ClansMainTutorial extends Tutorial //ClansManager.getInstance().getPvpTimer().unpause(player); - _taskManager.completedTask(new Callback() + if (!_taskManager.hasCompletedTask(player, getTaskIdentifier())) { - @Override - public void run(Boolean data) + _taskManager.completedTask(new Callback() { + @Override + public void run(Boolean data) + { - GoldManager.getInstance().addGold(player, 32000); - UtilPlayer.message(player, F.main("Clans", "You have earned " + F.elem(32000 + " Gold") + " for finishing the tutorial!")); - } - }, player, getTaskIdentifier()); + GoldManager.getInstance().addGold(player, 32000); + UtilPlayer.message(player, F.main("Clans", "You have earned " + F.elem(32000 + " Gold") + " for finishing the tutorial!")); + } + }, player, getTaskIdentifier()); + } /* ClansManager.getInstance().runAsync(() -> { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerPage.java index 137fa6322..e11a7fbec 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerPage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerPage.java @@ -1,6 +1,8 @@ package mineplex.hub.server.ui.clans; import java.util.Collection; +import java.util.Comparator; +import java.util.TreeSet; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -10,6 +12,7 @@ import org.bukkit.event.inventory.ClickType; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilAlg; import mineplex.core.donation.DonationManager; import mineplex.core.shop.item.DisplayButton; import mineplex.core.shop.item.IButton; @@ -32,7 +35,7 @@ public class ClansServerPage extends ShopPageBase servers = getPlugin().getServerList("Clans"); + Collection servers = UtilAlg.sortSet(getPlugin().getServerList("Clans"), new Comparator() + { + @Override + public int compare(ServerInfo o1, ServerInfo o2) + { + return o1.Name.compareTo(o2.Name); + } + }); int currentSlot = 9; for (ServerInfo server : servers) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerShop.java index a3241e2cc..0cb09411c 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerShop.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerShop.java @@ -24,7 +24,7 @@ public class ClansServerShop extends ShopBase public ClansServerShop(ServerManager plugin, CoreClientManager clientManager, DonationManager donationManager) { - super(plugin, clientManager, donationManager, "Clans Alpha"); + super(plugin, clientManager, donationManager, "Clans Beta"); _repository = new ClanRepository(plugin.getPlugin(), plugin.getStatusManager().getCurrentServerName()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index 03e7f96d7..e18567d91 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -243,5 +243,4 @@ public enum GameType { return _display.getKitGameName(); } - } \ No newline at end of file