From 584a02ae3e5b80414e6be18a72de5440e829100d Mon Sep 17 00:00:00 2001 From: NewGarbo Date: Thu, 3 Dec 2015 10:30:06 +0000 Subject: [PATCH 01/54] fixed infinite claims --- .../mineplex/core/common/util/UtilText.java | 25 +++++++++++++ .../game/clans/clans/ClansUtility.java | 20 +++++----- .../game/clans/tutorials/Tutorial.java | 1 + .../game/clans/tutorials/TutorialClient.java | 2 + .../game/clans/tutorials/TutorialTask.java | 37 +++++++++++++++++++ .../tutorials/gettingstarted/TaskClaim.java | 2 +- .../gettingstarted/TaskEquipClass.java | 6 +++ .../gettingstarted/TaskMakingMoney.java | 4 +- 8 files changed, 84 insertions(+), 13 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java index 8bbac15bc..771b1ec52 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java @@ -110,4 +110,29 @@ public class UtilText { return s.length() <= maxLength ? s : s.substring(0, maxLength); } + public static String arrayToString(X[] array, String delimiter) + { + StringBuilder string = new StringBuilder(); + + int index = 0; + for (X x : array) + { + string.append(x.toString()); + + if (index != array.length - 1) + { + string.append(delimiter); + } + + index++; + } + + return string.toString(); + } + + public static String arrayToString(X[] array) + { + return arrayToString(array, null); + } + } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java index c30741532..dd2378752 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java @@ -717,11 +717,11 @@ public class ClansUtility return false; } -// if (clan.getEnergy() == 0) -// { -// Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must purchase energy at a shop before you can claim land.")); -// return false; -// } + if (clan.getEnergy() == 0) + { + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must purchase energy at a shop before you can claim land.")); + return false; + } String chunk = UtilWorld.chunkToStr(caller.getLocation().getChunk()); ClanInfo ownerClan = getOwner(caller.getLocation()); @@ -740,11 +740,11 @@ public class ClansUtility } } -// if (clan.getClaims() >= clan.getClaimsMax()) -// { -// Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan cannot claim more Territory.")); -// return false; -// } + if (clan.getClaims() >= clan.getClaimsMax()) + { + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan cannot claim more Territory.")); + return false; + } // Adjacent boolean selfAdj = false; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java index 166dbc6e8..08870a246 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java @@ -197,6 +197,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener public void run() { get(player).CurrentTask.startFor(player); + get(player).CurrentTaskStartTime = System.currentTimeMillis(); } }, 30L); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialClient.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialClient.java index 043647117..383a09700 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialClient.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialClient.java @@ -11,12 +11,14 @@ public class TutorialClient public long LastDescriptionSentTime = System.currentTimeMillis() - 3000; public boolean InClanOnStart; public boolean QueuedFinish; + public long CurrentTaskStartTime; public TutorialClient(Player player, Tutorial tutorial) { Player = player; CurrentTask = tutorial._tasks.get(1); + CurrentTaskStartTime = System.currentTimeMillis(); InClanOnStart = tutorial._clansManager.isInClan(player); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialTask.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialTask.java index 0934fff08..cc6addbda 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialTask.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialTask.java @@ -1,13 +1,20 @@ package mineplex.game.clans.tutorials; +import java.util.Iterator; + +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import mineplex.core.common.util.C; import mineplex.core.common.util.NautArrayList; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClansManager; public class TutorialTask implements Listener @@ -22,6 +29,8 @@ public class TutorialTask implements Listener protected String _description; protected String _finishMessage; + protected String[] _subtasks; + protected Location _taskPos; // How much time after the beginning the task/last teleport it should take to teleport back to _taskPos. @@ -92,6 +101,34 @@ public class TutorialTask implements Listener } } + @EventHandler + public void displaySubtasks(UpdateEvent event) + { + if (!event.getType().equals(UpdateType.SEC)) + { + return; + } + + if (_subtasks == null || _subtasks.length == 0) + { + return; + } + + Iterator iterator = _inTask.iterator(); + while (iterator.hasNext()) + { + Player player = Bukkit.getPlayer(iterator.next()); + + if ((System.currentTimeMillis() - _tutorial.get(player).CurrentTaskStartTime) >= 15000) + { + if (isDoing(player)) + { + UtilTextMiddle.display("", UtilText.arrayToString(_subtasks, "\n"), 1, 25, 25); + } + } + } + } + public boolean isDoing(Player player) { return _inTask != null && player != null && _inTask.contains(player.getName()); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskClaim.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskClaim.java index a3c936754..23edfed24 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskClaim.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskClaim.java @@ -21,7 +21,7 @@ public class TaskClaim extends TutorialTask + "Once claimed, only your Clan can break/place blocks here. " + "This is the perfect place to build a base and stash your items! " + "You can only claim in the Wilderness, and not next to other Clan's Territory. " - + "To claim some territory, go into the Clans GUI by typing {/c} and {Left-Clicking}"; + + "To claim some territory, go into the Clans GUI by typing {/c} and {Left-Clicking} the Territory button. (Looks like a flag)"; } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskEquipClass.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskEquipClass.java index 01584fd32..0dee17131 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskEquipClass.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskEquipClass.java @@ -29,6 +29,12 @@ public class TaskEquipClass extends TutorialTask + "Purchase Iron Armor from the PvP Shop. " + "Then put on your armor to equip the Knight Class."; + _subtasks = new String[] { + "Open the PvP Shop", + "Buy Iron Armor Set", + "Equip Iron Armor" + }; + _taskPos = new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskMakingMoney.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskMakingMoney.java index 3aefb2ab7..e7a8fff57 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskMakingMoney.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskMakingMoney.java @@ -34,7 +34,7 @@ public class TaskMakingMoney extends TutorialTask @Override public void customStartFor(Player player) { - player.getInventory().addItem(new ItemStack(Material.CARROT, 1)); + player.getInventory().addItem(new ItemStack(Material.CARROT_ITEM, 1)); } @EventHandler @@ -45,7 +45,7 @@ public class TaskMakingMoney extends TutorialTask return; } - if (!event.getItem().getType().equals(Material.CARROT)) + if (!event.getItem().getType().equals(Material.CARROT_ITEM)) { return; } From 39daf969fd213d93fe8d32575c962f99bd5c42cf Mon Sep 17 00:00:00 2001 From: NewGarbo Date: Thu, 3 Dec 2015 22:29:36 +0000 Subject: [PATCH 02/54] clan claim visualizer --- .../clans/clans/ClansDataAccessLayer.java | 22 +- .../game/clans/clans/ClansManager.java | 7 +- .../game/clans/clans/ClansUtility.java | 2 +- .../clans/claimview/ClaimVisualizer.java | 328 ++++++++++++++++++ .../clans/claimview/VisualizedChunkData.java | 48 +++ .../commands/ClaimVisualizeCommand.java | 22 ++ .../clans/commands/ClanManagementCommand.java | 1 - .../clans/commands/RestartTutCommand.java | 3 +- .../clans/clans/event/ClanLeaveEvent.java | 56 +++ .../event/PlayerUnClaimTerritoryEvent.java | 11 +- .../game/clans/tutorials/TutorialTask.java | 3 +- .../gettingstarted/TaskMakingMoney.java | 5 - 12 files changed, 495 insertions(+), 13 deletions(-) create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/ClaimVisualizer.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/VisualizedChunkData.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/commands/ClaimVisualizeCommand.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClanLeaveEvent.java 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 7cfea3b08..eea8309b6 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 @@ -17,13 +17,15 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilWorld; import mineplex.game.clans.clans.event.ClanCreatedEvent; import mineplex.game.clans.clans.event.ClanDeleteEvent; +import mineplex.game.clans.clans.event.ClanJoinEvent; +import mineplex.game.clans.clans.event.ClanLeaveEvent; import mineplex.game.clans.clans.event.ClanSetHomeEvent; import mineplex.game.clans.clans.scoreboard.ClansScoreboardManager; import mineplex.game.clans.clans.tntGenerator.TntGenerator; -import mineplex.game.clans.core.war.ClanWarData; import mineplex.game.clans.core.repository.ClanRepository; import mineplex.game.clans.core.repository.ClanTerritory; import mineplex.game.clans.core.repository.tokens.ClanToken; +import mineplex.game.clans.core.war.ClanWarData; public class ClansDataAccessLayer { @@ -201,6 +203,15 @@ public class ClansDataAccessLayer public void join(final ClanInfo clan, final Player player, final ClanRole role, final Callback callback) { + ClanJoinEvent event = new ClanJoinEvent(clan, player); + + UtilServer.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + runAsync(new Runnable() { @Override @@ -259,6 +270,15 @@ public class ClansDataAccessLayer { if (clan == null) return; + ClanLeaveEvent event = new ClanLeaveEvent(clan, clansPlayer); + + UtilServer.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + runAsync(new Runnable() { @Override 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 aa8efa0bb..8b09f8db2 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 @@ -66,6 +66,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClanTips.TipType; import mineplex.game.clans.clans.ClansUtility.ClanRelation; +import mineplex.game.clans.clans.claimview.ClaimVisualizer; import mineplex.game.clans.clans.commands.ClanManagementCommand; import mineplex.game.clans.clans.commands.ClansAllyChatCommand; import mineplex.game.clans.clans.commands.ClansChatCommand; @@ -304,6 +305,8 @@ public class ClansManager extends MiniClientPluginimplements IRelati loadClan(token); } + new ClaimVisualizer(plugin, this); + // RedisDataRepository(ConnectionData writeConn, ConnectionData // readConn, Region region, Class elementType, String elementLabel) // Initialize default region factions and territory @@ -672,7 +675,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati if (clan == null) { event.setFormat(rank + C.cYellow + "%1$s " + C.cWhite + "%2$s"); - System.out.println(_clientManager.Get(event.getPlayer()).GetRank().name() + " " + event.getPlayer().getName() + " " + (event.getPlayer().getGameMode().equals(GameMode.CREATIVE) ? C.cRed + "Creative " : " ") + event.getMessage()); + System.out.println(_clientManager.Get(event.getPlayer()).GetRank().name() + " " + event.getPlayer().getName() + " " + event.getMessage()); return; } @@ -692,7 +695,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati String message = event.getMessage(); message = _chat.getFilteredMessage(event.getPlayer(), message); ClanRelation rel = _clanUtility.rel(clan, otherClan); - String formatted = rank + rel.getColor(true) + clan.getName() + " " + rel.getColor(false) + event.getPlayer().getName() + " " + (event.getPlayer().getGameMode().equals(GameMode.CREATIVE) ? C.cRed + "Creative " : " ") + C.cWhite + message; + String formatted = rank + rel.getColor(true) + clan.getName() + " " + rel.getColor(false) + event.getPlayer().getName() + " " + C.cWhite + message; other.sendMessage(formatted); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java index dd2378752..c27bcf57a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java @@ -1084,7 +1084,7 @@ public class ClansUtility } // Event - PlayerUnClaimTerritoryEvent event = new PlayerUnClaimTerritoryEvent(caller, caller.getLocation().getChunk()); + PlayerUnClaimTerritoryEvent event = new PlayerUnClaimTerritoryEvent(caller, caller.getLocation().getChunk(), ownerClan); UtilServer.getServer().getPluginManager().callEvent(event); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/ClaimVisualizer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/ClaimVisualizer.java new file mode 100644 index 000000000..d0bb23eaa --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/ClaimVisualizer.java @@ -0,0 +1,328 @@ +package mineplex.game.clans.clans.claimview; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.Chunk; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.claimview.commands.ClaimVisualizeCommand; +import mineplex.game.clans.clans.event.ClanDisbandedEvent; +import mineplex.game.clans.clans.event.ClanLeaveEvent; +import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent; +import mineplex.game.clans.clans.event.PlayerUnClaimTerritoryEvent; +import net.minecraft.server.v1_8_R3.EnumDirection; + +public class ClaimVisualizer extends MiniPlugin +{ + private ClansManager _clansManager; + + private List _visualizing; + + private NautHashMap> _calculated; + + public ClaimVisualizer(JavaPlugin plugin, ClansManager clansManager) + { + super("Claim Visualizer", plugin); + + _clansManager = clansManager; + _visualizing = new ArrayList<>(); + _calculated = new NautHashMap<>(); + + for (ClanInfo clan : _clansManager.getClanMap().values()) + { + _calculated.put(clan, new NautHashMap()); + } + } + + @Override + public void addCommands() + { + addCommand(new ClaimVisualizeCommand(this)); + } + + + @EventHandler + public void cleanup(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOWER) + { + return; + } + } + + @EventHandler + public void runVisualization(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + for (String name : _visualizing) + { + Player player = Bukkit.getPlayer(name); + + if (player != null && _clansManager.isInClan(player)) + { + visualize(player); + } + } + } + + private void visualize(Player player) + { + for (String serialized : _clansManager.getClan(player).getClaimSet()) + { + if (!_calculated.get(_clansManager.getClan(player)).containsKey(serialized)) + { + calculate(_clansManager.getClan(player), serialized); + } + } + + draw(player, _calculated.get(_clansManager.getClan(player)).values()); + } + + private void draw(Player player, Collection chunks) + { + for (VisualizedChunkData chunk : chunks) + { + if (!chunk.getChunk().getWorld().equals(player.getWorld())) + { + // return not break because a clan can't have claims in different worlds. + return; + } + + if (UtilMath.offset2d(chunk.getChunk().getBlock(0, 0, 0).getLocation(), player.getLocation()) > 36) + { + break; + } + + for (int x = 0; x < 16; x++) + { + for (int z = 0; z < 16; z++) + { + if (z == 0 || z == 15 || x == 0 || x == 15) + { + if (!chunk.shouldDisplay(x, z)) + { + continue; + } + + Block block = chunk.getChunk().getBlock(x, 0, z); + + UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, + new Location( + chunk.getChunk().getWorld(), + block.getX() + .5, + Math.max(UtilBlock.getHighest(player.getWorld(), block.getX(), block.getZ()).getY(), player.getLocation().getY()) + .5, + block.getZ() + .5), + new Vector(0f, 0f, 0f), 0f, 1, ViewDist.NORMAL, player); + } + } + } + } + } + + private void calculate(ClanInfo clan, String serialized) + { + Chunk chunk = UtilWorld.strToChunk(serialized); + + List dirs = new ArrayList<>(); + + if (!clan.getClaimSet().contains(UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX(), chunk.getZ() - 1)))) + { + dirs.add(EnumDirection.NORTH); + } + + if (!clan.getClaimSet().contains(UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX() + 1, chunk.getZ())))) + { + dirs.add(EnumDirection.EAST); + } + + if (!clan.getClaimSet().contains(UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX(), chunk.getZ() + 1)))) + { + dirs.add(EnumDirection.SOUTH); + } + + if (!clan.getClaimSet().contains(UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX() - 1, chunk.getZ())))) + { + dirs.add(EnumDirection.WEST); + } + + VisualizedChunkData cached = new VisualizedChunkData(chunk, dirs); + + _calculated.get(clan).put(serialized, cached); + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + if (isVisualizing(event.getPlayer())) + { + disableVisualizer(event.getPlayer()); + } + } + + @EventHandler + public void onKick(PlayerKickEvent event) + { + if (isVisualizing(event.getPlayer())) + { + disableVisualizer(event.getPlayer()); + } + } + + @EventHandler + public void onLeave(ClanLeaveEvent event) + { + if (isVisualizing(event.getPlayer().getPlayerName())) + { + disableVisualizer(event.getPlayer().getPlayerName()); + } + } + + @EventHandler + public void onClanDisband(ClanDisbandedEvent event) + { + for (Player player : event.getClan().getOnlinePlayers()) + { + if (isVisualizing(player)) + { + disableVisualizer(player); + } + } + } + + @EventHandler + public void onUnclaim(PlayerUnClaimTerritoryEvent event) + { + _calculated.clear(); + + for (String serialized : event.getClan().getClaimSet()) + { + calculate(event.getClan(), serialized); + } + + if (event.getClan().getClaimCount() == 1) + { + for (Player player : event.getClan().getOnlinePlayers()) + { + if (isVisualizing(player)) + { + disableVisualizer(player); + } + } + } + } + + @EventHandler + public void onClaim(PlayerClaimTerritoryEvent event) + { + _calculated.clear(); + + for (String serialized : event.getClan().getClaimSet()) + { + calculate(event.getClan(), serialized); + } + } + + public boolean isVisualizing(Player player) + { + return _visualizing.contains(player.getName()); + } + + public boolean isVisualizing(String name) + { + return _visualizing.contains(name); + } + + public void enableVisualizer(String name) + { + enableVisualizer(UtilServer.getServer().getPlayer(name)); + } + + public void disableVisualizer(String name) + { + disableVisualizer(UtilServer.getServer().getPlayer(name)); + } + + public void toggleVisualizer(Player player) + { + if (_visualizing.contains(player.getName())) + { + disableVisualizer(player); + } + else + { + enableVisualizer(player); + } + } + + public void enableVisualizer(Player player) + { + if (player == null) + { + return; + } + + if (!_clansManager.isInClan(player)) + { + UtilPlayer.message(player, F.main("Clans", "You must be in a clan to visualize claims.")); + return; + } + + ClanInfo clan = _clansManager.getClan(player); + + if (clan.getClaimCount() == 0) + { + UtilPlayer.message(player, F.main("Clans", "Your Clan does not have any claims!")); + return; + } + + _visualizing.add(player.getName()); + UtilPlayer.message(player, F.main("Clans", "You are now visualizing your claims.")); + } + + public void disableVisualizer(Player player) + { + if (player == null) + { + return; + } + + if (!_visualizing.contains(player.getName())) + { + UtilPlayer.message(player, F.main("Clans", "You are anot visualizing your claims.")); + return; + } + + _visualizing.remove(player.getName()); + UtilPlayer.message(player, F.main("Clans", "You are no longer visualizing your claims.")); + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/VisualizedChunkData.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/VisualizedChunkData.java new file mode 100644 index 000000000..12bdb8962 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/VisualizedChunkData.java @@ -0,0 +1,48 @@ +package mineplex.game.clans.clans.claimview; + +import java.util.List; + +import org.bukkit.Chunk; + +import net.minecraft.server.v1_8_R3.EnumDirection; + +public class VisualizedChunkData +{ + private List _displayable; + private Chunk _chunk; + + public VisualizedChunkData(Chunk chunk, List dir) + { + _chunk = chunk; + _displayable = dir; + } + + public boolean shouldDisplay(int x, int z) + { + if (z == 15 && !_displayable.contains(EnumDirection.SOUTH)) + { + return false; + } + + if (x == 15 && !_displayable.contains(EnumDirection.EAST)) + { + return false; + } + + if (x == 0 && !_displayable.contains(EnumDirection.WEST)) + { + return false; + } + + if (z == 0 && !_displayable.contains(EnumDirection.NORTH)) + { + return false; + } + + return true; + } + + public Chunk getChunk() { + return _chunk; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/commands/ClaimVisualizeCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/commands/ClaimVisualizeCommand.java new file mode 100644 index 000000000..dcfa074c9 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/commands/ClaimVisualizeCommand.java @@ -0,0 +1,22 @@ +package mineplex.game.clans.clans.claimview.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.game.clans.clans.claimview.ClaimVisualizer; + +public class ClaimVisualizeCommand extends CommandBase +{ + public ClaimVisualizeCommand(ClaimVisualizer plugin) + { + super(plugin, Rank.ALL, "showclaims"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.toggleVisualizer(caller); + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClanManagementCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClanManagementCommand.java index 546c63774..cda7ab480 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClanManagementCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClanManagementCommand.java @@ -38,7 +38,6 @@ import mineplex.game.clans.items.legendaries.WindBlade; public class ClanManagementCommand extends CommandBase { - private ClansManager _clansManager; public ClanManagementCommand(ClansManager plugin) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java index be19befc8..7874915cb 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java @@ -6,6 +6,7 @@ import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; +import mineplex.core.common.util.F; import mineplex.core.task.TaskManager; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.tutorials.Tutorial; @@ -43,7 +44,7 @@ public class RestartTutCommand extends CommandBase } else { - TutorialManager.Instance.sendTutorialMsg(caller, "You must be in a safezone to restart the tutorial."); + TutorialManager.Instance.sendTutorialMsg(caller, F.main("Clans", "You must be in a safezone to restart the tutorial.")); } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClanLeaveEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClanLeaveEvent.java new file mode 100644 index 000000000..3c5f6156d --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClanLeaveEvent.java @@ -0,0 +1,56 @@ +package mineplex.game.clans.clans.event; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClansPlayer; + +public class ClanLeaveEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private ClansPlayer _player; + + private ClanInfo _clan; + + private boolean _cancelled; + + public ClanLeaveEvent(ClanInfo clan, ClansPlayer clansPlayer) + { + _player = clansPlayer; + + _clan = clan; + } + + public ClansPlayer getPlayer() + { + return _player; + } + + public ClanInfo getClan() + { + return _clan; + } + + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public boolean isCancelled() + { + return _cancelled; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/PlayerUnClaimTerritoryEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/PlayerUnClaimTerritoryEvent.java index 41ef2e8b1..8d83363d6 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/PlayerUnClaimTerritoryEvent.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/PlayerUnClaimTerritoryEvent.java @@ -5,19 +5,23 @@ import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +import mineplex.game.clans.clans.ClanInfo; + public class PlayerUnClaimTerritoryEvent extends Event { private static final HandlerList handlers = new HandlerList(); private Player _unClaimer; private Chunk _unClaimedChunk; + private ClanInfo _clan; private boolean _cancelled; - public PlayerUnClaimTerritoryEvent(Player unClaimer, Chunk unClaimedChunk) + public PlayerUnClaimTerritoryEvent(Player unClaimer, Chunk unClaimedChunk, ClanInfo clan) { _unClaimer = unClaimer; _unClaimedChunk = unClaimedChunk; + _clan = clan; } public Player getUnClaimer() @@ -35,6 +39,11 @@ public class PlayerUnClaimTerritoryEvent extends Event _cancelled = cancelled; } + public ClanInfo getClan() + { + return _clan; + } + public boolean isCancelled() { return _cancelled; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialTask.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialTask.java index cc6addbda..7714a0104 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialTask.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialTask.java @@ -101,7 +101,8 @@ public class TutorialTask implements Listener } } - @EventHandler + //@EventHandler + //todo: fix the multiline subtitles public void displaySubtasks(UpdateEvent event) { if (!event.getType().equals(UpdateType.SEC)) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskMakingMoney.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskMakingMoney.java index e7a8fff57..db12bda02 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskMakingMoney.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskMakingMoney.java @@ -61,11 +61,6 @@ public class TaskMakingMoney extends TutorialTask return; } - if (!ClansManager.getInstance().isInClan(event.getPlayer())) - { - return; - } - if (!event.getItem().getType().equals(Material.CARROT_ITEM)) { return; From 5c575b41fc8a665592b8ce46bed5205286c2978e Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 4 Dec 2015 05:15:28 -0500 Subject: [PATCH 03/54] Clans alpha 0.17 --- .../core/portal/Commands/ServerCommand.java | 13 --- .../core/scoreboard/PlayerScoreboard.java | 4 + .../src/mineplex/game/clans/Clans.java | 2 +- .../game/clans/clans/ClansManager.java | 4 +- .../clans/clans/commands/ClansCommand.java | 6 + .../clans/commands/RestartTutCommand.java | 10 +- .../scoreboard/ClansScoreboardManager.java | 12 +- .../elements/ScoreboardElementClan.java | 3 +- .../elements/ScoreboardElementPlayer.java | 3 +- .../ScoreboardElementPlayerCount.java | 2 +- .../game/clans/clans/war/WarManager.java | 31 ++++-- .../game/clans/tutorials/Tutorial.java | 105 +++++++++++++----- .../game/clans/tutorials/TutorialClient.java | 6 +- .../game/clans/tutorials/TutorialManager.java | 15 ++- .../game/clans/tutorials/TutorialTask.java | 41 ++++--- .../gettingstarted/TaskCustomizeClass.java | 7 ++ .../gettingstarted/TaskDisbandClan.java | 14 +-- .../gettingstarted/TaskEquipClass.java | 5 + .../gettingstarted/TaskExploreShops.java | 10 +- .../gettingstarted/TaskLeaveSpawn.java | 12 +- .../gettingstarted/TaskMakingMoney.java | 2 + .../gettingstarted/TaskUseAbility.java | 29 ++++- .../gettingstarted/TaskViewClanDetails.java | 2 +- .../TutorialGettingStarted.java | 14 ++- 24 files changed, 244 insertions(+), 108 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java index b4ac74e62..ef2a4da64 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java @@ -84,19 +84,6 @@ public class ServerCommand extends CommandBase else deniedAccess = true; } - else if (servUp.contains("CLANS-")) - { - if (playerRank.has(Rank.MODERATOR)) - { - Plugin.sendPlayerToServer(player, args[0]); - } - else - { - UtilPlayer.message(player, - F.main(Plugin.getName(), C.cRed + "You must join clans through the hub! Join " + C.cGold + "ClansHub-1" - + C.cRed + "!")); - } - } else { Plugin.sendPlayerToServer(player, args[0]); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/PlayerScoreboard.java b/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/PlayerScoreboard.java index ef8e05796..33fd0a308 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/PlayerScoreboard.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/PlayerScoreboard.java @@ -106,6 +106,10 @@ public class PlayerScoreboard continue; } + // Ignore extra lines + if (i >= _teamNames.length) + continue; + //Update Team team = _scoreboard.getTeam(_teamNames[i]); if (team == null) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java index 0e35252e8..214707cd7 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java @@ -49,7 +49,7 @@ import net.minecraft.server.v1_8_R3.MinecraftServer; public class Clans extends JavaPlugin { - public static final String VERSION = "0.16"; + public static final String VERSION = "0.17"; private String WEB_CONFIG = "webServer"; // Modules 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 aa8efa0bb..7827abaea 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 @@ -672,7 +672,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati if (clan == null) { event.setFormat(rank + C.cYellow + "%1$s " + C.cWhite + "%2$s"); - System.out.println(_clientManager.Get(event.getPlayer()).GetRank().name() + " " + event.getPlayer().getName() + " " + (event.getPlayer().getGameMode().equals(GameMode.CREATIVE) ? C.cRed + "Creative " : " ") + event.getMessage()); + System.out.println(_clientManager.Get(event.getPlayer()).GetRank().name() + " " + event.getPlayer().getName() + " " + (event.getPlayer().getGameMode().equals(GameMode.CREATIVE) ? C.cRed + "Creative " : "") + event.getMessage()); return; } @@ -692,7 +692,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati String message = event.getMessage(); message = _chat.getFilteredMessage(event.getPlayer(), message); ClanRelation rel = _clanUtility.rel(clan, otherClan); - String formatted = rank + rel.getColor(true) + clan.getName() + " " + rel.getColor(false) + event.getPlayer().getName() + " " + (event.getPlayer().getGameMode().equals(GameMode.CREATIVE) ? C.cRed + "Creative " : " ") + C.cWhite + message; + String formatted = rank + rel.getColor(true) + clan.getName() + " " + rel.getColor(false) + event.getPlayer().getName() + " " + (event.getPlayer().getGameMode().equals(GameMode.CREATIVE) ? C.cRed + "Creative " : "") + C.cWhite + message; other.sendMessage(formatted); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java index b956eedfe..f9bab36a5 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java @@ -1,5 +1,6 @@ package mineplex.game.clans.clans.commands; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.BlockFace; @@ -24,6 +25,7 @@ import mineplex.game.clans.clans.ClanTips.TipType; import mineplex.game.clans.clans.ClansBlacklist; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClientClan; +import mineplex.game.clans.clans.event.ClanJoinEvent; import mineplex.game.clans.clans.event.ClansCommandExecutedEvent; import mineplex.game.clans.tutorials.Tutorial; import mineplex.game.clans.tutorials.TutorialManager; @@ -382,6 +384,10 @@ public class ClansCommand extends CommandBase _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "The clan " + F.elem("Clan " + clan.getName()) + " is full and cannot be joined!")); return; } + + ClanJoinEvent event = new ClanJoinEvent(clan, caller); + Bukkit.getPluginManager().callEvent(event); + if (event.isCancelled()) return; // Task Plugin.getClanDataAccess().join(clan, caller, ClanRole.RECRUIT, new Callback() diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java index be19befc8..d0983745c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java @@ -6,6 +6,8 @@ import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.task.TaskManager; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.tutorials.Tutorial; @@ -22,6 +24,12 @@ public class RestartTutCommand extends CommandBase @Override public void Execute(Player caller, String[] args) { + if (ClansManager.getInstance().getClan(caller) != null) + { + UtilPlayer.message(caller, F.main("Tutorial", "You cannot restart the tutorial while in a clan")); + return; + } + if (ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()) != null && ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()).isSafe(caller.getLocation())) { @@ -43,7 +51,7 @@ public class RestartTutCommand extends CommandBase } else { - TutorialManager.Instance.sendTutorialMsg(caller, "You must be in a safezone to restart the tutorial."); + TutorialManager.Instance.sendTutorialMsg(caller, "You must be in a Safe Zone to restart the tutorial."); } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/ClansScoreboardManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/ClansScoreboardManager.java index dcefd85aa..c337f063f 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/ClansScoreboardManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/ClansScoreboardManager.java @@ -42,19 +42,17 @@ public class ClansScoreboardManager extends ScoreboardManager private void init(TutorialManager tutorialManager) { - setTitle(" MINEPLEX CLANS "); + setTitle("Clans Alpha " + Clans.VERSION); ScoreboardData data = getData("default", true); - data.write(C.cGreen + "Clans Alpha " + Clans.VERSION); - data.writeEmpty(); data.writeElement(new ScoreboardElementClan(_clansManager)); data.writeElement(new ScoreboardElementPlayer(_clansManager)); - data.writeElement(new ScoreboardElementPlayerCount(_clansManager)); - - data.writeElement(_worldEvent); +// data.writeElement(new ScoreboardElementPlayerCount(_clansManager)); + data.writeElement(_warManager); - + data.writeElement(_worldEvent); + for (Tutorial tutorial : tutorialManager.getTutorials().values()) { data.writeElement(tutorial); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementClan.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementClan.java index d27d2c34b..5252cb23d 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementClan.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementClan.java @@ -35,8 +35,7 @@ public class ScoreboardElementClan implements ScoreboardElement // Energy if (clanInfo.getEnergyCostPerMinute() > 0) - output.add(C.cYellow + "Energy " + C.cWhite + UtilTime.convertString((clanInfo.getEnergy() / clanInfo.getEnergyCostPerMinute()) * 60000L, 1, UtilTime.TimeUnit.FIT)); - output.add(C.cYellow + "Home " + C.cWhite + clanInfo.getBedStatusStr()); + output.add(C.cYellow + "Energy " + C.cWhite + UtilTime.convertString((clanInfo.getEnergy() / clanInfo.getEnergyCostPerMinute()) * 60000L, 1, UtilTime.TimeUnit.FIT)); } else { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementPlayer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementPlayer.java index 36d4ac271..d0d710721 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementPlayer.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementPlayer.java @@ -27,10 +27,9 @@ public class ScoreboardElementPlayer implements ScoreboardElement { List output = new ArrayList(); output.add(C.cYellow + "Gold " + C.cWhite + manager.getDonation().Get(player).GetBalance(CurrencyType.Gold) + ""); - output.add(""); - String regionString = C.xWilderness + "Wilderness"; + output.add(" "); ClanTerritory claim = _clansManager.getClanUtility().getClaim(player.getLocation()); if (claim != null) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementPlayerCount.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementPlayerCount.java index be56178a3..0c6fb35d5 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementPlayerCount.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementPlayerCount.java @@ -29,7 +29,7 @@ public class ScoreboardElementPlayerCount implements ScoreboardElement List output = new ArrayList(); output.add(""); - output.add(C.cYellow + "Players Online " + UtilServer.getPlayers().length + "/100"); + output.add(C.cYellow + "Players " + C.cWhite + UtilServer.getPlayers().length + "/100"); return output; } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/war/WarManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/war/WarManager.java index cc017df55..166693db2 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/war/WarManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/war/WarManager.java @@ -97,7 +97,7 @@ public class WarManager extends MiniPlugin implements ScoreboardElement { for (WarInvasion invasion : invasions) { - if (invasion.getInvaderClan().equals(playerClan)) + if (invasion.getInvaderClan().equals(playerClan.getName())) return true; } } @@ -125,15 +125,24 @@ public class WarManager extends MiniPlugin implements ScoreboardElement final ClanInfo killerClan = event.getKiller().getClan(); ClanWarData war = clan.getWarData(killerClan); - if (war != null && !war.isOnCooldown()) + if (war != null) { + if (war.isOnCooldown()) + { + // Ignore! + return; + } + + _clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer()); + _clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer()); + // War already exists + war.increment(killerClan.getName()); ClansUtility.ClanRelation rel = _clansManager.getClanUtility().rel(clan, killerClan); _clansManager.messageClan(killerClan, F.main("Clans", "Your clan gained 1 War Point against " + rel.getColor(false) + clan.getName() + " " + C.Reset + "(" + killerClan.getFormattedWarPoints(clan) + C.Reset + ")")); _clansManager.messageClan(clan, F.main("Clans", "Your clan lost 1 War Point against " + rel.getColor(false) + killerClan.getName() + " " + C.Reset + "(" + clan.getFormattedWarPoints(killerClan) + C.Reset + ")")); - war.increment(killerClan.getName()); checkWarComplete(war); ClanInfo clanA = clan.getName().equals(war.getClanA()) ? clan : killerClan; @@ -142,9 +151,6 @@ public class WarManager extends MiniPlugin implements ScoreboardElement _clansManager.getScoreboard().refresh(killerClan); _clansManager.getScoreboard().refresh(clan); - - _clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer()); - _clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer()); } else { @@ -155,14 +161,13 @@ public class WarManager extends MiniPlugin implements ScoreboardElement public void run(ClanWarData data) { ClansUtility.ClanRelation rel = _clansManager.getClanUtility().rel(clan, killerClan); + _clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer()); + _clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer()); _clansManager.messageClan(killerClan, F.main("Clans", "Your clan gained 1 War Point against " + rel.getColor(false) + clan.getName())); _clansManager.messageClan(clan, F.main("Clans", "Your clan lost 1 War Point against " + rel.getColor(false) + killerClan.getName())); _clansManager.getScoreboard().refresh(killerClan); _clansManager.getScoreboard().refresh(clan); - - _clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer()); - _clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer()); } }); } @@ -271,7 +276,7 @@ public class WarManager extends MiniPlugin implements ScoreboardElement @EventHandler public void onInvasionEnd(WarInvasionEndEvent event) { - Bukkit.broadcastMessage(F.main("War", F.elem(event.getWarInvasion().getInvaderClan()) + "'s invasion against " + F.elem(event.getWarInvasion().getInvaderClan() + " has ended."))); + Bukkit.broadcastMessage(F.main("War", F.elem(event.getWarInvasion().getInvaderClan()) + "'s invasion against " + F.elem(event.getWarInvasion().getInvadedClan()) + " has ended.")); } @@ -301,13 +306,14 @@ public class WarManager extends MiniPlugin implements ScoreboardElement if (clan != null) { - List invadedList = _invadedMap.get(clan); - List invaderList = _invaderMap.get(clan); + List invadedList = _invadedMap.get(clan.getName()); + List invaderList = _invaderMap.get(clan.getName()); if (invaderList != null && !invaderList.isEmpty()) { for (WarInvasion invasion : invaderList) { + element.add(" "); element.add(C.cPurpleB + "Invading"); element.add(" " + invasion.getInvadedClan()); element.add(" " + UtilTime.convertString(invasion.getTimeLeft(), 1, UtilTime.TimeUnit.FIT)); @@ -318,6 +324,7 @@ public class WarManager extends MiniPlugin implements ScoreboardElement { for (WarInvasion invasion : invadedList) { + element.add(" "); element.add(C.cRedB + "Invaded"); element.add(" " + invasion.getInvaderClan()); element.add(" " + UtilTime.convertString(invasion.getTimeLeft(), 1, UtilTime.TimeUnit.FIT)); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java index 08870a246..a9e3afc57 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java @@ -8,6 +8,7 @@ import java.util.Map; import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; +import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -19,6 +20,7 @@ import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; import mineplex.core.common.jsonchat.ClickEvent; @@ -27,6 +29,8 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; @@ -40,6 +44,7 @@ import mineplex.core.task.TaskManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.event.ClanJoinEvent; import mineplex.game.clans.clans.event.ClanTipEvent; import mineplex.game.clans.economy.GoldManager; import net.minecraft.server.v1_8_R3.PacketPlayOutChat; @@ -66,7 +71,8 @@ public abstract class Tutorial implements ScoreboardElement, Listener protected final TaskManager _taskManager; protected final DonationManager _donationManager; - protected final LinkedHashMap> _tasks; +// protected final LinkedHashMap> _tasks; + private final ArrayList> _tasks; protected final LinkedHashMap> _nameToTask; protected final LinkedHashMap _inTutorial; @@ -89,7 +95,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener _donationManager = donationManager; _taskManager = taskManager; _manager = manager; - _tasks = new LinkedHashMap<>(); + _tasks = new ArrayList>(); _inTutorial = new LinkedHashMap<>(); _nameToTask = new LinkedHashMap<>(); @@ -122,7 +128,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener lines.add(C.cAqua + "Tutorial"); - for (final TutorialTask task : _tasks.values()) + for (final TutorialTask task : _tasks) { if (get(player).CurrentTask.equals(task)) { @@ -142,10 +148,15 @@ public abstract class Tutorial implements ScoreboardElement, Listener return lines; } + + public TutorialTask getTask(int index) + { + return _tasks.get(index); + } protected void addTask(TutorialTask task) { - _tasks.put(_tasks.size() + 1, task); + _tasks.add(task); _nameToTask.put(task.getTechnicalName(), task); } @@ -158,6 +169,11 @@ public abstract class Tutorial implements ScoreboardElement, Listener return get(player).CurrentTask.getID() < task.getID(); } + + private TutorialTask getLastTask() + { + return _tasks.get(_tasks.size() - 1); + } protected void finishTask(final Player player, final TutorialTask task) { @@ -175,8 +191,10 @@ public abstract class Tutorial implements ScoreboardElement, Listener { public void run() { + final TutorialTask lastTask = getLastTask(); // Cycle to next task, or null if last task. - get(player).CurrentTask = task.equals(_tasks.get(_tasks.size())) ? null : _tasks.get(task.getID() + 1); + get(player).CurrentTask = task.equals(lastTask) ? null : _tasks.get(task.getDataId() + 1); + System.out.println("Next Task: " + get(player).CurrentTask); if (!_taskManager.hasCompletedTask(player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName()))) { @@ -185,7 +203,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener public void run(final Boolean completed) { // If last task, end tutorial. - if (task.equals(_tasks.get(_tasks.size()))) + if (task.equals(lastTask)) { finishFor(player); } @@ -196,6 +214,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener { public void run() { + System.out.println("STARTING NEXT TASK!"); get(player).CurrentTask.startFor(player); get(player).CurrentTaskStartTime = System.currentTimeMillis(); } @@ -253,23 +272,22 @@ public abstract class Tutorial implements ScoreboardElement, Listener private void finishFor(final Player player) { - if (player.getOpenInventory() != null) - { - _inTutorial.get(player.getName()).QueuedFinish = true; - return; - } - +// if (player.getOpenInventory() != null) +// { +// _inTutorial.get(player.getName()).QueuedFinish = true; +// return; +// } + _manager.finishTutorial(player); _inTutorial.remove(player.getName()); - - UtilTextMiddle.display(C.cWhite + "Clans Tutorial", C.cGreen + "You have completed the Clans Tutorial!", 20, 20 * 3, 20); + onFinished(player); _manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable() { public void run() { - // Custom Finish Method (usually messages) - onFinished(player); - + UtilTextMiddle.display(C.cWhite + "Clans Tutorial", C.cGreen + "You have completed the Clans Tutorial!", 20, 20 * 3, 20, player); + onFinishedDelay(player); + // Do Reward if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_REWARD_TASK, _technicalName))) { @@ -306,6 +324,25 @@ public abstract class Tutorial implements ScoreboardElement, Listener } }, player, String.format(TUTORIAL_REWARD_TASK, _technicalName)); } + else + { + UtilInv.remove(player, Material.IRON_AXE, (byte) 0, 1); + + UtilInv.remove(player, Material.IRON_HELMET, (byte) 0, 1); + UtilInv.remove(player, Material.IRON_CHESTPLATE, (byte) 0, 1); + UtilInv.remove(player, Material.IRON_LEGGINGS, (byte) 0, 1); + UtilInv.remove(player, Material.IRON_BOOTS, (byte) 0, 1); + + ItemStack[] armor = player.getInventory().getArmorContents(); + for (int i = 0 ; i < armor.length; i++) + { + if (UtilItem.isIronProduct(armor[i])) + { + armor[i] = null; + } + } + player.getInventory().setArmorContents(armor); + } _manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable() { @@ -341,13 +378,17 @@ public abstract class Tutorial implements ScoreboardElement, Listener } }, 20 * 2); } - }, 20 * 4); + }, 20 * 2); } // Implementation left to sub classes. protected void onFinished(final Player player) { } + + protected void onFinishedDelay(final Player player) + { + } // Implementation left to sub classes. protected void onBegin(final Player player) @@ -358,7 +399,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener { if (!_manager.isInTutorial(player)) { - _manager._playerTutorials.put(player.getName(), this); + _manager.setTutorial(player, this); } _inTutorial.put(player.getName(), new TutorialClient(player, this)); @@ -403,11 +444,6 @@ public abstract class Tutorial implements ScoreboardElement, Listener return _inTutorial.containsKey(player); } - public Map> getTasks() - { - return _tasks; - } - public boolean hasCompleted(final Player player) { return _taskManager.hasCompletedTask(player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName)); @@ -507,7 +543,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener } } - get(player).CurrentTask.trySendDescription(player); + get(player).CurrentTask.trySendDescription(player, false); } } } @@ -533,6 +569,15 @@ public abstract class Tutorial implements ScoreboardElement, Listener evt.setCancelled(true); } + @EventHandler + public void onJoinClan(ClanJoinEvent event) + { + if (isInTutorial(event.getPlayer())) + { + event.setCancelled(true); + } + } + @EventHandler public void onPlayerJoin(final PlayerJoinEvent evt) { @@ -553,9 +598,15 @@ public abstract class Tutorial implements ScoreboardElement, Listener public void cleanup(Player player) { - if (get(player) != null && get(player).CurrentTask != null) + System.out.println("Cleaning up Player in " + getClass().getName()); + + if (get(player) != null && get(player).CurrentTask != null) + { + System.out.println("Cleaning up current task: " + get(player).CurrentTask.getClass().getName()); get(player).CurrentTask.cleanup(player); - + } + + System.out.println("removing from in tutorial"); _inTutorial.remove(player.getName()); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialClient.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialClient.java index 383a09700..ac44d52a1 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialClient.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialClient.java @@ -17,11 +17,12 @@ public class TutorialClient { Player = player; - CurrentTask = tutorial._tasks.get(1); + CurrentTask = tutorial.getTask(0); CurrentTaskStartTime = System.currentTimeMillis(); InClanOnStart = tutorial._clansManager.isInClan(player); - + + /* for (TutorialTask task : tutorial._tasks.values()) { if (TaskManager.Instance.hasCompletedTask(player, String.format( @@ -36,5 +37,6 @@ public class TutorialClient } } } + */ } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java index 7a637f7ba..58d509c1b 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java @@ -32,7 +32,7 @@ public class TutorialManager extends MiniPlugin public static TutorialManager Instance; private final Map, Tutorial> _tutorials = new HashMap<>(); - protected final Map _playerTutorials = new HashMap<>(); + private final Map _playerTutorials = new HashMap<>(); private final TaskManager _taskManager; @@ -138,10 +138,13 @@ public class TutorialManager extends MiniPlugin @EventHandler public void quit(PlayerQuitEvent event) { + System.out.println("Player Quit. In Tutorial: " + isInTutorial(event.getPlayer())); + if (!isInTutorial(event.getPlayer())) return; getTutorial(event.getPlayer()).cleanup(event.getPlayer()); + _playerTutorials.remove(event.getPlayer().getName()); } public void sendTutorialMsg(Player player, String message) @@ -156,6 +159,16 @@ public class TutorialManager extends MiniPlugin sendTutorialMsg(player, message); } } + + public void finishTutorial(Player player) + { + _playerTutorials.remove(player.getName()); + } + + public void setTutorial(Player player, Tutorial tutorial) + { + _playerTutorials.put(player.getName(), tutorial); + } public Tutorial getTutorial(final Player player) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialTask.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialTask.java index cc6addbda..153668e0e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialTask.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialTask.java @@ -15,6 +15,7 @@ import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClansManager; public class TutorialTask implements Listener @@ -38,7 +39,6 @@ public class TutorialTask implements Listener protected long _descriptionWaitTime = 30000; - protected NautArrayList _playersFinished = new NautArrayList<>(); protected NautArrayList _inTask = new NautArrayList<>(); private long _lastTaskTp; @@ -64,7 +64,7 @@ public class TutorialTask implements Listener { _inTask.add(player.getName()); - trySendDescription(player); + trySendDescription(player, true); customStartFor(player); @@ -123,7 +123,7 @@ public class TutorialTask implements Listener { if (isDoing(player)) { - UtilTextMiddle.display("", UtilText.arrayToString(_subtasks, "\n"), 1, 25, 25); + UtilTextMiddle.display("", UtilText.arrayToString(_subtasks, "\n"), 1, 25, 25, player); } } } @@ -134,7 +134,7 @@ public class TutorialTask implements Listener return _inTask != null && player != null && _inTask.contains(player.getName()); } - public void trySendDescription(Player player) + public void trySendDescription(Player player, boolean force) { if (!_tutorial.isInTutorial(player)) { @@ -148,19 +148,24 @@ public class TutorialTask implements Listener return; } - if (System.currentTimeMillis() - client.LastDescriptionSentTime > client.CurrentTask.getDescriptionWaitTime()) + if (force || System.currentTimeMillis() - client.LastDescriptionSentTime > client.CurrentTask.getDescriptionWaitTime()) { + String description = _description; + ClanInfo clan = getClans().getClan(player); + if (clan != null) description = description.replace("(clan)", clan.getName()); + description = description.replace("{", C.cAqua).replace("}", C.cWhite); + _tutorial._manager.sendTutorialMsg(player, " "); _tutorial._manager.sendTutorialMsg(player, " "); _tutorial._manager.sendTutorialMsg(player, " "); _tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------"); _tutorial._manager.sendTutorialMsg(player, " "); - _tutorial._manager.sendTutorialMsg(player, C.cYellowB + "Part " + _id + ": " + _displayName); - _tutorial._manager.sendTutorialMsg(player, C.cWhite + " " + _description.replace("{", C.cAqua).replace("}", C.cWhite)); + _tutorial._manager.sendTutorialMsg(player, C.cYellowB + "Part " + (_id + 1) + ": " + _displayName); + _tutorial._manager.sendTutorialMsg(player, C.cWhite + " " + description); _tutorial._manager.sendTutorialMsg(player, " "); _tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------"); - UtilTextMiddle.display("", getDisplayName()); + UtilTextMiddle.display("", getDisplayName(), player); client.LastDescriptionSentTime = System.currentTimeMillis(); } @@ -206,30 +211,39 @@ public class TutorialTask implements Listener { return _tutorial._clansManager; } - - public int getID() + + public int getDataId() { return _id; } + public int getID() + { + return _id + 1; + } + public void finishFor(Player player) { customEndFor(player); + cleanup(player); _tutorial.finishTask(player, this); } public void visibleFinish(Player player) { - _inTask.remove(player.getName()); - if (_finishMessage != null) { + String finishMessage = _finishMessage; + ClanInfo clan = getClans().getClan(player); + if (clan != null) finishMessage = finishMessage.replace("(clan)", clan.getName()); + finishMessage = finishMessage.replace("{", C.cAqua).replace("}", C.cWhite); + _tutorial._manager.sendTutorialMsg(player, " "); _tutorial._manager.sendTutorialMsg(player, " "); _tutorial._manager.sendTutorialMsg(player, " "); _tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------"); _tutorial._manager.sendTutorialMsg(player, " "); - _tutorial._manager.sendTutorialMsg(player, C.cWhite + _finishMessage.replace("{", C.cAqua).replace("}", C.cWhite)); + _tutorial._manager.sendTutorialMsg(player, C.cWhite + finishMessage); _tutorial._manager.sendTutorialMsg(player, " "); _tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------"); } @@ -238,7 +252,6 @@ public class TutorialTask implements Listener public void cleanup(Player player) { _inTask.remove(player.getName()); - _playersFinished.remove(player.getName()); } public long getDescriptionWaitTime() diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskCustomizeClass.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskCustomizeClass.java index ea7d0c3a6..91f065320 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskCustomizeClass.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskCustomizeClass.java @@ -48,7 +48,14 @@ public class TaskCustomizeClass extends TutorialTask if (clientclass != null && clientclass.GetSavingCustomBuild() != null && clientclass.GetSavingCustomBuild().AxeSkill != null) { finishFor(player); + iterator.remove(); } } } + + @Override + public void cleanup(Player player) + { + // handled in onUpdate + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskDisbandClan.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskDisbandClan.java index 69ca5de33..a294434cb 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskDisbandClan.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskDisbandClan.java @@ -25,18 +25,6 @@ public class TaskDisbandClan extends TutorialTask @Override public void customStartFor(final Player player) { - if (_tutorial.get(player).InClanOnStart) - { - UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getManager().getPlugin(), new Runnable(){ - public void run() - { - if (isDoing(player)) - { - finishFor(player); - } - } - }, 6 * 20); - } } @EventHandler @@ -46,6 +34,8 @@ public class TaskDisbandClan extends TutorialTask { return; } + + System.out.println("COMPLETE DISBAND CLAN!"); finishFor(event.getDisbander()); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskEquipClass.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskEquipClass.java index 0dee17131..924a90eed 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskEquipClass.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskEquipClass.java @@ -62,6 +62,11 @@ public class TaskEquipClass extends TutorialTask public void customStartFor(Player player) { _bought.put(player.getName(), new NautArrayList()); + + if (getClans().getClassManager().Get(player).GetGameClass() != null) + { + finishFor(player); + } } @EventHandler diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskExploreShops.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskExploreShops.java index 39ddfd126..d34c2129e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskExploreShops.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskExploreShops.java @@ -57,12 +57,19 @@ public class TaskExploreShops extends TutorialTask if (ClansManager.getInstance().getClan(event.getPlayer()).getEnergyPurchasable() == 0) { finishFor(event.getPlayer()); + _inTask.remove(event.getPlayer().getName()); return; } event.setFree(true); } - + + @Override + public void cleanup(Player player) + { + // handled in on update + } + @EventHandler public void onUpdate(UpdateEvent event) { @@ -78,6 +85,7 @@ public class TaskExploreShops extends TutorialTask if (ClansManager.getInstance().getClan(player).getEnergy() == ClansManager.getInstance().getClan(player).getEnergyMax()) { finishFor(player); + iterator.remove(); } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskLeaveSpawn.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskLeaveSpawn.java index 71a8155da..37bea2964 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskLeaveSpawn.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskLeaveSpawn.java @@ -6,6 +6,8 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.tutorials.TutorialTask; @@ -45,12 +47,20 @@ public class TaskLeaveSpawn extends TutorialTask Iterator iterator = _inTask.iterator(); while (iterator.hasNext()) { - Player player = Bukkit.getPlayer(iterator.next()); + String playerName = iterator.next(); + Player player = UtilPlayer.searchExact(playerName); if (player.getLocation().getY() < 100 && getClans().getClanUtility().getClaim(player.getLocation()) == null) { finishFor(player); + iterator.remove(); } } } + + @Override + public void cleanup(Player player) + { + // We handle this in update() to avoid ConcurrentModificationException + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskMakingMoney.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskMakingMoney.java index e7a8fff57..66c5fb36f 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskMakingMoney.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskMakingMoney.java @@ -70,6 +70,8 @@ public class TaskMakingMoney extends TutorialTask { return; } + + System.out.println("FINISH CARROT"); finishFor(event.getPlayer()); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskUseAbility.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskUseAbility.java index 58c9bb58d..ee85950da 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskUseAbility.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskUseAbility.java @@ -9,14 +9,18 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryType; +import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.CraftingInventory; +import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import mineplex.core.common.util.Callback; import mineplex.core.common.util.NautArrayList; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilServer; import mineplex.core.task.TaskManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -39,7 +43,7 @@ public class TaskUseAbility extends TutorialTask + "Purchase an Iron Axe from the PvP Shop. " + "Right-Click with your Iron Axe to use your Axe Ability!"; - _taskPos = new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f); +// _taskPos = new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f); } private NautHashMap> _bought = new NautHashMap<>(); @@ -49,7 +53,6 @@ public class TaskUseAbility extends TutorialTask public void customStartFor(Player player) { _bought.put(player.getName(), new NautArrayList()); - _teleported.put(player.getName(), false); } @Override @@ -70,7 +73,7 @@ public class TaskUseAbility extends TutorialTask { Player _player = Bukkit.getPlayer(iterator.next()); - if (!_teleported.get(_player.getName()) && _player != null && _player.isOnline() && _player.getOpenInventory().getType() == InventoryType.CRAFTING) + if (!_teleported.containsKey(_player.getName()) && _player != null && _player.isOnline() && _player.getOpenInventory().getType() == InventoryType.CRAFTING) { _player.teleport(new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f)); _teleported.put(_player.getName(), true); @@ -78,6 +81,7 @@ public class TaskUseAbility extends TutorialTask } } + /* @EventHandler public void onAbilityUesd(SkillTriggerEvent event) { @@ -88,6 +92,25 @@ public class TaskUseAbility extends TutorialTask finishFor(event.GetPlayer()); } + */ + + @EventHandler + public void onRightClick(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!isDoing(player)) + return; + + if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) + { + ItemStack item = player.getItemInHand(); + if (item != null && item.getType() == Material.IRON_AXE) + { + finishFor(player); + } + } + } @EventHandler public void button(ClansShopAddButtonEvent event) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskViewClanDetails.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskViewClanDetails.java index 60e732340..9ece47104 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskViewClanDetails.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskViewClanDetails.java @@ -16,7 +16,7 @@ public class TaskViewClanDetails extends TutorialTask _technicalName = "CommandClanX"; _description = "Now you can view information about your clan. " - + "To do this type {/c [clan name]}! " + + "To do this type {/c (clan)}! " + "You can also use any clan's name to get some information about them as well."; } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TutorialGettingStarted.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TutorialGettingStarted.java index 0fe1fc7fd..fe2dde3df 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TutorialGettingStarted.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TutorialGettingStarted.java @@ -25,7 +25,7 @@ public class TutorialGettingStarted extends Tutorial // addTask(new TaskWelcome(this, 1)); - int id = 0; + int id = -1; addTask(new TaskCreateClan(this, ++id)); addTask(new TaskViewClanDetails(this, ++id)); addTask(new TaskLeaveSpawn(this, ++id)); @@ -49,6 +49,13 @@ public class TutorialGettingStarted extends Tutorial @Override public void onFinished(final Player player) + { + player.resetPlayerTime(); + player.teleport(Spawn.getEastSpawn()); + } + + @Override + protected void onFinishedDelay(Player player) { _manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------"); _manager.sendTutorialMsg(player, C.cYellowB + "CONGRATULATIONS"); @@ -56,11 +63,8 @@ public class TutorialGettingStarted extends Tutorial _manager.sendTutorialMsg(player, C.cWhite + "You have completed the Clans basic tutorial and have been awarded " + C.cAqua + "30,000 Gold"); _manager.sendTutorialMsg(player, C.cWhite + "You can now begin your adventure, but do take a moment to read the signs around spawn for more information!"); _manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------"); - - player.resetPlayerTime(); - player.teleport(Spawn.getEastSpawn()); } - + @Override public void onBegin(final Player player) { From 2435ebba1356b5bbf0bea310a96857590d68e190 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 4 Dec 2015 05:16:14 -0500 Subject: [PATCH 04/54] Disable subtasks for now --- .../clans/tutorials/gettingstarted/TaskEquipClass.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskEquipClass.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskEquipClass.java index 924a90eed..458e04bb4 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskEquipClass.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskEquipClass.java @@ -29,11 +29,11 @@ public class TaskEquipClass extends TutorialTask + "Purchase Iron Armor from the PvP Shop. " + "Then put on your armor to equip the Knight Class."; - _subtasks = new String[] { - "Open the PvP Shop", - "Buy Iron Armor Set", - "Equip Iron Armor" - }; +// _subtasks = new String[] { +// "Open the PvP Shop", +// "Buy Iron Armor Set", +// "Equip Iron Armor" +// }; _taskPos = new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f); } From bb382a969c367afe6ce0e4fc2c9f091971af001a Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 4 Dec 2015 08:02:38 -0500 Subject: [PATCH 05/54] Fix heavy attribute, disable claim visualizer --- .../src/mineplex/game/clans/clans/ClansManager.java | 2 +- .../game/clans/items/attributes/bow/HeavyArrowsAttribute.java | 3 ++- .../src/mineplex/game/clans/spawn/Spawn.java | 2 +- 3 files changed, 4 insertions(+), 3 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 8b09f8db2..d97ad7c78 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 @@ -305,7 +305,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati loadClan(token); } - new ClaimVisualizer(plugin, this); +// new ClaimVisualizer(plugin, this); // RedisDataRepository(ConnectionData writeConn, ConnectionData // readConn, Region region, Class elementType, String elementLabel) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/bow/HeavyArrowsAttribute.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/bow/HeavyArrowsAttribute.java index 16aa30a21..f5e55d42c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/bow/HeavyArrowsAttribute.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/bow/HeavyArrowsAttribute.java @@ -35,6 +35,7 @@ public class HeavyArrowsAttribute extends ItemAttribute @Override public void onAttack(CustomDamageEvent event) { - event.AddKnockback("HeavyAttribute", _knockbackPercent); + double knockback = (_knockbackPercent / 100d) * 6; + event.AddKnockback("Heavy Attribute", knockback); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/Spawn.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/Spawn.java index dfca12bb5..50a251707 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/Spawn.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/Spawn.java @@ -248,7 +248,7 @@ public class Spawn extends MiniPlugin if (isInSpawn(player)) { - UtilPlayer.message(event.GetPlayer(), F.main("Safe Zone", "You cannot use " + F.skill(event.GetSkillName() + " in " + F.elem("Safe Zone") + "."))); + UtilPlayer.message(event.GetPlayer(), F.main("Safe Zone", "You cannot use " + F.skill(event.GetSkillName()) + " in " + F.elem("Safe Zone") + ".")); event.SetCancelled(true); } } From e158704534a428cd9ddff068c862d848e12f1690 Mon Sep 17 00:00:00 2001 From: NewGarbo Date: Fri, 4 Dec 2015 14:56:43 +0000 Subject: [PATCH 06/54] fixed /skiptutorial not working, and fixed tutorial thinking you're still in tutorial after finishing/cancelling/skipping --- .../game/clans/tutorials/Tutorial.java | 11 +-- .../game/clans/tutorials/TutorialManager.java | 71 ++++++++++++++++++- 2 files changed, 77 insertions(+), 5 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java index a9e3afc57..ab0462f86 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java @@ -64,6 +64,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener public static String SKIPPED_TASK = "tatatatata%sSkip"; public static String AllowedMessage = C.cGold + "TutorialAllowedMessage" + C.Reset; + public static String AllowedBypass = C.cBlue + "Tutorial>"; protected final TutorialManager _manager; protected final GoldManager _goldManager; @@ -424,6 +425,8 @@ public abstract class Tutorial implements ScoreboardElement, Listener { _inTutorial.remove(player.getName()); + _manager.finishTutorial(player); + if (_ghostMode) { for (Player other : UtilServer.getPlayers()) @@ -456,9 +459,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener public void skip(final Player player) { - new JsonMessage( - AllowedMessage - ) + new JsonMessage("") .extra( F.main( "Tutorial", @@ -472,9 +473,11 @@ public abstract class Tutorial implements ScoreboardElement, Listener .color("yellow") .extra("!") .color("gray") + .sendToPlayer(player); - new JsonMessage( + new JsonMessage("") + .extra( F.main( "Tutorial", "Click " diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java index 58d509c1b..7468ff139 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java @@ -25,6 +25,7 @@ import mineplex.game.clans.tutorials.commands.DoSkipTutorialCommand; import mineplex.game.clans.tutorials.commands.SkipTutorialCommand; import mineplex.game.clans.tutorials.gettingstarted.TutorialGettingStarted; import net.md_5.bungee.api.ChatColor; +import net.minecraft.server.v1_8_R3.IChatBaseComponent; import net.minecraft.server.v1_8_R3.PacketPlayOutChat; public class TutorialManager extends MiniPlugin @@ -64,7 +65,7 @@ public class TutorialManager extends MiniPlugin { chat.a.a().remove(0); } - else + else if (!chat.a.a().get(0).c().contains(Tutorial.AllowedBypass)) { if (isInTutorial(packet.getPlayer())) { @@ -184,4 +185,72 @@ public class TutorialManager extends MiniPlugin { return _taskManager; } + + // Stolen from UtilTabTitle + private static class TextConverter + { + public static String convert(String text) + { + if (text == null || text.length() == 0) + { + return "\"\""; + } + + char c; + int i; + int len = text.length(); + StringBuilder sb = new StringBuilder(len + 4); + String t; + sb.append('"'); + + for (i = 0; i < len; i += 1) + { + c = text.charAt(i); + switch (c) + { + case '\\': + case '"': + sb.append('\\'); + sb.append(c); + break; + case '/': + sb.append('\\'); + sb.append(c); + break; + case '\b': + sb.append("\\b"); + break; + case '\t': + sb.append("\\t"); + break; + case '\n': + sb.append("\\n"); + break; + case '\f': + sb.append("\\f"); + break; + case '\r': + sb.append("\\r"); + break; + default: + if (c < ' ') + { + t = "000" + Integer.toHexString(c); + sb.append("\\u").append(t.substring(t.length() - 4)); + } + else + { + sb.append(c); + } + } + } + sb.append('"'); + return sb.toString(); + } + + public static String setPlayerName(Player player, String text) + { + return text.replaceAll("(?i)\\{PLAYER\\}", player.getName()); + } + } } From bca65116abee1f26b17251dd2f50a94fd1404116 Mon Sep 17 00:00:00 2001 From: NewGarbo Date: Fri, 4 Dec 2015 18:23:23 +0000 Subject: [PATCH 07/54] fixed task not getting cleanup up after /skiptutorial --- .../src/mineplex/game/clans/tutorials/Tutorial.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java index ab0462f86..4d6ae6cc3 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java @@ -423,6 +423,8 @@ public abstract class Tutorial implements ScoreboardElement, Listener public void cancelFor(final Player player) { + get(player).CurrentTask.cleanup(player); + get(player).CurrentTaskStartTime = -1; _inTutorial.remove(player.getName()); _manager.finishTutorial(player); From 5d59b1a01558be422c833f913b37077b3ffc5ca7 Mon Sep 17 00:00:00 2001 From: NewGarbo Date: Fri, 4 Dec 2015 18:32:46 +0000 Subject: [PATCH 08/54] fixed tnt blowing up in claims when offline --- .../src/mineplex/game/clans/clans/ClanInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java index dc53b6069..5e82714fe 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java @@ -462,7 +462,7 @@ public class ClanInfo public boolean isOnline() { - return isOnlineNow() || System.currentTimeMillis() - _lastOnline.getTime() < Clans.getOnlineTime(); + return isOnlineNow();// || System.currentTimeMillis() - _lastOnline.getTime() < Clans.getOnlineTime(); } public String getProtected() From 9bd7869e2260e23a0ff981b7084ff9b4a3768b43 Mon Sep 17 00:00:00 2001 From: Keir Date: Sat, 5 Dec 2015 01:08:21 +0000 Subject: [PATCH 09/54] Fix typo, "_hubInvisibilityToggled" was checked twice, whilst "_hubIgnoreVelocityToggled" was not checked at all. This causes hub velocity changes to not be saved. --- .../mineplex/core/preferences/ui/ExclusivePreferencesPage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/ExclusivePreferencesPage.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/ExclusivePreferencesPage.java index 53c774a0e..272b5fe38 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/ExclusivePreferencesPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/ExclusivePreferencesPage.java @@ -189,6 +189,6 @@ public class ExclusivePreferencesPage extends ShopPageBase Date: Sat, 5 Dec 2015 21:36:07 -0500 Subject: [PATCH 10/54] Forgot to push these changes last update! --- .../src/mineplex/game/clans/Clans.java | 2 +- .../mineplex/game/clans/clans/ClansDataAccessLayer.java | 8 ++++---- .../clans/tutorials/gettingstarted/TaskLeaveSpawn.java | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java index 214707cd7..ce3ff1b86 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java @@ -49,7 +49,7 @@ import net.minecraft.server.v1_8_R3.MinecraftServer; public class Clans extends JavaPlugin { - public static final String VERSION = "0.17"; + public static final String VERSION = "0.17b"; private String WEB_CONFIG = "webServer"; // Modules 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 eea8309b6..9d06f8fa4 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 @@ -656,6 +656,10 @@ public class ClansDataAccessLayer { final Timestamp currentTime = new Timestamp(System.currentTimeMillis()); final ClanWarData war = new ClanWarData(clanA.getName(), clanB.getName(), score, currentTime, currentTime, 0); + + // Memory + clanA.addWar(war); + clanB.addWar(war); runAsync(new Runnable() { @@ -669,10 +673,6 @@ public class ClansDataAccessLayer @Override public void run() { - // Memory - clanA.addWar(war); - clanB.addWar(war); - _manager.log("Initiator war for [" + clanA.getName() + "] against [" + clanB.getName() + "]."); if (warCallback != null) warCallback.run(war); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskLeaveSpawn.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskLeaveSpawn.java index 37bea2964..5f0f7926c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskLeaveSpawn.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskLeaveSpawn.java @@ -33,6 +33,7 @@ public class TaskLeaveSpawn extends TutorialTask if (player.getLocation().getY() < 100) { finishFor(player); + _inTask.remove(player.getName()); } } @@ -50,7 +51,7 @@ public class TaskLeaveSpawn extends TutorialTask String playerName = iterator.next(); Player player = UtilPlayer.searchExact(playerName); - if (player.getLocation().getY() < 100 && getClans().getClanUtility().getClaim(player.getLocation()) == null) + if (player != null && player.getLocation().getY() < 100 && getClans().getClanUtility().getClaim(player.getLocation()) == null) { finishFor(player); iterator.remove(); From a9c7f088f34fb04fb873685348046942d87d70e7 Mon Sep 17 00:00:00 2001 From: NewGarbo Date: Sun, 6 Dec 2015 19:10:18 +0000 Subject: [PATCH 11/54] made use ability teleport player back to where they should be --- .../game/clans/tutorials/gettingstarted/TaskUseAbility.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskUseAbility.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskUseAbility.java index ee85950da..c94324660 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskUseAbility.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskUseAbility.java @@ -43,7 +43,7 @@ public class TaskUseAbility extends TutorialTask + "Purchase an Iron Axe from the PvP Shop. " + "Right-Click with your Iron Axe to use your Axe Ability!"; -// _taskPos = new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f); + _taskPos = new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f); } private NautHashMap> _bought = new NautHashMap<>(); From b2a595b01b1f57077a5307f5f497e1ceed12e9ee Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 7 Dec 2015 12:02:53 +1100 Subject: [PATCH 12/54] snwo fight changes --- .../game/games/snowfight/SnowFight.java | 61 ++++++------ .../game/games/snowfight/kits/KitMedic.java | 94 +------------------ .../games/snowfight/kits/KitSportsman.java | 39 ++------ .../games/snowfight/kits/KitTactician.java | 77 ++------------- .../arcade/kit/perks/PerkPotionGenerator.java | 84 +++++++++++++++++ 5 files changed, 135 insertions(+), 220 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPotionGenerator.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java index 492f82da9..5e8be4cd6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java @@ -201,27 +201,29 @@ public class SnowFight extends TeamGame return; // Item - - if (!_tiles.containsKey(player)) - { - _tiles.put(player, 0); - } - - if (GetKit(player) instanceof KitSportsman) - UtilInv.insert(player, new ItemStack(Material.SNOW_BALL)); - - - int tiles = _tiles.get(player); - _tiles.put(player, tiles + 1); - - if (!(GetKit(player) instanceof KitSportsman)) - { - if (_tiles.get(player) == 2) - { - UtilInv.insert(player, new ItemStack(Material.SNOW_BALL)); - _tiles.put(player, 0); - } - } +// +// if (!_tiles.containsKey(player)) +// { +// _tiles.put(player, 0); +// } +// +// if (GetKit(player) instanceof KitSportsman) +// UtilInv.insert(player, new ItemStack(Material.SNOW_BALL)); +// +// +// int tiles = _tiles.get(player); +// _tiles.put(player, tiles + 1); +// +// if (!(GetKit(player) instanceof KitSportsman)) +// { +// if (_tiles.get(player) == 2) +// { +// UtilInv.insert(player, new ItemStack(Material.SNOW_BALL)); +// _tiles.put(player, 0); +// } +// } + + UtilInv.insert(player, new ItemStack(Material.SNOW_BALL)); // Snow Height SnowDecrease(event.getBlock(), 1); @@ -606,16 +608,19 @@ public class SnowFight extends TeamGame long time = 1000 * 195 - (System.currentTimeMillis() - this.GetStateTime()); - if (time > 0) + if(IsLive()) { - Scoreboard.Write(C.cYellow + C.Bold + "Meteors"); - if(IsLive()) + if (time > 0) + { + Scoreboard.Write(C.cYellow + C.Bold + "Meteors in"); Scoreboard.Write(UtilTime.MakeStr(time, 0)); + } + else + { + Scoreboard.Write(C.cGold + C.Bold + "Meteors!"); + } } - else - { - Scoreboard.Write(C.cGold + C.Bold + "Meteors!"); - } + Scoreboard.Draw(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java index efebaf42e..4c524b981 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java @@ -1,30 +1,17 @@ package nautilus.game.arcade.game.games.snowfight.kits; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkPotionGenerator; -import org.bukkit.Color; import org.bukkit.Material; -import org.bukkit.entity.Egg; -import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.PotionSplashEvent; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.LeatherArmorMeta; -import org.bukkit.potion.Potion; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionType; public class KitMedic extends Kit @@ -36,20 +23,12 @@ public class KitMedic extends Kit new String[] { - "To the rescue...!", - " ", - "Gets 1 Snowball every second tile.", - "Left-Click Snow to pick up Snowballs (Max. 16)", - "Right-Click Snowballs to throw them.", - " ", - "Gets 1 Healing Potion every 32 seconds [max. 1]", - "Slowness II when hit.", - " ", - "Supports all nearby allies with REGENERATION." + "Throw warmth potions to heal allies!", }, new Perk[] { + new PerkPotionGenerator("Warmth Potions", 30, 1, PotionType.INSTANT_HEAL, true, "Warmth Potion", false) }, EntityType.SKELETON, new ItemStack(Material.POTION)); @@ -62,6 +41,8 @@ public class KitMedic extends Kit { player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); } @Override @@ -72,69 +53,4 @@ public class KitMedic extends Kit ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); } - - @EventHandler - public void Aura(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (!HasKit(player)) - continue; - - for (Player other : Manager.GetGame().GetPlayers(true)) - { - if (other.equals(player)) - continue; - - if (UtilMath.offset(player, other) > 4) - continue; - - if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other))) - Manager.GetCondition().Factory().Regen("Aura", other, player, 1.9, 0, false, false, false); - } - } - } - - @EventHandler - public void KitItems(UpdateEvent event) - { - if(!Manager.GetGame().IsLive()) - return; - - if (event.getType() == UpdateType.SLOWEST) - { - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (!HasKit(player)) - continue; - - Potion potion = new Potion(PotionType.INSTANT_HEAL); - potion.setSplash(true); - player.getInventory().setItem(1, potion.toItemStack(1)); - } - } - } - - @EventHandler - public void Splash(PotionSplashEvent event) - { - if(event.getEntity().getShooter() instanceof Player) - { - if(!HasKit((Player) event.getEntity().getShooter())) - return; - - for(Entity entity : event.getAffectedEntities()) - { - if(entity instanceof Player) - { - Manager.GetCondition().Factory().Slow("Heal Potion", (Player)entity, (Player)event.getEntity().getShooter(), 5.0, 1, false, false, false, false); - } - } - - } - } - } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java index 43bd655e3..1bf093f0a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java @@ -19,6 +19,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkFallDamage; public class KitSportsman extends Kit @@ -31,17 +32,13 @@ public class KitSportsman extends Kit new String[] { "Trained to be the fastest on snow and ice.", - "", - "Gets 1 Snowball every tile", - "Left-Click Snow to pick up Snowballs (Max. 16)", - "Right-Click Snowballs to throw them.", - "", - "Supports all nearby allies with SPEED." + }, new Perk[] { - new PerkFallDamage(3) + new PerkDoubleJump("Snow Jump", 1, 0.8, true, 8000, true), + new PerkFallDamage(2), }, EntityType.SKELETON, new ItemStack(Material.SNOW_BALL)); @@ -53,6 +50,8 @@ public class KitSportsman extends Kit { player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); } @Override @@ -63,30 +62,4 @@ public class KitSportsman extends Kit ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); } - - @EventHandler - public void Aura(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (!HasKit(player)) - continue; - - for (Player other : Manager.GetGame().GetPlayers(true)) - { - if (other.equals(player)) - continue; - - if (UtilMath.offset(player, other) > 4) - continue; - - if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other))) - Manager.GetCondition().Factory().Speed("Aura", other, player, 1.9, 0, false, false, false); - } - } - } - } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java index a0aec26c1..f69d290d5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java @@ -1,27 +1,18 @@ package nautilus.game.arcade.game.games.snowfight.kits; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.condition.Condition.ConditionType; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkFallDamage; +import nautilus.game.arcade.kit.perks.PerkConstructor; +import nautilus.game.arcade.kit.perks.PerkIronSkin; -import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.LeatherArmorMeta; -import org.bukkit.potion.PotionType; public class KitTactician extends Kit { @@ -32,18 +23,11 @@ public class KitTactician extends Kit new String[] { "No Snowfight is complete without a tactical game!", - " ", - "Gets 1 Snowball every second tile.", - "Left-Click Snow to pick up Snowballs (Max. 16)", - "Right-Click Snowballs to throw them.", - " ", - "Gets 1 Barrier every 32 seconds [max. 2]", - "Place Barriers to improve your defense.", - "You cant place Barriers above Ice, Packed Ice or Fences.", - " ", - "Supports all nearby allies with RESISTANCE." + }, new Perk[] { + new PerkConstructor("Barrier", 30, 1, Material.FENCE, "Warmth Potion", false), + new PerkIronSkin(0.25) }, EntityType.SKELETON, new ItemStack(Material.FENCE)); @@ -55,6 +39,8 @@ public class KitTactician extends Kit { player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().setItem(7, ItemStackFactory.Instance.CreateStack(Material.COMPASS.getId(), (byte) 0, 1, "§a§lTracking Compass")); } @@ -66,53 +52,4 @@ public class KitTactician extends Kit ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); } - - @EventHandler - public void Aura(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (!HasKit(player)) - continue; - - for (Player other : Manager.GetGame().GetPlayers(true)) - { - if (other.equals(player)) - continue; - - if (UtilMath.offset(player, other) > 4) - continue; - - if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other))) - Manager.GetCondition().Factory().Protection("Aura", other, player, 1.9, 0, false, false, false); - } - } - } - - @EventHandler - public void KitItems(UpdateEvent event) - { - if(!Manager.GetGame().IsLive()) - return; - - if (event.getType() == UpdateType.SLOWEST) - { - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (!HasKit(player)) - continue; - - int amount = 0; - if (player.getInventory().getItem(1) != null && UtilInv.contains(player, Material.FENCE, (byte) 0, 1)) - amount = 2; - else - amount = 1; - player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.FENCE, (byte) 0, amount, "Barrier")); - } - } - } - } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPotionGenerator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPotionGenerator.java new file mode 100644 index 000000000..5f355428e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPotionGenerator.java @@ -0,0 +1,84 @@ +package nautilus.game.arcade.kit.perks; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.event.PerkConstructorEvent; + +import org.bukkit.Bukkit; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.potion.Potion; +import org.bukkit.potion.PotionType; + +public class PerkPotionGenerator extends Perk +{ + private int _max = 0; + private double _time = 0; + + private PotionType _type; + private boolean _splash; + private String _name; + + public PerkPotionGenerator(String perkName, double time, int max, PotionType type, boolean splash, String name, boolean visible) + { + super(perkName, new String[] + { + C.cGray + "Receive 1 " + name + " every " + time + " seconds. Maximum of " + max + ".", + }, visible); + + _time = time; + _splash = splash; + + _name = name; + } + + @EventHandler + public void Construct(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (!Kit.HasKit(cur)) + continue; + + if (!Manager.GetGame().IsAlive(cur)) + continue; + + if (Manager.isSpectator(cur)) + continue; + + if (!Recharge.Instance.use(cur, GetName(), (long) (_time * 1000), false, false)) + continue; + + Potion potion = new Potion(_type); + potion.setSplash(_splash); + ItemStack stack = potion.toItemStack(1); + ItemMeta meta = stack.getItemMeta(); + meta.setDisplayName(_name); + + if (UtilInv.contains(cur, stack.getType(), (byte)0, _max)) + continue; + + PerkConstructorEvent cE = new PerkConstructorEvent(cur); + Bukkit.getServer().getPluginManager().callEvent(cE); + + if (cE.isCancelled()) + continue; + + //Add + cur.getInventory().addItem(stack); + + cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f); + } + } +} From 0c397d6a811c6f8eaba460c7805e0058941e5a8f Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 7 Dec 2015 13:02:26 +1100 Subject: [PATCH 13/54] simplified kits and intro --- .../game/games/snowfight/SnowFight.java | 59 +++++-------- .../game/games/snowfight/kits/KitMedic.java | 42 ++++++++-- .../games/snowfight/kits/KitSportsman.java | 10 +-- .../games/snowfight/kits/KitTactician.java | 10 +-- .../arcade/kit/perks/PerkPotionGenerator.java | 84 ------------------- 5 files changed, 69 insertions(+), 136 deletions(-) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPotionGenerator.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java index 5e8be4cd6..f262a2c7c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java @@ -66,8 +66,8 @@ public class SnowFight extends TeamGame { private HashMap _tiles; + private long _meteorTime = 375000; private boolean _meteors; - private boolean _peace; public SnowFight(ArcadeManager manager) { @@ -86,6 +86,7 @@ public class SnowFight extends TeamGame "Last team alive wins!" }); + this.PrepareFreeze = false; this.HungerSet = 20; this.CompassEnabled = true; this.CompassGiveItem = false; @@ -95,16 +96,6 @@ public class SnowFight extends TeamGame this.BlockBreakAllow = new HashSet<>(Arrays.asList(Material.FENCE.getId())); this._tiles = new HashMap(); this._meteors = false; - this._peace = false; - } - - @EventHandler - public void GameState(GameStateChangeEvent event) - { - if(event.GetState() != GameState.Live) - return; - - this.Announce(C.cRed + C.Bold + "ALERT: " + ChatColor.RESET + C.Bold + "15 seconds Peace Phase is starting!"); } @EventHandler @@ -141,6 +132,22 @@ public class SnowFight extends TeamGame } } + + @EventHandler + public void battleAnnounce(GameStateChangeEvent event) + { + if (event.GetState() == GameState.Prepare) + { + UtilTextMiddle.display(C.cGreen + "Prepare", "Collect Snowballs!", 0, 240, 20, UtilServer.getPlayers()); + } + if (event.GetState() == GameState.Live) + { + for(Player player : GetPlayers(false)) + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F); + + UtilTextMiddle.display(C.cRed + "FIGHT", "", 0, 40, 20, UtilServer.getPlayers()); + } + } @EventHandler public void Meteor(UpdateEvent event) @@ -151,23 +158,7 @@ public class SnowFight extends TeamGame if (!IsLive()) return; - if (System.currentTimeMillis() <= getGameLiveTime() + 10000) - { - UtilTextMiddle.display(C.cGreen + "Prepare", "Battle in " + UtilTime.MakeStr((getGameLiveTime() + 10000) - System.currentTimeMillis()), 0, 60, 20, UtilServer.getPlayers()); - return; - } - - if (!_peace) - { - for(Player player : GetPlayers(false)) - player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F); - - UtilTextMiddle.display(C.cRed + "FIGHT", "Throw your Snowballs!", 0, 60, 20, UtilServer.getPlayers()); - - _peace = true; - } - - if(System.currentTimeMillis() <= getGameLiveTime() + (195 * 1000)) + if(System.currentTimeMillis() <= getGameLiveTime() + _meteorTime) return; if(!_meteors) @@ -180,6 +171,7 @@ public class SnowFight extends TeamGame _meteors = true; } + makeMeteor(); } @@ -188,7 +180,7 @@ public class SnowFight extends TeamGame { Player player = event.getPlayer(); - if (!IsLive()) + if (!InProgress()) return; if (!IsPlaying(player)) @@ -361,13 +353,6 @@ public class SnowFight extends TeamGame @EventHandler(priority = EventPriority.HIGH) public void SnowballEggDamage(CustomDamageEvent event) { - - if(!_peace) - { - event.SetCancelled("Peace Phase"); - return; - } - if (event.IsCancelled()) return; @@ -606,7 +591,7 @@ public class SnowFight extends TeamGame } } - long time = 1000 * 195 - (System.currentTimeMillis() - this.GetStateTime()); + long time = _meteorTime - (System.currentTimeMillis() - this.GetStateTime()); if(IsLive()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java index 4c524b981..a99eb5ad9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java @@ -1,6 +1,9 @@ package nautilus.game.arcade.game.games.snowfight.kits; +import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; @@ -11,7 +14,10 @@ import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.potion.Potion; import org.bukkit.potion.PotionType; public class KitMedic extends Kit @@ -24,11 +30,12 @@ public class KitMedic extends Kit new String[] { "Throw warmth potions to heal allies!", + }, new Perk[] { - new PerkPotionGenerator("Warmth Potions", 30, 1, PotionType.INSTANT_HEAL, true, "Warmth Potion", false) + new PerkPotionGenerator("Warmth Potions", 32, 1, PotionType.INSTANT_HEAL, true, "Warmth Potion", false) }, EntityType.SKELETON, new ItemStack(Material.POTION)); @@ -39,10 +46,10 @@ public class KitMedic extends Kit @Override public void GiveItems(Player player) { - player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); + player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); + player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); } @Override @@ -53,4 +60,29 @@ public class KitMedic extends Kit ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); } + + @EventHandler + public void KitItems(UpdateEvent event) + { + if(!Manager.GetGame().IsLive()) + return; + + if (event.getType() == UpdateType.SLOWEST) + { + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!HasKit(player)) + continue; + + Potion potion = new Potion(PotionType.INSTANT_HEAL); + potion.setSplash(true); + ItemStack stack = potion.toItemStack(1); + ItemMeta meta = stack.getItemMeta(); + meta.setDisplayName("Warmth Potion"); + stack.setItemMeta(meta); + + player.getInventory().setItem(1, stack); + } + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java index 1bf093f0a..ddc84535f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java @@ -38,7 +38,7 @@ public class KitSportsman extends Kit new Perk[] { new PerkDoubleJump("Snow Jump", 1, 0.8, true, 8000, true), - new PerkFallDamage(2), + new PerkFallDamage(-2), }, EntityType.SKELETON, new ItemStack(Material.SNOW_BALL)); @@ -48,10 +48,10 @@ public class KitSportsman extends Kit @Override public void GiveItems(Player player) { - player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); + player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); + player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java index f69d290d5..ba40cacbf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java @@ -26,8 +26,8 @@ public class KitTactician extends Kit }, new Perk[] { + new PerkIronSkin(0.25), new PerkConstructor("Barrier", 30, 1, Material.FENCE, "Warmth Potion", false), - new PerkIronSkin(0.25) }, EntityType.SKELETON, new ItemStack(Material.FENCE)); @@ -37,10 +37,10 @@ public class KitTactician extends Kit @Override public void GiveItems(Player player) { - player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); + player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); + player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); player.getInventory().setItem(7, ItemStackFactory.Instance.CreateStack(Material.COMPASS.getId(), (byte) 0, 1, "§a§lTracking Compass")); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPotionGenerator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPotionGenerator.java deleted file mode 100644 index 5f355428e..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPotionGenerator.java +++ /dev/null @@ -1,84 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilServer; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.event.PerkConstructorEvent; - -import org.bukkit.Bukkit; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.potion.Potion; -import org.bukkit.potion.PotionType; - -public class PerkPotionGenerator extends Perk -{ - private int _max = 0; - private double _time = 0; - - private PotionType _type; - private boolean _splash; - private String _name; - - public PerkPotionGenerator(String perkName, double time, int max, PotionType type, boolean splash, String name, boolean visible) - { - super(perkName, new String[] - { - C.cGray + "Receive 1 " + name + " every " + time + " seconds. Maximum of " + max + ".", - }, visible); - - _time = time; - _splash = splash; - - _name = name; - } - - @EventHandler - public void Construct(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - for (Player cur : UtilServer.getPlayers()) - { - if (!Kit.HasKit(cur)) - continue; - - if (!Manager.GetGame().IsAlive(cur)) - continue; - - if (Manager.isSpectator(cur)) - continue; - - if (!Recharge.Instance.use(cur, GetName(), (long) (_time * 1000), false, false)) - continue; - - Potion potion = new Potion(_type); - potion.setSplash(_splash); - ItemStack stack = potion.toItemStack(1); - ItemMeta meta = stack.getItemMeta(); - meta.setDisplayName(_name); - - if (UtilInv.contains(cur, stack.getType(), (byte)0, _max)) - continue; - - PerkConstructorEvent cE = new PerkConstructorEvent(cur); - Bukkit.getServer().getPluginManager().callEvent(cE); - - if (cE.isCancelled()) - continue; - - //Add - cur.getInventory().addItem(stack); - - cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f); - } - } -} From cbafb2ba914700d9d9ea451a8a2e172eb1dc8ff5 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 7 Dec 2015 13:04:45 +1100 Subject: [PATCH 14/54] fixes --- .../game/arcade/game/games/snowfight/kits/KitMedic.java | 6 +++--- .../game/arcade/game/games/snowfight/kits/KitTactician.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java index a99eb5ad9..3cb7b3b13 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java @@ -8,7 +8,6 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkPotionGenerator; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -31,11 +30,12 @@ public class KitMedic extends Kit { "Throw warmth potions to heal allies!", + C.cGray + "Receive 1 Warmth Potion every 16 seconds. Maximum of 1.", }, new Perk[] { - new PerkPotionGenerator("Warmth Potions", 32, 1, PotionType.INSTANT_HEAL, true, "Warmth Potion", false) + }, EntityType.SKELETON, new ItemStack(Material.POTION)); @@ -67,7 +67,7 @@ public class KitMedic extends Kit if(!Manager.GetGame().IsLive()) return; - if (event.getType() == UpdateType.SLOWEST) + if (event.getType() == UpdateType.SLOWER) { for (Player player : Manager.GetGame().GetPlayers(true)) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java index ba40cacbf..1395c2add 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java @@ -26,8 +26,8 @@ public class KitTactician extends Kit }, new Perk[] { + new PerkConstructor("Constructor", 16, 2, Material.FENCE, "Barrier", true), new PerkIronSkin(0.25), - new PerkConstructor("Barrier", 30, 1, Material.FENCE, "Warmth Potion", false), }, EntityType.SKELETON, new ItemStack(Material.FENCE)); From 488895ea535db0859096e88776bbe8da7194c71f Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sun, 6 Dec 2015 21:12:10 -0500 Subject: [PATCH 15/54] Note block player --- .../mineplex/core/noteblock/NBSReader.java | 131 ++++++++++++++++++ .../src/mineplex/core/noteblock/Note.java | 26 ++++ .../mineplex/core/noteblock/NoteLayer.java | 50 +++++++ .../mineplex/core/noteblock/NotePlayer.java | 88 ++++++++++++ .../src/mineplex/core/noteblock/NoteSong.java | 57 ++++++++ .../src/mineplex/core/noteblock/UtilNote.java | 42 ++++++ .../src/mineplex/hub/HubManager.java | 19 ++- 7 files changed, 412 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/noteblock/NBSReader.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/noteblock/Note.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/noteblock/NoteLayer.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/noteblock/NoteSong.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/noteblock/UtilNote.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NBSReader.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NBSReader.java new file mode 100644 index 000000000..1ca887ede --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NBSReader.java @@ -0,0 +1,131 @@ +package mineplex.core.noteblock; + +import java.io.DataInputStream; +import java.io.EOFException; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; + +/** + * Information about the NBS Format was taken from + * http://www.stuffbydavid.com/mcnbs/format + */ +public class NBSReader +{ + public static NoteSong loadSong(String fileName) throws FileNotFoundException + { + return loadSong(new DataInputStream(new FileInputStream(new File(fileName)))); + } + + public static NoteSong loadSong(DataInputStream stream) + { + try + { + // Header Information + short length = readShort(stream); + short height = readShort(stream); + String name = readString(stream); + String author = readString(stream); + String originalAuthor = readString(stream); + String description = readString(stream); + short tempo = readShort(stream); // Tempo multiplied by 1000 + boolean autosave = stream.readBoolean(); + byte autosaveDuration = stream.readByte(); + byte timeSignature = stream.readByte(); + int minutesSpent = readInt(stream); + int leftClicks = readInt(stream); + int rightClicks = readInt(stream); + int blocksAdded = readInt(stream); + int blocksRemoved = readInt(stream); + String midiFileName = readString(stream); + + HashMap layerMap = new HashMap(); + + // Note Block Information + int tick = -1; + int jumps = 0; + while (true) + { + jumps = readShort(stream); + if (jumps == 0) + break; + tick += jumps; + int layer = -1; + while (true) + { + jumps = readShort(stream); + if (jumps == 0) + break; + layer += jumps; + byte instrument = stream.readByte(); + byte key = stream.readByte(); + + Note note = new Note(instrument, key); + NoteLayer noteLayer = layerMap.get(layer); + if (noteLayer == null) + { + noteLayer = new NoteLayer(); + layerMap.put(layer, noteLayer); + } + noteLayer.setNote(tick, note); + } + } + + // Layer Information + for (int i = 0; i < height; i++) + { + NoteLayer layer = layerMap.get(i); + if (layer != null) + { + layer.setName(readString(stream)); + layer.setVolume(stream.readByte()); + } + } + + System.out.println("[NBSReader] Successfully loaded song " + name + ""); + System.out.println("Tempo: " + tempo); + return new NoteSong(length, height, name, tempo, timeSignature, layerMap); + } + catch (IOException e) + { + e.printStackTrace(); + } + + return null; + } + + private static int readInt(DataInputStream stream) throws IOException + { + // For some reason the bytes are in reverse order from stream.readInt() + int ch1 = stream.read(); + int ch2 = stream.read(); + int ch3 = stream.read(); + int ch4 = stream.read(); + if ((ch1 | ch2 | ch3 | ch4) < 0) + throw new EOFException(); + return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + ch1); + } + + private static short readShort(DataInputStream stream) throws IOException + { + // For some reason the bytes are in reverse order from stream.readShort() + int ch1 = stream.read(); + int ch2 = stream.read(); + if ((ch1 | ch2) < 0) + throw new EOFException(); + return (short)((ch2 << 8) + ch1); + } + + private static String readString(DataInputStream stream) throws IOException + { + int length = readInt(stream); + char[] string = new char[length]; + for (int i = 0; i < length; i++) + { + string[i] = (char) stream.readByte(); + } + return new String(string); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/Note.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/Note.java new file mode 100644 index 000000000..223d56011 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/Note.java @@ -0,0 +1,26 @@ +package mineplex.core.noteblock; + +/** + * Represents a single note to be played + */ +public class Note +{ + private byte _instrument; + private byte _note; + + public Note(byte instrument, byte note) + { + _instrument = instrument; + _note = note; + } + + public byte getInstrument() + { + return _instrument; + } + + public byte getNote() + { + return _note; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NoteLayer.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NoteLayer.java new file mode 100644 index 000000000..6c83bbab1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NoteLayer.java @@ -0,0 +1,50 @@ +package mineplex.core.noteblock; + +import java.util.HashMap; + +/** + * Represents a layer of notes in Note Block Studio + */ +public class NoteLayer +{ + private HashMap _noteMap; // Notes indexed by ticks + private int _volume; // Volume as a percentage 1-100 + private String _name; + + public NoteLayer() + { + _noteMap = new HashMap(); + _volume = 100; + _name = ""; + } + + public int getVolume() + { + return _volume; + } + + public void setVolume(int volume) + { + _volume = volume; + } + + public String getName() + { + return _name; + } + + public void setName(String name) + { + _name = name; + } + + public void setNote(int ticks, Note note) + { + _noteMap.put(ticks, note); + } + + public Note getNote(int ticks) + { + return _noteMap.get(ticks); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java new file mode 100644 index 000000000..19e48f16d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java @@ -0,0 +1,88 @@ +package mineplex.core.noteblock; + +import org.bukkit.entity.Player; + +import mineplex.core.common.util.UtilServer; + +public class NotePlayer +{ + private final NoteSong _song; + private final long _sleepMs; + private volatile boolean _loop; + private volatile int _tick; + private volatile boolean _finished; + + public NotePlayer(NoteSong song, boolean loop) + { + _song = song; + _sleepMs = (long) (1000 / (song.getTempo() / 100D)); + _loop = loop; + _tick = 0; + _finished = false; + + startThread(); + } + + private void startThread() + { + Thread thread = new Thread(new Runnable() + { + @Override + public void run() + { + long startTime = System.currentTimeMillis(); + while (!_finished) + { + _tick++; + if (_tick > _song.getLength()) + { + if (_loop) + { + _tick = 1; + } + else + { + _finished = true; + return; + } + } + + playTick(_tick); + + try + { + Thread.sleep(_sleepMs); + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + } + } + }); + + thread.start(); + } + + private void playTick(int tick) + { + for (NoteLayer layer : _song.getLayers()) + { + Note note = layer.getNote(tick); + if (note != null) + { + float volume = layer.getVolume() / 100F; + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getEyeLocation(), UtilNote.getInstrumentSound(note.getInstrument()), volume, (float) UtilNote.getPitch(note.getNote() - 33)); + } + } + } + } + + public void cancel() + { + _finished = true; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NoteSong.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NoteSong.java new file mode 100644 index 000000000..ee892552b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NoteSong.java @@ -0,0 +1,57 @@ +package mineplex.core.noteblock; + +import java.util.Collection; +import java.util.HashMap; + +public class NoteSong +{ + // Song Data + private short _length; + private short _height; + private String _name; + private short _tempo; + private byte _timeSignature; + + // Layer Data + private HashMap _layerMap; + + public NoteSong(short length, short height, String name, short tempo, byte timeSignature, HashMap layerMap) + { + _length = length; + _height = height; + _name = name; + _tempo = tempo; + _timeSignature = timeSignature; + _layerMap = layerMap; + } + + public short getLength() + { + return _length; + } + + public short getHeight() + { + return _height; + } + + public String getName() + { + return _name; + } + + public short getTempo() + { + return _tempo; + } + + public byte getTimeSignature() + { + return _timeSignature; + } + + public Collection getLayers() + { + return _layerMap.values(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/UtilNote.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/UtilNote.java new file mode 100644 index 000000000..4ac15643e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/UtilNote.java @@ -0,0 +1,42 @@ +package mineplex.core.noteblock; + +import org.bukkit.Sound; + +/** + * See http://minecraft.gamepedia.com/Note_Block for information about pitches + */ +public class UtilNote +{ + private static final double[] PITCH = { 0.5, 0.53, 0.56, 0.6, 0.63, 0.67, 0.7, 0.76, 0.8, 0.84, 0.9, 0.94, 1.0, + 1.06, 1.12, 1.18, 1.26, 1.34, 1.42, 1.5, 1.6, 1.68, 1.78, 1.88, 2.0 }; + + public static Sound getInstrumentSound(byte instrument) + { + switch (instrument) + { + case 0: + return Sound.NOTE_PIANO; + case 1: + return Sound.NOTE_BASS_GUITAR; + case 2: + return Sound.NOTE_BASS_DRUM; + case 3: + return Sound.NOTE_SNARE_DRUM; + case 4: + return Sound.NOTE_STICKS; + default: + return Sound.NOTE_PIANO; + } + } + + public static double getPitch(int note) + { + if (note >= 0 && note < PITCH.length) + { + return PITCH[note]; + } + + return 0.0; + } + +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 4e16d3376..956cd13cc 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -1,5 +1,6 @@ package mineplex.hub; +import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.HashMap; @@ -34,6 +35,9 @@ import mineplex.core.hologram.HologramManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.message.PrivateMessageEvent; import mineplex.core.mount.MountManager; +import mineplex.core.noteblock.NBSReader; +import mineplex.core.noteblock.NotePlayer; +import mineplex.core.noteblock.NoteSong; import mineplex.core.notifier.NotificationManager; import mineplex.core.npc.NpcManager; import mineplex.core.packethandler.PacketHandler; @@ -219,7 +223,6 @@ public class HubManager extends MiniClientPlugin ((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true; - new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, giveawayManager); // _halloweenManager = new HalloweenSpookinessManager(this); @@ -229,6 +232,20 @@ public class HubManager extends MiniClientPlugin _serverName = getPlugin().getConfig().getString("serverstatus.name"); _serverName = _serverName.substring(0, Math.min(16, _serverName.length())); + +// try +// { +// NoteSong song = NBSReader.loadSong("songs/LetItGo.nbs"); +// if (song != null) +// { +// NotePlayer player = new NotePlayer(song, true); +// } +// } +// catch (FileNotFoundException e) +// { +// e.printStackTrace(); +// System.out.println("FAILED TO LOAD SONG!!"); +// } } @Override From 54ec0e39bb361d8de59f1ac4bc9d3e743ffe93e9 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 7 Dec 2015 13:25:32 +1100 Subject: [PATCH 16/54] more polisshhhh on snowfight enabled xmas chests --- .../nautilus/game/arcade/ArcadeManager.java | 6 +++-- .../games/monsterleague/kits/KitGolem.java | 2 +- .../monsterleague/perks/PerkStoneWall.java | 22 ++++++++++++++----- .../game/games/snowfight/kits/KitMedic.java | 3 ++- .../games/snowfight/kits/KitSportsman.java | 11 ++++++---- .../games/snowfight/kits/KitTactician.java | 13 +++++++++-- .../game/arcade/managers/HolidayManager.java | 9 ++++++-- 7 files changed, 48 insertions(+), 18 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index a29c226fe..8a852224a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -59,6 +59,7 @@ import mineplex.core.status.ServerStatusManager; import mineplex.core.task.TaskManager; import mineplex.core.teleport.Teleport; import mineplex.core.timing.TimingManager; +import mineplex.core.titangiveaway.TitanGiveawayManager; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.classcombat.Class.ClassManager; import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager; @@ -101,6 +102,7 @@ import nautilus.game.arcade.managers.GameSpectatorManager; import nautilus.game.arcade.managers.GameStatManager; import nautilus.game.arcade.managers.GameTournamentManager; import nautilus.game.arcade.managers.GameWorldManager; +import nautilus.game.arcade.managers.HolidayManager; import nautilus.game.arcade.managers.IdleManager; import nautilus.game.arcade.managers.MiscManager; import nautilus.game.arcade.shop.ArcadeShop; @@ -298,8 +300,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation new MiscManager(this); _hologramManager = hologramManager; _idleManager = new IdleManager(this); - //TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); - //new HolidayManager(this, titanGiveaway); + TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); + new HolidayManager(this, titanGiveaway); // Game Addons new CompassAddon(plugin, this); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitGolem.java index 9427e6ef2..2024c10bd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitGolem.java @@ -29,7 +29,7 @@ public class KitGolem extends LeagueKit new Perk[] { new PerkDoubleJump("Double Jump", 0.8, 0.8, true), - new PerkStoneWall(), + new PerkStoneWall("Iron Wall", Material.IRON_BLOCK, Material.IRON_INGOT), new PerkSlow(0) }, EntityType.IRON_GOLEM, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkStoneWall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkStoneWall.java index 90a678c6a..8cf307488 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkStoneWall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkStoneWall.java @@ -20,7 +20,9 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -29,14 +31,19 @@ import nautilus.game.arcade.kit.perks.data.IcePathData; public class PerkStoneWall extends Perk { - private HashSet _data = new HashSet(); + private Material _type; + private Material _itemInHand; - public PerkStoneWall() + public PerkStoneWall(String name, Material block, Material itemInHand) { - super("Iron Wall", new String[] + super(name, new String[] { - C.cYellow + "Click" + C.cGray + " to use " + C.cGreen + "Iron Wall" + C.cYellow + "Click" + C.cGray + " with " + ItemStackFactory.Instance.GetName(itemInHand, (byte)0, false) + " to use " + C.cGreen + name }); + + _type = block; + + _itemInHand = itemInHand; } @EventHandler @@ -49,6 +56,9 @@ public class PerkStoneWall extends Perk event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) return; + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), _itemInHand)) + return; + if (UtilBlock.usable(event.getClickedBlock())) return; @@ -98,9 +108,9 @@ public class PerkStoneWall extends Perk loc.add(UtilAlg.getLeft(dir).multiply(i)); loc.add(UtilAlg.getUp(dir).multiply(j)); - Manager.GetBlockRestore().add(loc.getBlock(), Material.IRON_BLOCK.getId(), (byte)0, 4000); + Manager.GetBlockRestore().add(loc.getBlock(), _type.getId(), (byte)0, 4000); - loc.getWorld().playEffect(loc, Effect.STEP_SOUND, Material.IRON_BLOCK); + loc.getWorld().playEffect(loc, Effect.STEP_SOUND, _type); } player.getWorld().playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 2f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java index 3cb7b3b13..2bfc12179 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java @@ -5,6 +5,7 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.AbbreviatedKit; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; @@ -19,7 +20,7 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.potion.Potion; import org.bukkit.potion.PotionType; -public class KitMedic extends Kit +public class KitMedic extends AbbreviatedKit { public KitMedic(ArcadeManager manager) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java index ddc84535f..e0aa1ed95 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java @@ -16,15 +16,17 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.AbbreviatedKit; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkFallDamage; +import nautilus.game.arcade.kit.perks.PerkSpeed; -public class KitSportsman extends Kit +public class KitSportsman extends AbbreviatedKit { - + public KitSportsman(ArcadeManager manager) { super(manager, "Sportsman", KitAvailability.Free, @@ -37,8 +39,9 @@ public class KitSportsman extends Kit new Perk[] { - new PerkDoubleJump("Snow Jump", 1, 0.8, true, 8000, true), - new PerkFallDamage(-2), + new PerkSpeed(0), + new PerkFallDamage(-2), + new PerkDoubleJump("Snow Jump", 1, 0.8, true, 8000, true), }, EntityType.SKELETON, new ItemStack(Material.SNOW_BALL)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java index 1395c2add..8452ae106 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java @@ -1,7 +1,11 @@ package nautilus.game.arcade.game.games.snowfight.kits; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.monsterleague.perks.PerkStoneWall; +import nautilus.game.arcade.kit.AbbreviatedKit; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; @@ -12,9 +16,13 @@ import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.potion.Potion; +import org.bukkit.potion.PotionType; -public class KitTactician extends Kit +public class KitTactician extends AbbreviatedKit { public KitTactician(ArcadeManager manager) @@ -26,8 +34,8 @@ public class KitTactician extends Kit }, new Perk[] { - new PerkConstructor("Constructor", 16, 2, Material.FENCE, "Barrier", true), new PerkIronSkin(0.25), + new PerkStoneWall("Ice Wall", Material.ICE, Material.CLAY_BALL), }, EntityType.SKELETON, new ItemStack(Material.FENCE)); @@ -37,6 +45,7 @@ public class KitTactician extends Kit @Override public void GiveItems(Player player) { + player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.CLAY_BALL, (byte)0, 1, "Ice Wall")); player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index 570ea9ea3..109128ad4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -83,8 +83,8 @@ public class HolidayManager implements Listener } } - private HolidayType type = HolidayType.Halloween; - private String _statName = "Halloween Pumpkins 2015"; + private HolidayType type = HolidayType.Christmas; + private String _statName = "Christmas Presents 2015"; ArcadeManager Manager; private TitanGiveawayManager _titanManager; @@ -173,6 +173,11 @@ public class HolidayManager implements Listener sendChestPackets(block); } } + else if (type == HolidayType.Christmas) + { + UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, block.getLocation().add(0.5, 0.2, 0.5), 0.3f, 0.2f, 0.3f, 0, 1, + ViewDist.LONG, UtilServer.getPlayers()); + } } } From 5486d8acf62609697c619b0ee32884162122a9c2 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 7 Dec 2015 13:42:59 +1100 Subject: [PATCH 17/54] more prep --- .../monsterleague/perks/PerkStoneWall.java | 2 +- .../arcade/game/games/snowfight/SnowFight.java | 2 ++ .../game/games/snowfight/kits/KitMedic.java | 18 ++++++++++++++---- .../games/snowfight/kits/KitSportsman.java | 12 +++++++----- .../games/snowfight/kits/KitTactician.java | 17 +++++++---------- .../game/arcade/managers/HolidayManager.java | 4 ++-- 6 files changed, 33 insertions(+), 22 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkStoneWall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkStoneWall.java index 8cf307488..72f78fd0c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkStoneWall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkStoneWall.java @@ -67,7 +67,7 @@ public class PerkStoneWall extends Perk if (!Kit.HasKit(player)) return; - if (!Recharge.Instance.use(player, GetName(), 24000, true, true)) + if (!Recharge.Instance.use(player, GetName(), 20000, true, true)) return; Recharge.Instance.setDisplayForce(player, GetName(), true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java index f262a2c7c..1b9592fe7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java @@ -178,6 +178,8 @@ public class SnowFight extends TeamGame @EventHandler public void BlockDamage(BlockDamageEvent event) { + System.out.println("DING"); + Player player = event.getPlayer(); if (!InProgress()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java index 2bfc12179..def43a186 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java @@ -9,6 +9,7 @@ import nautilus.game.arcade.kit.AbbreviatedKit; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import net.md_5.bungee.api.ChatColor; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -30,6 +31,7 @@ public class KitMedic extends AbbreviatedKit new String[] { "Throw warmth potions to heal allies!", + ChatColor.RESET + " ", C.cGray + "Receive 1 Warmth Potion every 16 seconds. Maximum of 1.", }, @@ -47,10 +49,18 @@ public class KitMedic extends AbbreviatedKit @Override public void GiveItems(Player player) { - player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); - player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); - player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); - player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); + Potion potion = new Potion(PotionType.INSTANT_HEAL); + potion.setSplash(true); + ItemStack stack = potion.toItemStack(1); + ItemMeta meta = stack.getItemMeta(); + meta.setDisplayName(ChatColor.RESET + "Warmth Potion"); + stack.setItemMeta(meta); + + player.getInventory().setItem(1, stack); + player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); + player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); + player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java index e0aa1ed95..38f63cd44 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.snowfight.kits; +import org.bukkit.ChatColor; import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -34,6 +35,7 @@ public class KitSportsman extends AbbreviatedKit new String[] { "Trained to be the fastest on snow and ice.", + ChatColor.RESET + " ", }, @@ -41,7 +43,7 @@ public class KitSportsman extends AbbreviatedKit { new PerkSpeed(0), new PerkFallDamage(-2), - new PerkDoubleJump("Snow Jump", 1, 0.8, true, 8000, true), + new PerkDoubleJump("Snow Jump", 1, 0.8, true, 6000, true), }, EntityType.SKELETON, new ItemStack(Material.SNOW_BALL)); @@ -51,10 +53,10 @@ public class KitSportsman extends AbbreviatedKit @Override public void GiveItems(Player player) { - player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); - player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); - player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); - player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); + player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); + player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); + player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java index 8452ae106..a205eed7f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java @@ -12,15 +12,12 @@ import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkConstructor; import nautilus.game.arcade.kit.perks.PerkIronSkin; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.potion.Potion; -import org.bukkit.potion.PotionType; public class KitTactician extends AbbreviatedKit { @@ -31,10 +28,10 @@ public class KitTactician extends AbbreviatedKit new String[] { "No Snowfight is complete without a tactical game!", + ChatColor.RESET + " ", }, new Perk[] { - new PerkIronSkin(0.25), new PerkStoneWall("Ice Wall", Material.ICE, Material.CLAY_BALL), }, EntityType.SKELETON, @@ -45,11 +42,11 @@ public class KitTactician extends AbbreviatedKit @Override public void GiveItems(Player player) { - player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.CLAY_BALL, (byte)0, 1, "Ice Wall")); - player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); - player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); - player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); - player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, "Hearty Winter Stew")); + player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.CLAY_BALL, (byte)0, 1, ChatColor.RESET + "Ice Wall")); + player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); + player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); + player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); player.getInventory().setItem(7, ItemStackFactory.Instance.CreateStack(Material.COMPASS.getId(), (byte) 0, 1, "§a§lTracking Compass")); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index 109128ad4..cf3bbf215 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -52,7 +52,7 @@ public class HolidayManager implements Listener { public enum HolidayType { - Christmas(Material.CHEST, "Present", Sound.LEVEL_UP), + Christmas(Material.CHEST, "Present", Sound.CAT_MEOW), Halloween(Material.PUMPKIN, "Pumpkin", Sound.ZOMBIE_REMEDY), Easter(Material.CHEST, "Egg Basket", Sound.CAT_MEOW); @@ -175,7 +175,7 @@ public class HolidayManager implements Listener } else if (type == HolidayType.Christmas) { - UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, block.getLocation().add(0.5, 0.2, 0.5), 0.3f, 0.2f, 0.3f, 0, 1, + UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, block.getLocation().add(0.5, 1, 0.5), 0.5f, 0.5f, 0.5f, 0, 3, ViewDist.LONG, UtilServer.getPlayers()); } } From 7b5db2d4fbe21295f37c8a5c7868b383ad70ec7d Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 7 Dec 2015 00:58:44 -0500 Subject: [PATCH 18/54] Hub Music, HubMusic Preference --- .../core/noteblock/INoteVerifier.java | 10 +++ .../mineplex/core/noteblock/NotePlayer.java | 40 +++++++++- .../core/noteblock/event/SongFinishEvent.java | 25 +++++++ .../core/noteblock/event/SongStartEvent.java | 25 +++++++ .../core/preferences/PreferencesManager.java | 2 +- .../preferences/PreferencesRepository.java | 9 ++- .../core/preferences/UserPreferences.java | 1 + .../core/preferences/ui/PreferencesPage.java | 25 ++++++- .../src/mineplex/hub/HubManager.java | 75 +++++++++++++++---- 9 files changed, 189 insertions(+), 23 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/noteblock/INoteVerifier.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/noteblock/event/SongFinishEvent.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/noteblock/event/SongStartEvent.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/INoteVerifier.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/INoteVerifier.java new file mode 100644 index 000000000..f423c6394 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/INoteVerifier.java @@ -0,0 +1,10 @@ +package mineplex.core.noteblock; + +import org.bukkit.entity.Player; + +public interface INoteVerifier +{ + + public boolean shouldPlay(Player player); + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java index 19e48f16d..941bc1dd9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java @@ -1,26 +1,41 @@ package mineplex.core.noteblock; +import java.util.ArrayList; +import java.util.List; + import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.common.util.UtilServer; +import mineplex.core.noteblock.event.SongFinishEvent; +import mineplex.core.noteblock.event.SongStartEvent; public class NotePlayer { + private final JavaPlugin _plugin; private final NoteSong _song; + private final INoteVerifier _verifier; private final long _sleepMs; + private volatile float _volumeMult; private volatile boolean _loop; private volatile int _tick; private volatile boolean _finished; - public NotePlayer(NoteSong song, boolean loop) + public NotePlayer(JavaPlugin plugin, NoteSong song, INoteVerifier verifier, float volumeMult, boolean loop) { + _plugin = plugin; _song = song; + _verifier = verifier; _sleepMs = (long) (1000 / (song.getTempo() / 100D)); _loop = loop; _tick = 0; + _volumeMult = volumeMult; _finished = false; startThread(); + + SongStartEvent event = new SongStartEvent(_song); + _plugin.getServer().getPluginManager().callEvent(event); } private void startThread() @@ -43,6 +58,17 @@ public class NotePlayer else { _finished = true; + + _plugin.getServer().getScheduler().runTask(_plugin, new Runnable() + { + @Override + public void run() + { + SongFinishEvent event = new SongFinishEvent(_song); + _plugin.getServer().getPluginManager().callEvent(event); + } + }); + return; } } @@ -66,13 +92,21 @@ public class NotePlayer private void playTick(int tick) { + Player[] playerArray = UtilServer.getPlayers(); + List players = new ArrayList<>(playerArray.length); + for (Player player : playerArray) + { + if (_verifier.shouldPlay(player)) + players.add(player); + } + for (NoteLayer layer : _song.getLayers()) { Note note = layer.getNote(tick); if (note != null) { - float volume = layer.getVolume() / 100F; - for (Player player : UtilServer.getPlayers()) + float volume = _volumeMult * (layer.getVolume() / 100F); + for (Player player : players) { player.playSound(player.getEyeLocation(), UtilNote.getInstrumentSound(note.getInstrument()), volume, (float) UtilNote.getPitch(note.getNote() - 33)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/event/SongFinishEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/event/SongFinishEvent.java new file mode 100644 index 000000000..863537903 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/event/SongFinishEvent.java @@ -0,0 +1,25 @@ +package mineplex.core.noteblock.event; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.core.noteblock.NoteSong; + +public class SongFinishEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + public static HandlerList getHandlerList() { return handlers; } + public HandlerList getHandlers() { return handlers; } + + private NoteSong _song; + + public SongFinishEvent(NoteSong song) + { + _song = song; + } + + public NoteSong getSong() + { + return _song; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/event/SongStartEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/event/SongStartEvent.java new file mode 100644 index 000000000..00993f7c8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/event/SongStartEvent.java @@ -0,0 +1,25 @@ +package mineplex.core.noteblock.event; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.core.noteblock.NoteSong; + +public class SongStartEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + public static HandlerList getHandlerList() { return handlers; } + public HandlerList getHandlers() { return handlers; } + + private NoteSong _song; + + public SongStartEvent(NoteSong song) + { + _song = song; + } + + public NoteSong getSong() + { + return _song; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java index 82eec02d1..23d067d8f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java @@ -136,6 +136,6 @@ public class PreferencesManager extends MiniDbClientPlugin @Override public String getQuery(int accountId, String uuid, String name) { - return "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield, showMacReports, ignoreVelocity, pendingFriendRequests, friendDisplayInventoryUI, clanTips FROM accountPreferences WHERE accountPreferences.uuid = '" + uuid + "' LIMIT 1;"; + return "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield, showMacReports, ignoreVelocity, pendingFriendRequests, friendDisplayInventoryUI, clanTips, hubMusic FROM accountPreferences WHERE accountPreferences.uuid = '" + uuid + "' LIMIT 1;"; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java index 7449c83c9..895555da6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java @@ -24,7 +24,7 @@ public class PreferencesRepository extends RepositoryBase // DEFAULT 0, showMacReports BOOL NOT NULL DEFAULT 0, ignoreVelocity BOOL // NOT NULL DEFAULT 0, PRIMARY KEY (id), UNIQUE INDEX uuid_index (uuid));"; private static String INSERT_ACCOUNT = "INSERT INTO accountPreferences (uuid) VALUES (?) ON DUPLICATE KEY UPDATE uuid=uuid;"; - private static String UPDATE_ACCOUNT_PREFERENCES = "UPDATE accountPreferences SET games = ?, visibility = ?, showChat = ?, friendChat = ?, privateMessaging = ?, partyRequests = ?, invisibility = ?, forcefield = ?, showMacReports = ?, ignoreVelocity = ?, pendingFriendRequests = ?, friendDisplayInventoryUI = ?, clanTips = ? WHERE uuid=?;"; + private static String UPDATE_ACCOUNT_PREFERENCES = "UPDATE accountPreferences SET games = ?, visibility = ?, showChat = ?, friendChat = ?, privateMessaging = ?, partyRequests = ?, invisibility = ?, forcefield = ?, showMacReports = ?, ignoreVelocity = ?, pendingFriendRequests = ?, friendDisplayInventoryUI = ?, clanTips = ?, hubMusic = ? WHERE uuid=?;"; public PreferencesRepository(JavaPlugin plugin) { @@ -61,8 +61,9 @@ public class PreferencesRepository extends RepositoryBase preparedStatement.setBoolean(11, entry.getValue().PendingFriendRequests); preparedStatement.setBoolean(12, entry.getValue().friendDisplayInventoryUI); preparedStatement.setBoolean(13, entry.getValue().ClanTips); + preparedStatement.setBoolean(14, entry.getValue().HubMusic); System.out.println(">> " + entry.getValue().ClanTips); - preparedStatement.setString(14, entry.getKey()); + preparedStatement.setString(15, entry.getKey()); preparedStatement.addBatch(); } @@ -89,8 +90,9 @@ public class PreferencesRepository extends RepositoryBase preparedStatement.setBoolean(11, entry.getValue().PendingFriendRequests); preparedStatement.setBoolean(12, entry.getValue().friendDisplayInventoryUI); preparedStatement.setBoolean(13, entry.getValue().ClanTips); + preparedStatement.setBoolean(14, entry.getValue().HubMusic); System.out.println(">> " + entry.getValue().ClanTips); - preparedStatement.setString(14, entry.getKey()); + preparedStatement.setString(15, entry.getKey()); preparedStatement.execute(); } @@ -122,6 +124,7 @@ public class PreferencesRepository extends RepositoryBase preferences.PendingFriendRequests = resultSet.getBoolean(11); preferences.friendDisplayInventoryUI = resultSet.getBoolean(12); preferences.ClanTips = resultSet.getBoolean(13); + preferences.HubMusic = resultSet.getBoolean(14); System.out.println("<< " + resultSet.getBoolean(13)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/UserPreferences.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/UserPreferences.java index 728f549e2..4036b494f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/UserPreferences.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/UserPreferences.java @@ -16,4 +16,5 @@ public class UserPreferences public boolean PendingFriendRequests = true; public boolean friendDisplayInventoryUI = true; public boolean ClanTips = true; + public volatile boolean HubMusic = true; } 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 7cd111100..27e20e3d6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java @@ -25,6 +25,7 @@ public class PreferencesPage extends ShopPageBase private HashMap> _creativeAdmin = new HashMap>(); + // Christmas Songs + private Random _random = new Random(); + private int _lastSong = 0; + private final String[] _songNames = {"JingleBells.nbs", "TheFirstNoel.nbs", "Hark.nbs", "DeckTheHalls.nbs", "Joy.nbs", "MerryChristmas.nbs"}; + private final NoteSong[] _songs; + public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager, GiveawayManager giveawayManager) { super("Hub Manager", plugin); @@ -230,22 +241,44 @@ public class HubManager extends MiniClientPlugin // NotificationManager notificationManager = new NotificationManager(plugin, clientManager, donationManager); // new MailManager(_plugin, notificationManager); + _songs = new NoteSong[_songNames.length]; + try + { + for (int i = 0; i < _songNames.length; i++) + { + String name = "songs/" + _songNames[i]; + NoteSong song = NBSReader.loadSong(name); + _songs[i] = song; + System.out.println("Loaded Song: " + name); + } + } + catch (FileNotFoundException e) + { + e.printStackTrace(); + System.out.println("FAILED TO LOAD SONG!!"); + } + + playNextSong(); + _serverName = getPlugin().getConfig().getString("serverstatus.name"); _serverName = _serverName.substring(0, Math.min(16, _serverName.length())); + } -// try -// { -// NoteSong song = NBSReader.loadSong("songs/LetItGo.nbs"); -// if (song != null) -// { -// NotePlayer player = new NotePlayer(song, true); -// } -// } -// catch (FileNotFoundException e) -// { -// e.printStackTrace(); -// System.out.println("FAILED TO LOAD SONG!!"); -// } + private void playNextSong() + { + int index = (_lastSong + _random.nextInt(_songs.length - 1)) % _songs.length; + NoteSong song = _songs[index]; + if (song != null) + { + new NotePlayer(_plugin, song, new INoteVerifier() + { + @Override + public boolean shouldPlay(Player player) + { + return _preferences.Get(player).HubMusic; + } + }, 0.5F, false); + } } @Override @@ -944,4 +977,20 @@ public class HubManager extends MiniClientPlugin new GUIProfile(getPlugin(), event.getPlayer(), _preferences, _achievementManager, _personalServerManager).openInventory();; } + + @EventHandler + public void disableMusicChristmas(GadgetActivateEvent event) + { + if (event.getGadget() != null && event.getGadget().getGadgetType() == GadgetType.MusicDisc) + { + UtilPlayer.message(event.getPlayer(), F.main("Hub", "Music Discs are disabled right now")); + event.setCancelled(true); + } + } + + @EventHandler + public void onSongFinish(SongFinishEvent event) + { + playNextSong(); + } } From 1ada06af91f4a072ba026051e0b36e4f6c45d0a7 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 7 Dec 2015 17:36:45 +1100 Subject: [PATCH 19/54] rewrote lots! --- .../game/games/snowfight/SnowFight.java | 556 +++++++----------- .../games/snowfight/kits/KitSportsman.java | 1 - .../games/snowfight/kits/KitTactician.java | 3 +- 3 files changed, 214 insertions(+), 346 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java index 1b9592fe7..bd9edcc7e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java @@ -4,10 +4,16 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; +import java.util.Map.Entry; +import java.util.Set; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; @@ -16,6 +22,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilWorld; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.updater.UpdateType; @@ -56,6 +63,7 @@ import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; +import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.scheduler.BukkitRunnable; @@ -64,73 +72,51 @@ import org.bukkit.util.Vector; public class SnowFight extends TeamGame { + private long _meteorTime = 10000; + private boolean _meteors = false; - private HashMap _tiles; - private long _meteorTime = 375000; - private boolean _meteors; - + private HashSet _meteorSet = new HashSet(); + public SnowFight(ArcadeManager manager) { super(manager, GameType.SnowFight, - new Kit[] + new Kit[] { - new KitSportsman(manager), - new KitTactician(manager), - new KitMedic(manager) + new KitSportsman(manager), + new KitTactician(manager), + new KitMedic(manager) }, new String[] { - "Defeat your foes with Snowballs", - "Last team alive wins!" + "Defeat your foes with Snowballs", + "Last team alive wins!" }); this.PrepareFreeze = false; + this.HungerSet = 20; + this.CompassEnabled = true; this.CompassGiveItem = false; + this.TeamArmor = true; this.TeamArmorHotbar = true; - this.BlockPlace = true; - this.BlockBreakAllow = new HashSet<>(Arrays.asList(Material.FENCE.getId())); - this._tiles = new HashMap(); - this._meteors = false; + + this.WorldWeatherEnabled = true; + this.WorldTimeSet = 4000; } - + @EventHandler - public void Weather(UpdateEvent event) + public void weather(UpdateEvent event) { if (event.getType() != UpdateType.SEC) return; - World world = UtilWorld.getWorldType(Environment.NORMAL); - - if (world == null) - return; - - world.setStorm(true); - world.setThundering(false); - world.setWeatherDuration(40); - world.setTime(4000); - } - - @EventHandler - public void IceDamage(UpdateEvent event) { - if(event.getType() != UpdateType.FAST) - return; - - if(!IsLive()) - return; - - for(Player player : GetPlayers(true)) - { - if(IsOnIce(player)) - { - Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, null, DamageCause.CUSTOM, 2.0D, false, true, true, "Ice", "Ice", false)); - } - } - + WorldData.World.setStorm(true); + WorldData.World.setThundering(false); + WorldData.World.setWeatherDuration(10); } @EventHandler @@ -138,185 +124,56 @@ public class SnowFight extends TeamGame { if (event.GetState() == GameState.Prepare) { - UtilTextMiddle.display(C.cGreen + "Prepare", "Collect Snowballs!", 0, 240, 20, UtilServer.getPlayers()); + UtilTextMiddle.display(C.cGreen + "Prepare", "Collect Snowballs!", 0, 60, 20, UtilServer.getPlayers()); } if (event.GetState() == GameState.Live) { for(Player player : GetPlayers(false)) player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F); - + UtilTextMiddle.display(C.cRed + "FIGHT", "", 0, 40, 20, UtilServer.getPlayers()); } } - - @EventHandler - public void Meteor(UpdateEvent event) - { - if(event.getType() != UpdateType.FAST) - return; - - if (!IsLive()) - return; - - if(System.currentTimeMillis() <= getGameLiveTime() + _meteorTime) - return; - - if(!_meteors) - { - for(Player player : GetPlayers(false)) - { - player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F); - UtilTextMiddle.display(C.cAqua + C.Bold + "Ice Meteors", "Avoid the Ice Fields!", player); - } - - _meteors = true; - } - - makeMeteor(); - } @EventHandler - public void BlockDamage(BlockDamageEvent event) + public void blockDamage(PlayerInteractEvent event) { - System.out.println("DING"); - Player player = event.getPlayer(); if (!InProgress()) return; - if (!IsPlaying(player)) + if (!UtilEvent.isAction(event, ActionType.L_BLOCK)) return; - if (!IsSnow(event.getBlock())) + if (!IsPlaying(player) || !IsAlive(player)) + return; + + if (!isSnow(event.getClickedBlock())) return; if (UtilInv.contains(player, Material.SNOW_BALL, (byte) 0, 16)) return; - // Item -// -// if (!_tiles.containsKey(player)) -// { -// _tiles.put(player, 0); -// } -// -// if (GetKit(player) instanceof KitSportsman) -// UtilInv.insert(player, new ItemStack(Material.SNOW_BALL)); -// -// -// int tiles = _tiles.get(player); -// _tiles.put(player, tiles + 1); -// -// if (!(GetKit(player) instanceof KitSportsman)) -// { -// if (_tiles.get(player) == 2) -// { -// UtilInv.insert(player, new ItemStack(Material.SNOW_BALL)); -// _tiles.put(player, 0); -// } -// } - UtilInv.insert(player, new ItemStack(Material.SNOW_BALL)); // Snow Height - SnowDecrease(event.getBlock(), 1); + snowDecrease(event.getClickedBlock(), 1); // Effect - event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, 80); + event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, 80); } - // @EventHandler - // public void InteractSnowball(PlayerInteractEvent event) - // { - // Player player = event.getPlayer(); - // - // if (!IsLive()) - // return; - // - // if (!IsPlaying(player)) - // return; - // - // if (!UtilGear.isMat(player.getItemInHand(), Material.SNOW_BALL)) - // return; - // - // event.setCancelled(true); - // - // if (UtilEvent.isAction(event, ActionType.L)) - // SnowballThrow(player); - // - // else if (UtilEvent.isAction(event, ActionType.R_BLOCK)) - // SnowballPlace(player, event.getClickedBlock(), 1); - // } - // - // private void SnowballPlace(Player player, Block block, int above) - // { - // if (block.getTypeId() == 78 || UtilBlock.airFoliage(block)) - // { - // //Build - // if (block.getTypeId() == 78) - // { - // block.setTypeIdAndData(78, (byte)(block.getData() + 1), true); - // - // if (block.getData() >= 7) - // block.setTypeIdAndData(80, (byte)0, true); - // } - // else - // { - // block.setTypeIdAndData(78, (byte)0, true); - // } - // - // //Sound - // block.getWorld().playSound(block.getLocation(), Sound.STEP_SNOW, 1f, - // 0.6f); - // - // //Use Snow - // SnowballCount(player, -1); - // } - // else if ((IsSnow(block) || UtilBlock.solid(block)) && above > 0) - // { - // SnowballPlace(player, block.getRelative(BlockFace.UP), above - 1); - // } - // } - // - // private void SnowballThrow(Player player) - // { - // //Throw - // player.launchProjectile(Snowball.class); - // - // //Use Snow - // SnowballCount(player, -1); - // - // //Sound - // player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 3f, - // 1.5f); - // } - - // private void SnowballCount(Player player, int count) - // { - // if (player.getInventory().getItem(1) != null) - // count += player.getInventory().getItem(1).getAmount(); - // - // if (count > 16) - // count = 16; - // - // if (count > 0) - // player.getInventory().setItem(1, - // ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL, count)); - // else - // player.getInventory().setItem(1, null); - // } - - private void SnowDecrease(Block block, int height) + private void snowDecrease(Block block, int height) { if (height <= 0) return; - if (!IsSnow(block)) + if (!isSnow(block)) return; // Shuffle Up - while (IsSnow(block.getRelative(BlockFace.UP))) + while (isSnow(block.getRelative(BlockFace.UP))) block = block.getRelative(BlockFace.UP); // Snow Block @@ -328,32 +185,32 @@ public class SnowFight extends TeamGame if (height >= snowLevel) { block.setTypeIdAndData(0, (byte) 0, false); - SnowDecrease(block.getRelative(BlockFace.DOWN), height - snowLevel); + snowDecrease(block.getRelative(BlockFace.DOWN), height - snowLevel); } else { block.setTypeIdAndData(78, (byte) (snowLevel - height - 1), false); } } - + @EventHandler - public void HealthRegen(EntityRegainHealthEvent event) + public void healthRegen(EntityRegainHealthEvent event) { if(event.getRegainReason() == RegainReason.SATIATED) { event.setAmount(1); } } - + @EventHandler(priority = EventPriority.HIGH) - public void GenerallDamage(CustomDamageEvent event) + public void generallDamage(CustomDamageEvent event) { if(event.GetCause() == DamageCause.ENTITY_ATTACK) event.SetCancelled("No Melee"); } - @EventHandler(priority = EventPriority.HIGH) - public void SnowballEggDamage(CustomDamageEvent event) + @EventHandler(priority = EventPriority.NORMAL) + public void snowballEggDamage(CustomDamageEvent event) { if (event.IsCancelled()) return; @@ -364,13 +221,13 @@ public class SnowFight extends TeamGame Projectile proj = event.GetProjectile(); if (proj == null) return; - + if(proj instanceof Fireball) return; - + if(proj instanceof Snowball) event.AddMod("Snowball", "Snowball", 2, true); - + event.SetIgnoreRate(true); event.SetIgnoreArmor(true); @@ -379,157 +236,32 @@ public class SnowFight extends TeamGame ((Player) proj.getShooter()).playSound(((Player) proj.getShooter()).getLocation(), Sound.SUCCESSFUL_HIT, 1, 1); } - private boolean IsSnow(Block block) + private boolean isSnow(Block block) { return block.getTypeId() == 78 || block.getTypeId() == 80; } - - private boolean IsOnIce(Player player) + + private boolean isOnIce(Player player) { - return player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.ICE; - } - - - private void makeMeteor() - { - - Location loc = getEndgameLocation(); - - if (loc == null) - { - return; - } - - summonMeteor(loc, 20F); - + return player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.PACKED_ICE; } - private void summonMeteor(Location loc, float fireballSize) + private Location getMeteorTargetLocation() { - Vector vector = new Vector(UtilMath.random.nextDouble() - 0.5D, 0.8, UtilMath.random.nextDouble() - 0.5D).normalize(); - - vector.multiply(40); - - loc.add((UtilMath.random.nextDouble() - 0.5) * 7, 0, (UtilMath.random.nextDouble() - 0.5) * 7); - - loc.add(vector); - - final FallingBlock fallingblock = loc.getWorld().spawnFallingBlock(loc, Material.ICE, (byte) 0); - - fallingblock.setMetadata("Meteor", new FixedMetadataValue(getArcadeManager().getPlugin(), fireballSize)); - - new BukkitRunnable() - { - int i; - - public void run() - { - if (fallingblock.isValid() && IsLive()) - { - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, fallingblock.getLocation(), 0.3F, 0.3F, 0.3F, 0, 3, - ViewDist.MAX, UtilServer.getPlayers()); - - if (i++ % 6 == 0) - { - fallingblock.getWorld().playSound(fallingblock.getLocation(), Sound.CAT_HISS, 0.7F, 0F); - } - } - else - { - cancel(); - } - } - }.runTaskTimer(getArcadeManager().getPlugin(), 0, 0); - - vector.normalize().multiply(-(0.04 + ((0.5 - 0.05) / 2))); - fallingblock.setFireTicks(9999); - } - - @EventHandler - public void MeteorHit(EntityChangeBlockEvent event) - { - Entity projectile = event.getEntity(); - - float size = 2.5F; - double damage = 2.5D; - - for(int i = 1; i <= 10; i++) - { - if(System.currentTimeMillis() >= getGameLiveTime() + (((30 * i) + 180) * 1000)) - { - size = 2.5F * i; - damage = 2.5D * i; - } - } - - if (projectile.hasMetadata("Meteor")) - { - - CustomExplosion explosion = new CustomExplosion(getArcadeManager().GetDamage(), getArcadeManager().GetExplosion(), - projectile.getLocation(), size, "Meteor"); - - explosion.setBlockExplosionSize(size); - explosion.setFallingBlockExplosion(false); - explosion.setDropItems(false); - explosion.setBlocksDamagedEqually(true); - - //Effect - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, projectile.getLocation(), 0.5f, 0.5f, 0.5f, 0, 5, ViewDist.MAX, UtilServer.getPlayers()); - for(Player player : UtilServer.getPlayers()) - player.playSound(projectile.getLocation(), Sound.EXPLODE, 1, 1); - - - boolean fall = true; - - for(Entity player : projectile.getNearbyEntities(size, size, size)) - { - if(player instanceof Player) - { - Player damagee = (Player) player; - Bukkit.getPluginManager().callEvent(new CustomDamageEvent(damagee, null, null, null, DamageCause.CUSTOM, damage, false, true, true, "Ice Meteor", "Ice Meteor", false)); - } - } - - for(Block block : UtilBlock.getInRadius(event.getEntity().getLocation(), size).keySet()) - { - if(block.getType() != Material.AIR) - { - block.setType(Material.ICE); - - if(block.getRelative(BlockFace.DOWN).getType() == Material.AIR) - { - // to reduce lag - if(fall) - { - block.getWorld().spawnFallingBlock(block.getLocation(), block.getType(), block.getData()); - fall = false; - } - else - { - fall = true; - } - block.setType(Material.AIR); - } - } - } - - } - } - - private Location getEndgameLocation() - { - int chance = UtilMath.r(50) + 3; - int accuracy = Math.max((int) (chance - (0.0001 * chance)), 1); - ArrayList players = GetPlayers(true); + //50 attempts, otherwise skip for (int a = 0; a < 50; a++) { - Player player = players.get(UtilMath.r(players.size())); + Player player = UtilAlg.Random(players); - Location location = player.getLocation().add(UtilMath.r(accuracy * 2) - accuracy, 0, - UtilMath.r(accuracy * 2) - accuracy); + //random offset to player location + Location location = player.getLocation().add( + (Math.random() - 0.5) * 32, + 0, + (Math.random() - 0.5) * 32); + //highest block! location = WorldData.World.getHighestBlockAt(location).getLocation().add(0.5, 0, 0.5); if (location.getBlock().getType() == Material.AIR) @@ -539,6 +271,8 @@ public class SnowFight extends TeamGame if (location.getBlockY() > 0 && location.getBlock().getType() != Material.AIR) { + location.setY(player.getLocation().getY() + 80); + return location; } } @@ -547,24 +281,160 @@ public class SnowFight extends TeamGame } @EventHandler - public void Place(BlockPlaceEvent event) + public void meteorSpawn(UpdateEvent event) { - if(event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.ICE - || event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.PACKED_ICE - || event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.FENCE) + if(event.getType() != UpdateType.FAST) + return; + + if (!IsLive()) + return; + + if(System.currentTimeMillis() <= getGameLiveTime() + _meteorTime) + return; + + //Announce + if(!_meteors) { - UtilPlayer.message(event.getPlayer(), F.main("Game", "You cant place a Barrier here!")); - event.setCancelled(true); + for(Player player : GetPlayers(false)) + { + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F); + UtilTextMiddle.display(C.cAqua + C.Bold + "Ice Meteors", "Avoid the Ice Fields!", player); + } + + _meteors = true; + } + + //Spawn Meteor + Location loc = getMeteorTargetLocation(); + + if (loc == null) + return; + + FallingBlock fallingblock = loc.getWorld().spawnFallingBlock(loc, Material.ICE, (byte) 0); + + fallingblock.setMetadata("Meteor", new FixedMetadataValue(getArcadeManager().getPlugin(), 20f)); + + _meteorSet.add(fallingblock); + } + + @EventHandler + public void meteorUpdate(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) + return; + + if(!IsLive()) + return; + + Iterator blockIter = _meteorSet.iterator(); + + while (blockIter.hasNext()) + { + FallingBlock block = blockIter.next(); + + if (block.isValid()) + { + //Particle + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, block.getLocation(), 0.3F, 0.3F, 0.3F, 0, 3, + ViewDist.MAX, UtilServer.getPlayers()); + + //Sound + if (block.getTicksLived() % 6 == 0) + block.getWorld().playSound(block.getLocation(), Sound.CAT_HISS, 0.5F, 0F); + } + //Clean + else + { + block.remove(); + blockIter.remove(); + } } } - + + @EventHandler + public void meteorHit(EntityChangeBlockEvent event) + { + event.setCancelled(true); + + Entity projectile = event.getEntity(); + + float timePassed = (System.currentTimeMillis() - (getGameLiveTime() + _meteorTime))/1000f; + + float multiplier = 1 + Math.min(3f, timePassed / 60f); + + float size = 2 + multiplier; + + if (projectile.hasMetadata("Meteor")) + { + //Effect + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, projectile.getLocation(), 0.5f, 0.5f, 0.5f, 0, 5, ViewDist.MAX, UtilServer.getPlayers()); + for(Player player : UtilServer.getPlayers()) + player.playSound(projectile.getLocation(), Sound.EXPLODE, 1, 1); + + + //Damage + HashMap players = UtilPlayer.getInRadius(event.getEntity().getLocation(), size + 3); + for (Player player : players.keySet()) + { + //Damage Event + Manager.GetDamage().NewDamageEvent(player, null, null, + DamageCause.CUSTOM, size * players.get(player), false, true, false, + "Ice Meteor", "Ice Meteor", false); + + //Vel + UtilAction.velocity(player, UtilAlg.getTrajectory(event.getEntity(), player), 1.2 * players.get(player), false, 0, 0.4, 1, true); + } + + //Convert to Ice + for(Block block : UtilBlock.getInRadius(event.getEntity().getLocation(), size).keySet()) + { + int i = 5; + while (block.getY() > 0 && i>0) + { + if (block.getType() == Material.LADDER) + block.breakNaturally(); + + //Has air above it + if (UtilBlock.solid(block) && UtilBlock.isVisible(block)) + block.setType(Material.PACKED_ICE); + + //shuffle down + block = block.getRelative(BlockFace.DOWN); + i--; + } + } + } + + projectile.remove(); + } + + + @EventHandler + public void iceDamage(UpdateEvent event) + { + if(event.getType() != UpdateType.FAST) + return; + + if(!IsLive()) + return; + + for(Player player : GetPlayers(true)) + { + //XXX DO BETTER CHECK, hanging off block, ladders, etc. + if(isOnIce(player)) + { + Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, null, DamageCause.CUSTOM, 0.5, false, true, true, "Ice", "Ice", false)); + } + } + } + @Override @EventHandler public void ScoreboardUpdate(UpdateEvent event) { if (event.getType() != UpdateType.FAST) return; - + Scoreboard.Reset(); Scoreboard.WriteBlank(); @@ -574,7 +444,7 @@ public class SnowFight extends TeamGame { if (!team.IsTeamAlive()) continue; - + for(Player player : team.GetPlayers(true)) { Scoreboard.Write(team.GetColor() + player.getName()); @@ -607,7 +477,7 @@ public class SnowFight extends TeamGame Scoreboard.Write(C.cGold + C.Bold + "Meteors!"); } } - + Scoreboard.Draw(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java index 38f63cd44..f678d80dd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java @@ -56,7 +56,6 @@ public class KitSportsman extends AbbreviatedKit player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); - player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java index a205eed7f..3e035afb2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java @@ -35,7 +35,7 @@ public class KitTactician extends AbbreviatedKit new PerkStoneWall("Ice Wall", Material.ICE, Material.CLAY_BALL), }, EntityType.SKELETON, - new ItemStack(Material.FENCE)); + new ItemStack(Material.CLAY_BALL)); } @@ -46,7 +46,6 @@ public class KitTactician extends AbbreviatedKit player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); - player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); player.getInventory().setItem(7, ItemStackFactory.Instance.CreateStack(Material.COMPASS.getId(), (byte) 0, 1, "§a§lTracking Compass")); } From d75d7a2c8fe4971e50ba60571c0793f64b6c0e24 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 7 Dec 2015 17:56:35 +1100 Subject: [PATCH 20/54] snowfight finish --- .../game/games/snowfight/SnowFight.java | 66 ++++++++++++++----- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java index bd9edcc7e..dce28ada5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java @@ -72,7 +72,7 @@ import org.bukkit.util.Vector; public class SnowFight extends TeamGame { - private long _meteorTime = 10000; + private long _meteorTime = 240000; private boolean _meteors = false; private HashSet _meteorSet = new HashSet(); @@ -104,20 +104,20 @@ public class SnowFight extends TeamGame this.TeamArmor = true; this.TeamArmorHotbar = true; - this.WorldWeatherEnabled = true; - this.WorldTimeSet = 4000; +// this.WorldWeatherEnabled = true; +// this.WorldTimeSet = 4000; } - @EventHandler - public void weather(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; - - WorldData.World.setStorm(true); - WorldData.World.setThundering(false); - WorldData.World.setWeatherDuration(10); - } +// @EventHandler +// public void weather(UpdateEvent event) +// { +// if (event.getType() != UpdateType.SEC) +// return; +// +// WorldData.World.setStorm(true); +// WorldData.World.setThundering(false); +// WorldData.World.setWeatherDuration(12); +// } @EventHandler public void battleAnnounce(GameStateChangeEvent event) @@ -243,7 +243,36 @@ public class SnowFight extends TeamGame private boolean isOnIce(Player player) { - return player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.PACKED_ICE; + //Side Standing + double xMod = player.getLocation().getX() % 1; + if (player.getLocation().getX() < 0) + xMod += 1; + + double zMod = player.getLocation().getZ() % 1; + if (player.getLocation().getZ() < 0) + zMod += 1; + + int xMin = 0; + int xMax = 0; + int zMin = 0; + int zMax = 0; + + if (xMod < 0.3) xMin = -1; + if (xMod > 0.7) xMax = 1; + + if (zMod < 0.3) zMin = -1; + if (zMod > 0.7) zMax = 1; + + for (int x=xMin ; x<=xMax ; x++) + { + for (int z=zMin ; z<=zMax ; z++) + { + if (player.getLocation().add(x, -0.5, z).getBlock().getType() == Material.PACKED_ICE) + return true; + } + } + + return false; } private Location getMeteorTargetLocation() @@ -362,7 +391,7 @@ public class SnowFight extends TeamGame float multiplier = 1 + Math.min(3f, timePassed / 60f); - float size = 2 + multiplier; + float size = 1.5f + multiplier; if (projectile.hasMetadata("Meteor")) { @@ -391,8 +420,11 @@ public class SnowFight extends TeamGame int i = 5; while (block.getY() > 0 && i>0) { - if (block.getType() == Material.LADDER) + if (block.getType() == Material.LADDER || + block.getType() == Material.STAINED_GLASS || + block.getType() == Material.STAINED_GLASS_PANE) block.breakNaturally(); + //Has air above it if (UtilBlock.solid(block) && UtilBlock.isVisible(block)) @@ -423,7 +455,7 @@ public class SnowFight extends TeamGame //XXX DO BETTER CHECK, hanging off block, ladders, etc. if(isOnIce(player)) { - Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, null, DamageCause.CUSTOM, 0.5, false, true, true, "Ice", "Ice", false)); + Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, null, DamageCause.CUSTOM, 1, false, true, true, "Ice", "Ice", false)); } } } From 44a5bcb793b35ec568a6c0c0da91bce82fff30cf Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 7 Dec 2015 02:06:00 -0500 Subject: [PATCH 21/54] remove titan chest message, update pumkin message, holiday MB/DMT words --- .../redis/GiveawayMessageHandler.java | 2 +- .../redis/TitanChestGiveawayHandler.java | 4 +- .../game/arcade/game/games/build/Build.java | 70 +++++++++++-------- .../game/arcade/game/games/draw/Draw.java | 25 ++++++- 4 files changed, 69 insertions(+), 32 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/GiveawayMessageHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/GiveawayMessageHandler.java index 93bd6183e..3afc7c3c1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/GiveawayMessageHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/GiveawayMessageHandler.java @@ -32,7 +32,7 @@ public class GiveawayMessageHandler implements CommandCallback String playerName = message.getPlayerName(); int count = message.getTitanCount(); String countString = count + UtilTime.getDayOfMonthSuffix(count); - String chatMessage = C.cRed + playerName + C.cWhite + " found Titan in a " + C.cRed + "Flaming Pumpkin"; + String chatMessage = C.cRed + playerName + C.cWhite + " found Titan in a " + C.cRed + "Christmas Present"; UtilTextMiddle.display(C.cDRed + C.Bold + "TITAN", chatMessage, 20, 80, 20, UtilServer.getPlayers()); World world = UtilServer.getPlayers().length > 0 ? UtilServer.getPlayers()[0].getWorld() : Bukkit.getWorlds().get(0); LightFlicker lightFlicker = new LightFlicker(world); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanChestGiveawayHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanChestGiveawayHandler.java index 65081a2d8..0c99ada73 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanChestGiveawayHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanChestGiveawayHandler.java @@ -16,18 +16,20 @@ public class TitanChestGiveawayHandler implements CommandCallback private ServerStatusManager _statusManager; private long _lastTimer; + private boolean _enabled; public TitanChestGiveawayHandler(ServerStatusManager statusManager) { _statusManager = statusManager; _lastTimer = 0; + _enabled = false; } @Override public void run(ServerCommand command) { - if (command instanceof TitanChestGiveawayMessage) + if (command instanceof TitanChestGiveawayMessage && _enabled) { TitanChestGiveawayMessage chestCommand = ((TitanChestGiveawayMessage) command); if (chestCommand.getServer().equals(_statusManager.getCurrentServerName()) || System.currentTimeMillis() >= _lastTimer + COOLDOWN) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index c2a457899..a066fd174 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -118,6 +118,7 @@ public class Build extends SoloGame private int _countdownTimerState = 0; private String[] _words; + private String[] _holidayWords; private String _word = "?"; @@ -140,20 +141,20 @@ public class Build extends SoloGame private ChatColor _hintColor = ChatColor.YELLOW; private ChatColor _firstHintColor = ChatColor.YELLOW; - public Build(ArcadeManager manager) + public Build(ArcadeManager manager) { super(manager, GameType.Build, new Kit[] { - new KitBuilder(manager), + new KitBuilder(manager), }, - new String[] - { - "Be creative and build something", - "based on the build theme!" - }); + new String[] + { + "Be creative and build something", + "based on the build theme!" + }); this.StrictAntiHack = true; this.Damage = false; @@ -161,7 +162,7 @@ public class Build extends SoloGame this.HealthSet = 20; this.BlockBreak = true; - this.BlockPlace = true; + this.BlockPlace = true; this.ItemDrop = true; this.ItemPickup = true; @@ -173,32 +174,42 @@ public class Build extends SoloGame this.PrepareFreeze = false; this.CreatureAllow = true; - + this.WorldFireSpread = true; this.WorldBoneMeal = true; - + this.DontAllowOverfill = true; - + UtilServer.getServer().spigot().getConfig().set("view-distance", 4); _words = new String[] { - "Rollercoaster", "Pokemon", "Pirates", "Vikings", "Dinosaur", "Dragon", "Toilet", "Farm", "Tree House", - "Cat", "Truck", "Bicycle", "Soda", "Music Instrument", "Statue", "Pot of Gold", "Shrek", "Fruit", "Breakfast", - "Toaster", "Robot", "Camping", "Rocket", "Aliens", "Shipwreck", "Spongebob", "Car", "Potted Plant", "Weapons", - "Christmas", "King", "Queen", "Angel", "Demon", "Halloween", "Tank", "Helicopter", "Knight", "Rabbit", - "Sandwich", "Snowman", "Ice Cream", "Sea Shell", "Rainbow", - "Volcano", "Hot Tub", "Octopus", "Ghost", "Ant", "Cheese", "Kite Flying", "Reptile", - "Space Ship", "Pixel Art", "Chicken", "Shoe", "Owl", "Bear", "Flowers", "Lighthouse", - "Lion", "Television", "Batman", "Tiger", "Castle", "House", - "Bed", "Party", "Volleyball", "Toys", "Library", "Love", "Skull", - "Hat", "Snake", "Vacation", "Umbrella", "Magic", "Tornado", "Candy", "Dentist", "Pizza", "Bird", - "Superhero", "Turtle", "Chicken", "Build Anything!", "Food", "Picnic", - "Trophy", "Pool Party", "Hot Air Balloon", "Train", "Chocolate Bar", - "Clown", "Windmill", "Alligator", - "Police", "Igloo", "Gift", "Bumblebee", "Jellyfish", "Speedboat", - "Fall", "Summer", "Autumn", "Winter", "Disco", "Moose", - "Water Gun", "Astronaut", "Wither", "Meteor" + "Rollercoaster", "Pokemon", "Pirates", "Vikings", "Dinosaur", "Dragon", "Toilet", "Farm", "Tree House", + "Cat", "Truck", "Bicycle", "Soda", "Music Instrument", "Statue", "Pot of Gold", "Shrek", "Fruit", "Breakfast", + "Toaster", "Robot", "Camping", "Rocket", "Aliens", "Shipwreck", "Spongebob", "Car", "Potted Plant", "Weapons", + "Christmas", "King", "Queen", "Angel", "Demon", "Halloween", "Tank", "Helicopter", "Knight", "Rabbit", + "Sandwich", "Snowman", "Ice Cream", "Sea Shell", "Rainbow", + "Volcano", "Hot Tub", "Octopus", "Ghost", "Ant", "Cheese", "Kite Flying", "Reptile", + "Space Ship", "Pixel Art", "Chicken", "Shoe", "Owl", "Bear", "Flowers", "Lighthouse", + "Lion", "Television", "Batman", "Tiger", "Castle", "House", + "Bed", "Party", "Volleyball", "Toys", "Library", "Love", "Skull", + "Hat", "Snake", "Vacation", "Umbrella", "Magic", "Tornado", "Candy", "Dentist", "Pizza", "Bird", + "Superhero", "Turtle", "Chicken", "Build Anything!", "Food", "Picnic", + "Trophy", "Pool Party", "Hot Air Balloon", "Train", "Chocolate Bar", + "Clown", "Windmill", "Alligator", + "Police", "Igloo", "Gift", "Bumblebee", "Jellyfish", "Speedboat", + "Fall", "Summer", "Autumn", "Winter", "Disco", "Moose", + "Water Gun", "Astronaut", "Wither", "Meteor" + }; + + _holidayWords = new String[] + { + "Santa", "Reindeer", "Ornament", "Elf", "North Pole", "Candy Cane", "Xmas Lights", "Christmas Tree", + "Fireplace", "Hot Chocolate", "Snowflake", "Snowman", "Sleigh", "Toys", "Milk", "Eggnog", "Coal", + "Cookies", "Mistletoe", "Icicle", "Gingerbread", "Stocking", "Jingle Bells", "Family", "Mittens", + "Snowball Fight", "Decorations", "Snow Fort", "Chimney", "Scrooge", "Sweater", "Ice Skating", + "Pinecone", "Cabin", "Bells", "Cold", "Nutcracker", "Sled", "Mrs. Claus", "Grinch", "Igloo", + "Boots", "Gingerbread Man", "Glacier", "Ice Hockey", "Scarf", "Snowboard" }; _mobShop = new MobShop(getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation()); @@ -238,7 +249,10 @@ public class Build extends SoloGame player.setFlySpeed(0.1f); } - _word = _words[UtilMath.r(_words.length)]; + if (Math.random() >= 0.5) + _word = _words[UtilMath.r(_words.length)]; + else + _word = _holidayWords[UtilMath.r(_holidayWords.length)]; UtilTextMiddle.display(null, C.cYellow + "Build " + C.cWhite + _word, 0, 80, 5); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java index 24cd6996f..53d88aeda 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java @@ -83,6 +83,7 @@ public class Draw extends SoloGame private HashSet _tools; private String[] _words; + private String[] _holidayWords; private HashSet _usedWords = new HashSet(); public Draw(ArcadeManager manager) @@ -113,6 +114,16 @@ public class Draw extends SoloGame "Bird", "Volcano", "Sloth", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat", "Beard", "Wind", "Rain", "Minecraft", "Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper", "Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant", "Photo", "Quick", "Mario", "Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet", "Mountain Bike", "Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi", "Shotgun", "Pistol", "James Bond", "Money", "Salt and Pepper", "Truck", "Helicopter", "Hot Air Balloon", "Sprout", "Yelling", "Muscles", "Skinny", "Zombie", "Lava", "Snake", "Motorbike", "Whale", "Boat", "Letterbox", "Window", "Lollipop", "Handcuffs", "Police", "Uppercut", "Windmill", "Eyepatch", "Campfire", "Rainbow", "Storm", "Pikachu", "Charmander", "Tornado", "Crying", "King", "Hobo", "Worm", "Snail", "XBox", "Playstation", "Nintendo", "Duck", "Pull", "Dinosaur", "Alligator", "Ankle", "Angel", "Acorn", "Bread", "Booty", "Bacon", "Crown", "Donut", "Drill", "Leash", "Magic", "Wizard", "Igloo", "Plant", "Screw", "Rifle", "Puppy", "Stool", "Stamp", "Letter", "Witch", "Zebra", "Wagon", "Compass", "Watch", "Clock", "Time", "Cyclops", "Coconut", "Hang", "Penguin", "Confused", "Bucket", "Lion", "Rubbish", "Spaceship", "Bowl", "Shark", "Pizza", "Pyramid", "Dress", "Pants", "Shorts", "Boots", "Boy", "Girl", "Math", "Sunglasses", "Frog", "Chair", "Cake", "Grapes", "Kiss", "Snorlax", "Earth", "Spaghetti", "Couch", "Family", "Milk", "Blood", "Pig", "Giraffe", "Mouse", "Couch", "Fat", "Chocolate", "Camel", "Cheese", "Beans", "Water", "Chicken", "Cannibal", "Zipper", "Book", "Swimming", "Horse", "Paper", "Toaster", "Television", "Hammer", "Piano", "Sleeping", "Yawn", "Sheep", "Night", "Chest", "Lamp", "Redstone", "Grass", "Plane", "Ocean", "Lake", "Melon", "Pumpkin", "Gift", "Fishing", "Pirate", "Lightning", "Stomach", "Belly Button", "Fishing Rod", "Iron Ore", "Diamonds", "Emeralds", "Nether Portal", "Ender Dragon", "Rabbit", "Harry Potter", "Torch", "Light", "Battery", "Zombie Pigman", "Telephone", "Tent", "Hand", "Traffic Lights", "Anvil", "Tail", "Umbrella", "Piston", "Skeleton", "Spikes", "Bridge", "Bomb", "Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe", "Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey", "Unicorn", "Smile", "Pool", "Rabbit", "Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose", "Spray", "Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Eggs", "Teapot", "Golf Club", "Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney", "Stable", "Nether", "Wither", "Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree", "Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper", "Tetris", "Jump", "Ninja", "Baby", "Troll Face", "Grim Reaper", "Temple", "Explosion", "Vomit", "Ants", "Barn", "Burn", "Baggage", "Frisbee", "Iceberg", "Sleeping", "Dream", "Snorlax", "Balloons", "Elevator", "Alligator", "Bikini", "Butterfly", "Bumblebee", "Pizza", "Jellyfish", "Sideburns", "Speedboat", "Treehouse", "Water Gun", "Drink", "Hook", "Dance", "Fall", "Summer", "Autumn", "Spring", "Winter", "Night Time", "Galaxy", "Sunrise", "Sunset", "Picnic", "Snowflake", "Holding Hands", "America", "Laptop", "Anvil", "Bagel", "Bench", "Cigar", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb", "Tomato", "Alcohol", "Armor", "Alien", "Beans", "Cheek", "Phone", "Keyboard", "Orange", "Calculator", "Paper", "Desk", "Disco", "Elbow", "Drool", "Giant", "Golem", "Grave", "Llama", "Moose", "Party", "Panda", "Plumber", "Salsa", "Salad", "Skunk", "Skull", "Stump", "Sugar", "Ruler", "Bookcase", "Hamster", "Soup", "Teapot", "Towel", "Waist", "Archer", "Anchor", "Bamboo", "Branch", "Booger", "Carrot", "Cereal", "Coffee", "Wolf", "Crayon", "Finger", "Forest", "Hotdog", "Burger", "Obsidian", "Pillow", "Swing", "YouTube", "Farm", "Rain", "Cloud", "Frozen", "Garbage", "Music", "Twitter", "Facebook", "Santa Hat", "Rope", "Neck", "Sponge", "Sushi", "Noodles", "Soup", "Tower", "Berry", "Capture", "Prison", "Robot", "Trash", "School", "Skype", "Snowman", "Crowd", "Bank", "Mudkip", "Joker", "Lizard", "Tiger", "Royal", "Erupt", "Wizard", "Stain", "Cinema", "Notebook", "Blanket", "Paint", "Guard", "Astronaut" , "Slime" , "Mansion" , "Radar" , "Thorn" , "Tears" , "Tiny" , "Candy" , "Pepsi" , "Flint" , "Draw My Thing" , "Rice" , "Shout" , "Prize" , "Skirt" , "Thief" , "Syrup" , "Kirby" , "Brush" , "Violin", "Car", "Sun", "Eye", "Bow", "Axe", "Face", "Mushroom", "Guitar", "Book", }; + _holidayWords = new String[] + { + "Santa", "Reindeer", "Ornament", "Elf", "North Pole", "Candy Cane", "Christmas Tree", + "Fireplace", "Hot Chocolate", "Snowflake", "Snowman", "Sleigh", "Toys", "Milk", "Eggnog", "Coal", + "Cookies", "Mistletoe", "Icicle", "Gingerbread", "Stocking", "Jingle Bells", "Family", "Mittens", + "Snowball Fight", "Decorations", "Snow Fort", "Chimney", "Scrooge", "Sweater", "Ice Skating", + "Pinecone", "Cabin", "Bells", "Cold", "Nutcracker", "Sled", "Grinch", "Igloo", + "Boots", "Gingerbread Man", "Glacier", "Ice Hockey", "Scarf", "Snowboard" + }; + _tools = new HashSet(); _tools.add(new ToolLine(this)); _tools.add(new ToolSquare(this)); @@ -282,12 +293,22 @@ public class Draw extends SoloGame public String GetWord() { //Get Word - String word = _words[UtilMath.r(_words.length)]; + String word = getRandomWord(); while (!_usedWords.add(word)) - word = _words[UtilMath.r(_words.length)]; + word = getRandomWord(); return word; } + + private String getRandomWord() + { + if (Math.random() >= 0.30) + { + return _words[UtilMath.r(_words.length)]; + } + + return _holidayWords[UtilMath.r(_holidayWords.length)]; + } @EventHandler(priority = EventPriority.LOWEST) public void Guess(AsyncPlayerChatEvent event) From fea637db809998ac3105012ac55b249d72e1d624 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 7 Dec 2015 18:06:26 +1100 Subject: [PATCH 22/54] fixed some freeze --- .../nautilus/game/arcade/game/games/snowfight/SnowFight.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java index dce28ada5..9185e035b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java @@ -417,7 +417,7 @@ public class SnowFight extends TeamGame //Convert to Ice for(Block block : UtilBlock.getInRadius(event.getEntity().getLocation(), size).keySet()) { - int i = 5; + int i = 20; while (block.getY() > 0 && i>0) { if (block.getType() == Material.LADDER || @@ -427,7 +427,7 @@ public class SnowFight extends TeamGame //Has air above it - if (UtilBlock.solid(block) && UtilBlock.isVisible(block)) + if ((UtilBlock.solid(block) && UtilBlock.isVisible(block)) || block.isLiquid()) block.setType(Material.PACKED_ICE); //shuffle down From 5c632a1e3afe5fb17cd7750be9bb455b0ddb1554 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 7 Dec 2015 18:20:12 +1100 Subject: [PATCH 23/54] sharper target --- .../nautilus/game/arcade/game/games/snowfight/SnowFight.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java index 9185e035b..5649d13df 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java @@ -286,9 +286,9 @@ public class SnowFight extends TeamGame //random offset to player location Location location = player.getLocation().add( - (Math.random() - 0.5) * 32, + (Math.random() - 0.5) * 24, 0, - (Math.random() - 0.5) * 32); + (Math.random() - 0.5) * 24); //highest block! location = WorldData.World.getHighestBlockAt(location).getLocation().add(0.5, 0, 0.5); From ed3bea8e8577e6167787a631e2a6902bdcb1b74c Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 7 Dec 2015 18:36:05 +1100 Subject: [PATCH 24/54] DONE! --- .../game/games/snowfight/SnowFight.java | 102 ++++++++++-------- 1 file changed, 60 insertions(+), 42 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java index 5649d13df..ef901c010 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java @@ -63,6 +63,7 @@ import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; @@ -284,11 +285,14 @@ public class SnowFight extends TeamGame { Player player = UtilAlg.Random(players); + Location location = player.getLocation(); + //random offset to player location - Location location = player.getLocation().add( - (Math.random() - 0.5) * 24, + if (Math.random() > 0.1) + location.add( + (Math.random() - 0.5) * 32, 0, - (Math.random() - 0.5) * 24); + (Math.random() - 0.5) * 32); //highest block! location = WorldData.World.getHighestBlockAt(location).getLocation().add(0.5, 0, 0.5); @@ -374,8 +378,10 @@ public class SnowFight extends TeamGame //Clean else { + meteorExplode(block); + block.remove(); - blockIter.remove(); + blockIter.remove(); } } } @@ -387,57 +393,63 @@ public class SnowFight extends TeamGame Entity projectile = event.getEntity(); + if (projectile.hasMetadata("Meteor")) + { + meteorExplode(projectile); + _meteorSet.remove(projectile); + } + } + + public void meteorExplode(Entity meteor) + { float timePassed = (System.currentTimeMillis() - (getGameLiveTime() + _meteorTime))/1000f; float multiplier = 1 + Math.min(3f, timePassed / 60f); float size = 1.5f + multiplier; + + //Effect + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, meteor.getLocation(), 0.5f, 0.5f, 0.5f, 0, 5, ViewDist.MAX, UtilServer.getPlayers()); + for(Player player : UtilServer.getPlayers()) + player.playSound(meteor.getLocation(), Sound.EXPLODE, 1, 1); - if (projectile.hasMetadata("Meteor")) + + //Damage + HashMap players = UtilPlayer.getInRadius(meteor.getLocation(), size + 3); + for (Player player : players.keySet()) { - //Effect - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, projectile.getLocation(), 0.5f, 0.5f, 0.5f, 0, 5, ViewDist.MAX, UtilServer.getPlayers()); - for(Player player : UtilServer.getPlayers()) - player.playSound(projectile.getLocation(), Sound.EXPLODE, 1, 1); - - - //Damage - HashMap players = UtilPlayer.getInRadius(event.getEntity().getLocation(), size + 3); - for (Player player : players.keySet()) - { - //Damage Event - Manager.GetDamage().NewDamageEvent(player, null, null, - DamageCause.CUSTOM, size * players.get(player), false, true, false, - "Ice Meteor", "Ice Meteor", false); - - //Vel - UtilAction.velocity(player, UtilAlg.getTrajectory(event.getEntity(), player), 1.2 * players.get(player), false, 0, 0.4, 1, true); - } + //Damage Event + Manager.GetDamage().NewDamageEvent(player, null, null, + DamageCause.CUSTOM, size * players.get(player), false, true, false, + "Ice Meteor", "Ice Meteor", false); - //Convert to Ice - for(Block block : UtilBlock.getInRadius(event.getEntity().getLocation(), size).keySet()) + //Vel + UtilAction.velocity(player, UtilAlg.getTrajectory(meteor, player), 1.2 * players.get(player), false, 0, 0.4, 1, true); + } + + //Convert to Ice + for(Block block : UtilBlock.getInRadius(meteor.getLocation(), size).keySet()) + { + int i = 20; + while (block.getY() > 0 && i>0) { - int i = 20; - while (block.getY() > 0 && i>0) - { - if (block.getType() == Material.LADDER || - block.getType() == Material.STAINED_GLASS || - block.getType() == Material.STAINED_GLASS_PANE) - block.breakNaturally(); + if (block.getType() == Material.LADDER || + block.getType() == Material.STAINED_GLASS || + block.getType() == Material.STAINED_GLASS_PANE) + block.breakNaturally(); - - //Has air above it - if ((UtilBlock.solid(block) && UtilBlock.isVisible(block)) || block.isLiquid()) - block.setType(Material.PACKED_ICE); + + //Has air above it + if ((UtilBlock.solid(block) && UtilBlock.isVisible(block)) || block.isLiquid()) + block.setType(Material.PACKED_ICE); - //shuffle down - block = block.getRelative(BlockFace.DOWN); - i--; - } + //shuffle down + block = block.getRelative(BlockFace.DOWN); + i--; } } - projectile.remove(); + meteor.remove(); } @@ -452,7 +464,6 @@ public class SnowFight extends TeamGame for(Player player : GetPlayers(true)) { - //XXX DO BETTER CHECK, hanging off block, ladders, etc. if(isOnIce(player)) { Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, null, DamageCause.CUSTOM, 1, false, true, true, "Ice", "Ice", false)); @@ -513,5 +524,12 @@ public class SnowFight extends TeamGame Scoreboard.Draw(); } + + @EventHandler + public void meteorStart(PlayerCommandPreprocessEvent event) + { + if (event.getPlayer().isOp() && event.getMessage().equals("/meteor")) + _meteorTime = 0; + } } From 8c4615203c75df91b58786683d190b52a86f6f49 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 7 Dec 2015 20:07:20 +1100 Subject: [PATCH 25/54] sale message --- .../src/mineplex/hub/modules/NewsManager.java | 50 ++++++++++++++- .../game/arcade/managers/GameManager.java | 61 ++++++++++++++++++- 2 files changed, 109 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java index 943acdd63..114f88526 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java @@ -258,7 +258,55 @@ public class NewsManager extends MiniPlugin String text = ""; double healthPercent = 1; - if (Manager.Type == HubType.Halloween) + if (Manager.Type == HubType.Christmas) + { + _animationIndex = (_animationIndex + 1) % 77; + + if (_animationIndex >= 0 && _animationIndex <= 20) + text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " " + C.cWhiteB + "50% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + + if (_animationIndex == 21) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 5" + C.cWhiteB + "0% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 22) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50" + C.cWhiteB + "% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 23) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50%" + C.cWhiteB + " OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 24) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% " + C.cWhiteB + "OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 25) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% O" + C.cWhiteB + "FF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 26) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OF" + C.cWhiteB + "F ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 27) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF" + C.cWhiteB + " ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 28) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF " + C.cWhiteB + "ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 29) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF A" + C.cWhiteB + "LL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 30) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF AL" + C.cWhiteB + "L RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 31) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL" + C.cWhiteB + " RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 32) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL " + C.cWhiteB + "RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 33) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL R" + C.cWhiteB + "ANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 34) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RA" + C.cWhiteB + "NKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 35) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RAN" + C.cWhiteB + "KS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 36) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANK" + C.cWhiteB + "S " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 37) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + + if (_animationIndex >= 38 && _animationIndex <= 59) + text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + + + if (_animationIndex == 60) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 5" + C.cGreenB + "0% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 61) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50" + C.cGreenB + "% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 62) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50%" + C.cGreenB + " OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 63) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% " + C.cGreenB + "OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 64) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% O" + C.cGreenB + "FF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 65) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OF" + C.cGreenB + "F ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 66) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF" + C.cGreenB + " ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 67) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF " + C.cGreenB + "ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 68) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF A" + C.cGreenB + "LL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 69) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF AL" + C.cGreenB + "L RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 70) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL" + C.cGreenB + " RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 71) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL " + C.cGreenB + "RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 72) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL R" + C.cGreenB + "ANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 73) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RA" + C.cGreenB + "NKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 74) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RAN" + C.cGreenB + "KS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 75) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANK" + C.cGreenB + "S " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 76) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + + } + else if (Manager.Type == HubType.Halloween) { /** * @author Mysticate diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 7f65cc868..17a2bf94a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -52,6 +52,7 @@ public class GameManager implements Listener ArcadeManager Manager; private int _colorId = 0; + private int _animationIndex = 0; public GameManager(ArcadeManager manager) { @@ -63,7 +64,7 @@ public class GameManager implements Listener @EventHandler public void DisplayIP(UpdateEvent event) { - if (event.getType() != UpdateType.FASTER) + if (event.getType() != UpdateType.FASTEST) return; if (Manager.GetGame() != null && !Manager.GetGame().InProgress()) @@ -76,6 +77,64 @@ public class GameManager implements Listener String text = col + C.Bold + "US.MINEPLEX.COM EU.MINEPLEX.COM"; + + + + //Christmas + _animationIndex = (_animationIndex + 1) % 77; + + if (_animationIndex >= 0 && _animationIndex <= 20) + text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " " + C.cWhiteB + "50% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + + if (_animationIndex == 21) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 5" + C.cWhiteB + "0% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 22) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50" + C.cWhiteB + "% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 23) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50%" + C.cWhiteB + " OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 24) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% " + C.cWhiteB + "OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 25) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% O" + C.cWhiteB + "FF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 26) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OF" + C.cWhiteB + "F ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 27) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF" + C.cWhiteB + " ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 28) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF " + C.cWhiteB + "ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 29) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF A" + C.cWhiteB + "LL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 30) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF AL" + C.cWhiteB + "L RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 31) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL" + C.cWhiteB + " RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 32) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL " + C.cWhiteB + "RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 33) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL R" + C.cWhiteB + "ANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 34) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RA" + C.cWhiteB + "NKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 35) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RAN" + C.cWhiteB + "KS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 36) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANK" + C.cWhiteB + "S " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 37) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + + if (_animationIndex >= 38 && _animationIndex <= 59) + text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + + + if (_animationIndex == 60) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 5" + C.cGreenB + "0% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 61) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50" + C.cGreenB + "% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 62) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50%" + C.cGreenB + " OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 63) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% " + C.cGreenB + "OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 64) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% O" + C.cGreenB + "FF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 65) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OF" + C.cGreenB + "F ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 66) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF" + C.cGreenB + " ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 67) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF " + C.cGreenB + "ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 68) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF A" + C.cGreenB + "LL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 69) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF AL" + C.cGreenB + "L RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 70) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL" + C.cGreenB + " RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 71) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL " + C.cGreenB + "RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 72) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL R" + C.cGreenB + "ANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 73) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RA" + C.cGreenB + "NKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 74) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RAN" + C.cGreenB + "KS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 75) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANK" + C.cGreenB + "S " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 76) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + + + + + + + + + + double health = 1; if (Manager.GetGame().GetState() == GameState.Recruit) { From 7b11baf24b49a2d53d9ff2d3b585e2c6eb0c3ab3 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 7 Dec 2015 20:20:49 +1100 Subject: [PATCH 26/54] Christmas sale bossbars --- .../src/mineplex/hub/modules/NewsManager.java | 71 ++++++++---------- .../game/arcade/managers/GameManager.java | 73 ++++++++----------- 2 files changed, 60 insertions(+), 84 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java index 114f88526..5287b1d76 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java @@ -260,50 +260,39 @@ public class NewsManager extends MiniPlugin if (Manager.Type == HubType.Christmas) { - _animationIndex = (_animationIndex + 1) % 77; + _animationIndex = (_animationIndex + 1) % 40; - if (_animationIndex >= 0 && _animationIndex <= 20) - text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " " + C.cWhiteB + "50% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 0) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 5" + C.cWhiteB + "0% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 1) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50" + C.cWhiteB + "% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 2) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% " + C.cWhiteB + "OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 3) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% O" + C.cWhiteB + "FF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 4) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OF" + C.cWhiteB + "F ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 5) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF " + C.cWhiteB + "ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 6) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF A" + C.cWhiteB + "LL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 7) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF AL" + C.cWhiteB + "L RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 8) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL " + C.cWhiteB + "RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 9) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL R" + C.cWhiteB + "ANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 10) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RA" + C.cWhiteB + "NKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 11) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RAN" + C.cWhiteB + "KS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 12) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANK" + C.cWhiteB + "S " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 13) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 21) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 5" + C.cWhiteB + "0% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 22) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50" + C.cWhiteB + "% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 23) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50%" + C.cWhiteB + " OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 24) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% " + C.cWhiteB + "OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 25) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% O" + C.cWhiteB + "FF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 26) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OF" + C.cWhiteB + "F ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 27) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF" + C.cWhiteB + " ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 28) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF " + C.cWhiteB + "ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 29) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF A" + C.cWhiteB + "LL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 30) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF AL" + C.cWhiteB + "L RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 31) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL" + C.cWhiteB + " RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 32) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL " + C.cWhiteB + "RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 33) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL R" + C.cWhiteB + "ANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 34) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RA" + C.cWhiteB + "NKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 35) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RAN" + C.cWhiteB + "KS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 36) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANK" + C.cWhiteB + "S " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 37) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 14) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 15) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 16) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 17) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 18) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 19) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 20) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 21) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 22) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 23) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 24) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 25) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 26) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex >= 38 && _animationIndex <= 59) - text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - - - if (_animationIndex == 60) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 5" + C.cGreenB + "0% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 61) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50" + C.cGreenB + "% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 62) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50%" + C.cGreenB + " OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 63) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% " + C.cGreenB + "OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 64) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% O" + C.cGreenB + "FF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 65) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OF" + C.cGreenB + "F ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 66) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF" + C.cGreenB + " ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 67) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF " + C.cGreenB + "ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 68) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF A" + C.cGreenB + "LL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 69) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF AL" + C.cGreenB + "L RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 70) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL" + C.cGreenB + " RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 71) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL " + C.cGreenB + "RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 72) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL R" + C.cGreenB + "ANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 73) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RA" + C.cGreenB + "NKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 74) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RAN" + C.cGreenB + "KS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 75) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANK" + C.cGreenB + "S " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 76) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex >= 27) + text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " " + C.cWhiteB + "50% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; } else if (Manager.Type == HubType.Halloween) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 17a2bf94a..e78480d1d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -81,52 +81,39 @@ public class GameManager implements Listener //Christmas - _animationIndex = (_animationIndex + 1) % 77; + _animationIndex = (_animationIndex + 1) % 40; - if (_animationIndex >= 0 && _animationIndex <= 20) - text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " " + C.cWhiteB + "50% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - - if (_animationIndex == 21) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 5" + C.cWhiteB + "0% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 22) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50" + C.cWhiteB + "% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 23) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50%" + C.cWhiteB + " OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 24) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% " + C.cWhiteB + "OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 25) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% O" + C.cWhiteB + "FF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 26) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OF" + C.cWhiteB + "F ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 27) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF" + C.cWhiteB + " ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 28) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF " + C.cWhiteB + "ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 29) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF A" + C.cWhiteB + "LL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 30) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF AL" + C.cWhiteB + "L RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 31) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL" + C.cWhiteB + " RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 32) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL " + C.cWhiteB + "RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 33) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL R" + C.cWhiteB + "ANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 34) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RA" + C.cWhiteB + "NKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 35) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RAN" + C.cWhiteB + "KS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 36) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANK" + C.cWhiteB + "S " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 37) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - - if (_animationIndex >= 38 && _animationIndex <= 59) - text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - - - if (_animationIndex == 60) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 5" + C.cGreenB + "0% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 61) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50" + C.cGreenB + "% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 62) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50%" + C.cGreenB + " OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 63) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% " + C.cGreenB + "OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 64) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% O" + C.cGreenB + "FF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 65) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OF" + C.cGreenB + "F ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 66) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF" + C.cGreenB + " ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 67) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF " + C.cGreenB + "ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 68) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF A" + C.cGreenB + "LL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 69) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF AL" + C.cGreenB + "L RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 70) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL" + C.cGreenB + " RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 71) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL " + C.cGreenB + "RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 72) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL R" + C.cGreenB + "ANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 73) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RA" + C.cGreenB + "NKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 74) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RAN" + C.cGreenB + "KS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 75) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANK" + C.cGreenB + "S " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 76) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 0) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 5" + C.cWhiteB + "0% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 1) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50" + C.cWhiteB + "% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 2) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% " + C.cWhiteB + "OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 3) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% O" + C.cWhiteB + "FF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 4) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OF" + C.cWhiteB + "F ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 5) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF " + C.cWhiteB + "ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 6) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF A" + C.cWhiteB + "LL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 7) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF AL" + C.cWhiteB + "L RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 8) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL " + C.cWhiteB + "RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 9) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL R" + C.cWhiteB + "ANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 10) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RA" + C.cWhiteB + "NKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 11) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RAN" + C.cWhiteB + "KS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 12) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANK" + C.cWhiteB + "S " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 13) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 14) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 15) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 16) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 17) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 18) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 19) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 20) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 21) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 22) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 23) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 24) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 25) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex == 26) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; + if (_animationIndex >= 27) + text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " " + C.cWhiteB + "50% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; From 2afbe23a7c979ba8d16f1b675c4fc2b0c9a8642a Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 7 Dec 2015 04:23:26 -0500 Subject: [PATCH 27/54] Load songs from update folder --- .../src/mineplex/hub/HubManager.java | 40 ++++++++++++++----- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 494f7cc06..ea96b4c65 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -1,6 +1,10 @@ package mineplex.hub; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.nio.file.Files; import java.util.ArrayList; import java.util.HashMap; import java.util.Random; @@ -171,8 +175,8 @@ public class HubManager extends MiniClientPlugin // Christmas Songs private Random _random = new Random(); private int _lastSong = 0; - private final String[] _songNames = {"JingleBells.nbs", "TheFirstNoel.nbs", "Hark.nbs", "DeckTheHalls.nbs", "Joy.nbs", "MerryChristmas.nbs"}; - private final NoteSong[] _songs; +// private final String[] _songNames = {"JingleBells.nbs", "TheFirstNoel.nbs", "Hark.nbs", "DeckTheHalls.nbs", "Joy.nbs", "MerryChristmas.nbs"}; + private final ArrayList _songs; public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager, GiveawayManager giveawayManager) { @@ -241,15 +245,28 @@ public class HubManager extends MiniClientPlugin // NotificationManager notificationManager = new NotificationManager(plugin, clientManager, donationManager); // new MailManager(_plugin, notificationManager); - _songs = new NoteSong[_songNames.length]; + _songs = new ArrayList(); + try { - for (int i = 0; i < _songNames.length; i++) + + File songsFolder = new File("../../update/songs/"); + if (songsFolder.exists()) { - String name = "songs/" + _songNames[i]; - NoteSong song = NBSReader.loadSong(name); - _songs[i] = song; - System.out.println("Loaded Song: " + name); + File[] files = songsFolder.listFiles(); + + for (File file : files) + { + if (file.getName().endsWith(".nbs")) + { + System.out.println("Loading Song " + file.getPath()); + NoteSong song = NBSReader.loadSong(new DataInputStream(new FileInputStream(file))); + if (song != null) + { + _songs.add(song); + } + } + } } } catch (FileNotFoundException e) @@ -266,8 +283,11 @@ public class HubManager extends MiniClientPlugin private void playNextSong() { - int index = (_lastSong + _random.nextInt(_songs.length - 1)) % _songs.length; - NoteSong song = _songs[index]; + if (_songs.isEmpty()) + return; + + int index = (_lastSong + _random.nextInt(_songs.size() - 1)) % _songs.size(); + NoteSong song = _songs.get(index); if (song != null) { new NotePlayer(_plugin, song, new INoteVerifier() From e1efcabfbfc7eba877f52f834da857d0c59c53d2 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 7 Dec 2015 20:39:31 +1100 Subject: [PATCH 28/54] chat sale msgs --- .../core/notifier/NotificationManager.java | 14 ++++++++++++- .../game/arcade/managers/GameManager.java | 21 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java index 53c841b6c..6c218986e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java @@ -1,5 +1,6 @@ package mineplex.core.notifier; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -17,7 +18,7 @@ import mineplex.core.updater.event.UpdateEvent; public class NotificationManager extends MiniPlugin { - private boolean _enabled = false; + private boolean _enabled = true; private CoreClientManager _clientManager; @@ -48,8 +49,19 @@ public class NotificationManager extends MiniPlugin // if (event.getType() == UpdateType.MIN_16) // sale(); + if (event.getType() == UpdateType.MIN_08) + christmasSale(); } + private void christmasSale() + { + Bukkit.broadcastMessage(C.cWhite + " "); + Bukkit.broadcastMessage(C.cRedB + " MASSIVE WINTER SALE"); + Bukkit.broadcastMessage(C.cWhiteB + " 50% OFF ALL RANKS"); + Bukkit.broadcastMessage(" " + C.cGreen + C.Line + "www.mineplex.com/shop"); + Bukkit.broadcastMessage(C.cWhite + " "); + } + private void sale() { for (Player player : UtilServer.getPlayers()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index e78480d1d..ce83a8995 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -35,6 +35,7 @@ import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.uhc.UHC; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Color; import org.bukkit.Location; @@ -61,6 +62,26 @@ public class GameManager implements Listener Manager.getPluginManager().registerEvents(this, Manager.getPlugin()); } + @EventHandler + public void displaySale(UpdateEvent event) + { + if (event.getType() != UpdateType.MIN_08) + return; + + if (Manager.GetGame() == null) + return; + + for (Player player : UtilServer.getPlayers()) + if (!Manager.GetGame().IsAlive(player)) + { + player.sendMessage(C.cWhite + " "); + player.sendMessage(C.cRedB + " MASSIVE WINTER SALE"); + player.sendMessage(C.cWhiteB + " 50% OFF ALL RANKS"); + player.sendMessage(" " + C.cGreen + C.Line + "www.mineplex.com/shop"); + player.sendMessage(C.cWhite + " "); + } + } + @EventHandler public void DisplayIP(UpdateEvent event) { From 4354133de958422556379da53865fb7426c569ae Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 7 Dec 2015 04:40:34 -0500 Subject: [PATCH 29/54] Add Minecraft timings to /lag --- .../src/mineplex/core/monitor/LagMeter.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java b/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java index 12bc7d776..570348c68 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java @@ -5,6 +5,7 @@ import java.util.HashSet; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -18,6 +19,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; +import net.minecraft.server.v1_8_R3.MinecraftServer; public class LagMeter extends MiniPlugin { @@ -128,9 +130,27 @@ public class LagMeter extends MiniPlugin sendUpdate(player); } } + + private String getPrefix(double value) + { + if (value >= 18.0) + return C.cGreen; + else if (value >= 15) + return C.cYellow; + else + return C.cRed; + } private void sendUpdate(Player player) { + double[] tps = MinecraftServer.getServer().recentTps; + String mcString = ""; + for (int i = 0; i < tps.length; i++) + { + mcString += getPrefix(tps[i]) + (double)Math.round(tps[i] * 100.0D) / 100.0D; + if (i < tps.length - 1) mcString += C.cWhite + ", "; + } + player.sendMessage(" "); player.sendMessage(" "); player.sendMessage(" "); @@ -138,6 +158,8 @@ public class LagMeter extends MiniPlugin player.sendMessage(" "); player.sendMessage(F.main(getName(), ChatColor.GRAY + "Live-------" + ChatColor.YELLOW + String.format("%.00f", _ticksPerSecond))); player.sendMessage(F.main(getName(), ChatColor.GRAY + "Avg--------" + ChatColor.YELLOW + String.format("%.00f", _ticksPerSecondAverage * 20))); + player.sendMessage(F.main(getName(), ChatColor.YELLOW + "MC Timings")); + player.sendMessage(F.main(getName(), ChatColor.GRAY + "5m, 10m, 15m Avg---" + mcString)); player.sendMessage(F.main(getName(), ChatColor.YELLOW + "MEM")); player.sendMessage(F.main(getName(), ChatColor.GRAY + "Free-------" + ChatColor.YELLOW + (Runtime.getRuntime().freeMemory() / 1048576) + "MB")); player.sendMessage(F.main(getName(), ChatColor.GRAY + "Max--------" + ChatColor.YELLOW + (Runtime.getRuntime().maxMemory() / 1048576)) + "MB"); From c6c012031f36e4107926ea64a61632f5c557a0ba Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 7 Dec 2015 04:44:19 -0500 Subject: [PATCH 30/54] Less ugly formatting --- Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java b/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java index 570348c68..47c37044a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java @@ -158,8 +158,8 @@ public class LagMeter extends MiniPlugin player.sendMessage(" "); player.sendMessage(F.main(getName(), ChatColor.GRAY + "Live-------" + ChatColor.YELLOW + String.format("%.00f", _ticksPerSecond))); player.sendMessage(F.main(getName(), ChatColor.GRAY + "Avg--------" + ChatColor.YELLOW + String.format("%.00f", _ticksPerSecondAverage * 20))); - player.sendMessage(F.main(getName(), ChatColor.YELLOW + "MC Timings")); - player.sendMessage(F.main(getName(), ChatColor.GRAY + "5m, 10m, 15m Avg---" + mcString)); + player.sendMessage(F.main(getName(), ChatColor.YELLOW + "MC Timings (5,10,15 min avg)")); + player.sendMessage(F.main(getName(), ChatColor.GRAY + mcString)); player.sendMessage(F.main(getName(), ChatColor.YELLOW + "MEM")); player.sendMessage(F.main(getName(), ChatColor.GRAY + "Free-------" + ChatColor.YELLOW + (Runtime.getRuntime().freeMemory() / 1048576) + "MB")); player.sendMessage(F.main(getName(), ChatColor.GRAY + "Max--------" + ChatColor.YELLOW + (Runtime.getRuntime().maxMemory() / 1048576)) + "MB"); From d318a5cf87bf0aeba229efd5b8512f0ee61a020a Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 7 Dec 2015 21:53:34 +1100 Subject: [PATCH 31/54] interacto! --- .../nautilus/game/arcade/managers/HolidayManager.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index cf3bbf215..eb60ba482 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -293,18 +293,21 @@ public class HolidayManager implements Listener } @EventHandler - public void specialBlockDamage(BlockDamageEvent event) + public void specialBlockDamage(PlayerInteractEvent event) { + if (!UtilEvent.isAction(event, ActionType.L_BLOCK)) + return; + if (UtilPlayer.isSpectator(event.getPlayer())) return; if (Manager.GetGame() != null && !Manager.GetGame().IsAlive(event.getPlayer())) return; - if (!_active.contains(event.getBlock())) + if (!_active.contains(event.getClickedBlock())) return; - specialBlockBreak(event.getPlayer(), event.getBlock()); + specialBlockBreak(event.getPlayer(), event.getClickedBlock()); } private void specialBlockBreak(Player player, final Block block) From a39b11ce67040781f9ce4ae0d8d8b11e9a8931e1 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 7 Dec 2015 21:56:00 +1100 Subject: [PATCH 32/54] slowed meteors --- .../nautilus/game/arcade/game/games/snowfight/SnowFight.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java index ef901c010..cb278885d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java @@ -73,7 +73,7 @@ import org.bukkit.util.Vector; public class SnowFight extends TeamGame { - private long _meteorTime = 240000; + private long _meteorTime = 360000; private boolean _meteors = false; private HashSet _meteorSet = new HashSet(); @@ -316,7 +316,7 @@ public class SnowFight extends TeamGame @EventHandler public void meteorSpawn(UpdateEvent event) { - if(event.getType() != UpdateType.FAST) + if(event.getType() != UpdateType.SEC) return; if (!IsLive()) From 7984c0ac31b0bc9e61c75a52c55dc3907eca5ddf Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 7 Dec 2015 06:12:49 -0500 Subject: [PATCH 33/54] Add ! --- .../src/nautilus/game/arcade/managers/HolidayManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index eb60ba482..ba2c0d8cd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -117,7 +117,7 @@ public class HolidayManager implements Listener @EventHandler public void blockEffect(UpdateEvent event) { - if (event.getType() == UpdateType.TICK) + if (event.getType() != UpdateType.TICK) return; Iterator blockIterator = _active.iterator(); From c3ace42a68c6d565d5d3d6c8476510845d806ccb Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 7 Dec 2015 13:21:11 -0500 Subject: [PATCH 34/54] Winter MOTD, Stat fixes (maybe?!) --- .../src/mineplex/bungee/motd/MotdManager.java | 4 +- .../src/mineplex/core/stats/StatsManager.java | 83 ++++++++++--------- 2 files changed, 44 insertions(+), 43 deletions(-) diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java index ede793bef..1f2835f13 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java @@ -56,11 +56,11 @@ public class MotdManager implements Listener, Runnable //String motdLine = "§f§l◄ §c§lMaintenance§f§l ►"; //String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►"; // String motdLine = " §2§l§n M O N S T E R M A Z E B E T A §f"; - String motdLine = " §f§l◄ §b§lNew Game§f§l ▬ §3§lChampions CTF§f§l ►"; + String motdLine = " §f❄ §2§lWinter Update §f❄ §2§lSnow Fight §f❄"; //String motdLine = " §d§lRank Sale §a§l40% Off"); //String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►"); - updateMainMotd(" §f§l§m §8§l§m[ §r §6§lMineplex§r §f§lGames§r §8§l§m ]§f§l§m §r", motdLine); + updateMainMotd(" §c§m §f§m §c§m §f§m §2§l§m[ §r §c§lMineplex§r §f§lGames§r §2§l§m ]§f§m §c§m §f§m §c§m §r", motdLine); System.out.println("Updated Bungee MOTD"); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java index 4b60646f1..7ec46f8f9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java @@ -91,41 +91,14 @@ public class StatsManager extends MiniDbClientPlugin UtilServer.getServer().getPluginManager().callEvent(new StatChangeEvent(player.getName(), statName, newValue - value, newValue)); // Verify stat is in our local cache, if not add it remotely. - if (!_stats.containsKey(statName)) + registerNewStat(statName, new Runnable() { - runAsync(new Runnable() + @Override + public void run() { - public void run() - { - synchronized (_statSync) - { - // If many players come in for a new stat, when the first add finishes the others are queued to add again - // This makes a second check for the stat name (already added before lock was released) - // Then it pops into queue and forgets adding the new stat to db. - if (_stats.containsKey(statName)) - { - addToQueue(statName, player, value); - return; - } - - _repository.addStat(statName); - - _stats.clear(); - - for (Stat stat : _repository.retrieveStats()) - { - _stats.put(stat.Name, stat.Id); - } - - addToQueue(statName, player, value); - } - } - }); - } - else - { - addToQueue(statName, player, value); - } + addToQueue(statName, player, value); + } + }); } private void addToQueue(String statName, Player player, long value) @@ -192,23 +165,51 @@ public class StatsManager extends MiniDbClientPlugin public boolean incrementStat(final int accountId, final String statName, final long value) { - if (_stats.containsKey(statName)) - return false; - - final NautHashMap> uploadQueue = new NautHashMap>(); - uploadQueue.put(accountId, new NautHashMap()); - uploadQueue.get(accountId).put(_stats.get(statName), value); - - runAsync(new Runnable() + // This will register a new stat if we don't have one, otherwise it will just run the callback + registerNewStat(statName, new Runnable() { + @Override public void run() { + final NautHashMap> uploadQueue = new NautHashMap>(); + uploadQueue.put(accountId, new NautHashMap()); + uploadQueue.get(accountId).put(_stats.get(statName), value); + _repository.saveStats(uploadQueue); } }); return true; } + + private void registerNewStat(final String statName, final Runnable callback) + { + runAsync(new Runnable() + { + public void run() + { + synchronized (_statSync) + { + if (_stats.containsKey(statName)) + { + if (callback != null) callback.run(); + return; + } + + _repository.addStat(statName); + + _stats.clear(); + + for (Stat stat : _repository.retrieveStats()) + { + _stats.put(stat.Name, stat.Id); + } + + if (callback != null) callback.run(); + } + } + }); + } public int getStatId(String statName) { From 42a0354c9e808e04a93922dfdfcec3d5ad317594 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 7 Dec 2015 18:28:05 -0500 Subject: [PATCH 35/54] Now Playing, Preference to disable ads --- .../core/notifier/NotificationManager.java | 21 ++++++++++---- .../core/preferences/PreferencesManager.java | 2 +- .../preferences/PreferencesRepository.java | 9 ++++-- .../core/preferences/UserPreferences.java | 1 + .../core/preferences/ui/PreferencesPage.java | 28 +++++++++++++++++-- .../src/mineplex/hub/HubManager.java | 13 +++++++-- .../nautilus/game/arcade/ArcadeManager.java | 4 +-- .../game/arcade/managers/GameManager.java | 5 +--- 8 files changed, 62 insertions(+), 21 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java index 6c218986e..8e4cb3dc7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java @@ -13,6 +13,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.preferences.PreferencesManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -21,6 +22,7 @@ public class NotificationManager extends MiniPlugin private boolean _enabled = true; private CoreClientManager _clientManager; + private PreferencesManager _preferencesManager; private String _summerLine = C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + @@ -30,11 +32,12 @@ public class NotificationManager extends MiniPlugin C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█"; - public NotificationManager(JavaPlugin plugin, CoreClientManager client) + public NotificationManager(JavaPlugin plugin, CoreClientManager client, PreferencesManager preferencesManager) { super("Notification Manager", plugin); _clientManager = client; + _preferencesManager = preferencesManager; } @EventHandler @@ -55,11 +58,17 @@ public class NotificationManager extends MiniPlugin private void christmasSale() { - Bukkit.broadcastMessage(C.cWhite + " "); - Bukkit.broadcastMessage(C.cRedB + " MASSIVE WINTER SALE"); - Bukkit.broadcastMessage(C.cWhiteB + " 50% OFF ALL RANKS"); - Bukkit.broadcastMessage(" " + C.cGreen + C.Line + "www.mineplex.com/shop"); - Bukkit.broadcastMessage(C.cWhite + " "); + for (Player player : UtilServer.getPlayers()) + { + if (!_preferencesManager.Get(player).DisableAds) + { + player.sendMessage(C.cWhite + " "); + player.sendMessage(C.cRedB + " MASSIVE WINTER SALE"); + player.sendMessage(C.cWhiteB + " 50% OFF ALL RANKS"); + player.sendMessage(" " + C.cGreen + C.Line + "www.mineplex.com/shop"); + player.sendMessage(C.cWhite + " "); + } + } } private void sale() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java index 23d067d8f..ae7f67755 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java @@ -136,6 +136,6 @@ public class PreferencesManager extends MiniDbClientPlugin @Override public String getQuery(int accountId, String uuid, String name) { - return "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield, showMacReports, ignoreVelocity, pendingFriendRequests, friendDisplayInventoryUI, clanTips, hubMusic FROM accountPreferences WHERE accountPreferences.uuid = '" + uuid + "' LIMIT 1;"; + return "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield, showMacReports, ignoreVelocity, pendingFriendRequests, friendDisplayInventoryUI, clanTips, hubMusic, disableAds FROM accountPreferences WHERE accountPreferences.uuid = '" + uuid + "' LIMIT 1;"; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java index 895555da6..957785cb4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java @@ -24,7 +24,7 @@ public class PreferencesRepository extends RepositoryBase // DEFAULT 0, showMacReports BOOL NOT NULL DEFAULT 0, ignoreVelocity BOOL // NOT NULL DEFAULT 0, PRIMARY KEY (id), UNIQUE INDEX uuid_index (uuid));"; private static String INSERT_ACCOUNT = "INSERT INTO accountPreferences (uuid) VALUES (?) ON DUPLICATE KEY UPDATE uuid=uuid;"; - private static String UPDATE_ACCOUNT_PREFERENCES = "UPDATE accountPreferences SET games = ?, visibility = ?, showChat = ?, friendChat = ?, privateMessaging = ?, partyRequests = ?, invisibility = ?, forcefield = ?, showMacReports = ?, ignoreVelocity = ?, pendingFriendRequests = ?, friendDisplayInventoryUI = ?, clanTips = ?, hubMusic = ? WHERE uuid=?;"; + private static String UPDATE_ACCOUNT_PREFERENCES = "UPDATE accountPreferences SET games = ?, visibility = ?, showChat = ?, friendChat = ?, privateMessaging = ?, partyRequests = ?, invisibility = ?, forcefield = ?, showMacReports = ?, ignoreVelocity = ?, pendingFriendRequests = ?, friendDisplayInventoryUI = ?, clanTips = ?, hubMusic = ?, disableAds = ? WHERE uuid=?;"; public PreferencesRepository(JavaPlugin plugin) { @@ -62,8 +62,9 @@ public class PreferencesRepository extends RepositoryBase preparedStatement.setBoolean(12, entry.getValue().friendDisplayInventoryUI); preparedStatement.setBoolean(13, entry.getValue().ClanTips); preparedStatement.setBoolean(14, entry.getValue().HubMusic); + preparedStatement.setBoolean(15, entry.getValue().DisableAds); System.out.println(">> " + entry.getValue().ClanTips); - preparedStatement.setString(15, entry.getKey()); + preparedStatement.setString(16, entry.getKey()); preparedStatement.addBatch(); } @@ -91,8 +92,9 @@ public class PreferencesRepository extends RepositoryBase preparedStatement.setBoolean(12, entry.getValue().friendDisplayInventoryUI); preparedStatement.setBoolean(13, entry.getValue().ClanTips); preparedStatement.setBoolean(14, entry.getValue().HubMusic); + preparedStatement.setBoolean(15, entry.getValue().DisableAds); System.out.println(">> " + entry.getValue().ClanTips); - preparedStatement.setString(15, entry.getKey()); + preparedStatement.setString(16, entry.getKey()); preparedStatement.execute(); } @@ -125,6 +127,7 @@ public class PreferencesRepository extends RepositoryBase preferences.friendDisplayInventoryUI = resultSet.getBoolean(12); preferences.ClanTips = resultSet.getBoolean(13); preferences.HubMusic = resultSet.getBoolean(14); + preferences.DisableAds = resultSet.getBoolean(15); System.out.println("<< " + resultSet.getBoolean(13)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/UserPreferences.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/UserPreferences.java index 4036b494f..ee8e1ca3b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/UserPreferences.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/UserPreferences.java @@ -17,4 +17,5 @@ public class UserPreferences public boolean friendDisplayInventoryUI = true; public boolean ClanTips = true; public volatile boolean HubMusic = true; + public boolean DisableAds = false; } 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 27e20e3d6..a6ae4f518 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java @@ -26,6 +26,7 @@ public class PreferencesPage extends ShopPageBase _achievementManager.setGiveInterfaceItem(true); _packetHandler = packetHandler; - new NotificationManager(getPlugin(), clientManager); + new NotificationManager(getPlugin(), clientManager, preferences); new BotSpamManager(plugin, clientManager, punish); ((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true; @@ -290,6 +291,14 @@ public class HubManager extends MiniClientPlugin NoteSong song = _songs.get(index); if (song != null) { + for (Player player : UtilServer.getPlayers()) + { + if (_preferences.Get(player).HubMusic) + { + UtilTextBottom.display(C.cWhite + "Now Playing " + C.cYellow + song.getName(), player); + } + } + new NotePlayer(_plugin, song, new INoteVerifier() { @Override @@ -1003,7 +1012,7 @@ public class HubManager extends MiniClientPlugin { if (event.getGadget() != null && event.getGadget().getGadgetType() == GadgetType.MusicDisc) { - UtilPlayer.message(event.getPlayer(), F.main("Hub", "Music Discs are disabled right now")); + UtilPlayer.message(event.getPlayer(), F.main("Hub", "Music Discs are disabled right now!")); event.setCancelled(true); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 8a852224a..21e3ea398 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -308,8 +308,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation new SoupAddon(plugin, this); new TeamArmorAddon(plugin, this); - new NotificationManager(getPlugin(), clientManager); - +// new NotificationManager(getPlugin(), clientManager); + new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, giveawayManager); //Champions Modules diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index ce83a8995..0c7481f59 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -68,11 +68,8 @@ public class GameManager implements Listener if (event.getType() != UpdateType.MIN_08) return; - if (Manager.GetGame() == null) - return; - for (Player player : UtilServer.getPlayers()) - if (!Manager.GetGame().IsAlive(player)) + if ((Manager.getName() == null || !Manager.GetGame().IsAlive(player)) && !Manager.getPreferences().Get(player).DisableAds) { player.sendMessage(C.cWhite + " "); player.sendMessage(C.cRedB + " MASSIVE WINTER SALE"); From 4ba2e8c96c56f1819407c4e3a4156a9004dc89b6 Mon Sep 17 00:00:00 2001 From: Cheese Date: Tue, 8 Dec 2015 10:31:11 +1100 Subject: [PATCH 36/54] fixed old staff being stuck invis. partially changed scoreboard to show playercount --- .../src/mineplex/hub/HubClient.java | 14 +------------- .../src/mineplex/hub/HubManager.java | 17 ++++++++--------- .../hub/modules/HubVisibilityManager.java | 2 +- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java index 4008f1b63..4b56eff02 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java @@ -22,9 +22,7 @@ public class HubClient public int DisplayLength = 16; private int _lastGemCount = 0; - - private int _lastCoinCount = 0; - + public HubClient(String name) { ScoreboardString = " Welcome " + name + ", to the Mineplex Network!"; @@ -133,14 +131,4 @@ public class HubClient return display; } - - public void SetLastCoinCount(int coins) - { - _lastCoinCount = coins; - } - - public int GetLastCoinCount() - { - return _lastCoinCount; - } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index ea96b4c65..8e78486e7 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -165,7 +165,7 @@ public class HubManager extends MiniClientPlugin private HashMap _scoreboards = new HashMap(); private String _serverName = ""; - + private int _lastPlayerCount = 0; private boolean _shuttingDown; private HashMap _portalTime = new HashMap(); @@ -719,15 +719,14 @@ public class HubManager extends MiniClientPlugin //Space obj.getScore(" ").setScore(line--); - //Coins - obj.getScore(C.cYellow + C.Bold + "Coins").setScore(line--); + //Players + obj.getScore(C.cYellow + C.Bold + "Players").setScore(line--); - // Remove Old - player.getScoreboard().resetScores(Get(player.getName()).GetLastCoinCount() + ""); - // Add New - obj.getScore(GetDonation().Get(player.getName()).getCoins() + "").setScore(line--); - - Get(player.getName()).SetLastCoinCount(GetDonation().Get(player.getName()).getCoins()); + player.getScoreboard().resetScores(_lastPlayerCount + ""); + + _lastPlayerCount++; + + obj.getScore(_lastPlayerCount + "").setScore(line--); //Space diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java index db7624cd9..1733a2fcc 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java @@ -65,7 +65,7 @@ public class HubVisibilityManager extends MiniPlugin { boolean hideMe = Manager.GetTutorial().InTutorial(player) || UtilMath.offset2d(player.getLocation(), Manager.GetSpawn()) == 0 || - Manager.getPreferences().Get(player).Invisibility || + (Manager.getPreferences().Get(player).Invisibility && Manager.GetClients().Get(player).GetRank().has(Rank.MODERATOR)) || _hiddenPlayers.contains(player); for (Player other : UtilServer.getPlayers()) From fe1f763374bcaf0b98839715b97ed7c81131b87e Mon Sep 17 00:00:00 2001 From: Cheese Date: Tue, 8 Dec 2015 15:26:32 +1100 Subject: [PATCH 37/54] changed order blocks will be added to the list --- .../src/mineplex/core/common/util/UtilBlock.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index da7bc464c..8f3b37176 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -552,8 +552,8 @@ public class UtilBlock if (diagonals) { for (int x = -1; x <= 1; x++) - for (int y = -1; y <= 1; y++) - for (int z = -1; z <= 1; z++) + for (int z = -1; z <= 1; z++) + for (int y = 1; y >= -1; y--) { if (x == 0 && y == 0 && z == 0) continue; @@ -563,11 +563,11 @@ public class UtilBlock else { blocks.add(block.getRelative(BlockFace.UP)); - blocks.add(block.getRelative(BlockFace.DOWN)); blocks.add(block.getRelative(BlockFace.NORTH)); blocks.add(block.getRelative(BlockFace.SOUTH)); blocks.add(block.getRelative(BlockFace.EAST)); blocks.add(block.getRelative(BlockFace.WEST)); + blocks.add(block.getRelative(BlockFace.DOWN)); } return blocks; From a84f580719d1b221bbcaa49cd19d4251defa3b11 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Tue, 8 Dec 2015 05:45:26 -0500 Subject: [PATCH 38/54] Update IntelliJ to Java 8 --- Plugins/.idea/compiler.xml | 3 ++- Plugins/.idea/misc.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Plugins/.idea/compiler.xml b/Plugins/.idea/compiler.xml index 30263f09d..b232f8467 100644 --- a/Plugins/.idea/compiler.xml +++ b/Plugins/.idea/compiler.xml @@ -5,6 +5,7 @@ + @@ -28,7 +29,7 @@ - + - + \ No newline at end of file From b22c64ca6a5419e6b23abea1681cc750d15b6d37 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Tue, 8 Dec 2015 05:51:21 -0500 Subject: [PATCH 39/54] Fix excludes --- Plugins/.idea/compiler.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/Plugins/.idea/compiler.xml b/Plugins/.idea/compiler.xml index b232f8467..df8666836 100644 --- a/Plugins/.idea/compiler.xml +++ b/Plugins/.idea/compiler.xml @@ -5,7 +5,6 @@ - From addb2c8c0e91c5ac1162d5d09ed1cca5b4611910 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Tue, 8 Dec 2015 08:02:40 -0500 Subject: [PATCH 40/54] Fix java 8 compiler issue --- .../game/arcade/game/games/smash/perks/PerkCowAngryHerd.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java index 79f51f53b..d398bba74 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java @@ -87,7 +87,8 @@ public class PerkCowAngryHerd extends SmashPerk loc.add(UtilAlg.getLeft(dir).multiply(i*1.5)); Manager.GetGame().CreatureAllowOverride = true; - Cow cow = player.getWorld().spawn(loc, isSuperActive(player) ? MushroomCow.class : Cow.class); + Class clazz = isSuperActive(player) ? MushroomCow.class : Cow.class; + Cow cow = player.getWorld().spawn(loc, clazz); Manager.GetGame().CreatureAllowOverride = false; _active.add(new DataCowCharge(player, cow)); From a1915e324c4a7af83142cd83a518c101b925966b Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Tue, 8 Dec 2015 08:42:45 -0500 Subject: [PATCH 41/54] Some java 8 code --- .../mineplex/core/common/util/UtilServer.java | 7 ++ .../mineplex/core/noteblock/NotePlayer.java | 94 ++++++++----------- 2 files changed, 45 insertions(+), 56 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java index c56faa15a..79f248c3d 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java @@ -1,10 +1,12 @@ package mineplex.core.common.util; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.LinkedList; import java.util.List; +import java.util.stream.Stream; import org.bukkit.Bukkit; import org.bukkit.Server; @@ -18,6 +20,11 @@ public class UtilServer return getServer().getOnlinePlayers().toArray(new Player[0]); } + public static Collection getPlayersCollection() + { + return getServer().getOnlinePlayers(); + } + public static List getSortedPlayers() { return getSortedPlayers(new Comparator() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java index 941bc1dd9..70e5a8c1f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java @@ -1,7 +1,10 @@ package mineplex.core.noteblock; import java.util.ArrayList; +import java.util.Collection; import java.util.List; +import java.util.Objects; +import java.util.stream.Stream; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -40,78 +43,57 @@ public class NotePlayer private void startThread() { - Thread thread = new Thread(new Runnable() - { - @Override - public void run() + Thread thread = new Thread(() -> { + while (!_finished) { - long startTime = System.currentTimeMillis(); - while (!_finished) + _tick++; + if (_tick > _song.getLength()) { - _tick++; - if (_tick > _song.getLength()) + if (_loop) { - if (_loop) - { - _tick = 1; - } - else - { - _finished = true; - - _plugin.getServer().getScheduler().runTask(_plugin, new Runnable() - { - @Override - public void run() - { - SongFinishEvent event = new SongFinishEvent(_song); - _plugin.getServer().getPluginManager().callEvent(event); - } - }); - - return; - } + _tick = 1; } - - playTick(_tick); - - try + else { - Thread.sleep(_sleepMs); - } - catch (InterruptedException e) - { - e.printStackTrace(); + _finished = true; + + _plugin.getServer().getScheduler().runTask(_plugin, () -> { + SongFinishEvent event = new SongFinishEvent(_song); + _plugin.getServer().getPluginManager().callEvent(event); + }); + + return; } } + + playTick(_tick); + + try + { + Thread.sleep(_sleepMs); + } + catch (InterruptedException e) + { + e.printStackTrace(); + } } }); thread.start(); } + private void playNote(Note note, float volume, Collection players) + { + players.stream().filter(_verifier::shouldPlay).forEach((player) -> + player.playSound(player.getEyeLocation(), UtilNote.getInstrumentSound(note.getInstrument()), volume, (float) UtilNote.getPitch(note.getNote() - 33))); + } + private void playTick(int tick) { - Player[] playerArray = UtilServer.getPlayers(); - List players = new ArrayList<>(playerArray.length); - for (Player player : playerArray) - { - if (_verifier.shouldPlay(player)) - players.add(player); - } + Collection players = UtilServer.getPlayersCollection(); - for (NoteLayer layer : _song.getLayers()) - { - Note note = layer.getNote(tick); - if (note != null) - { - float volume = _volumeMult * (layer.getVolume() / 100F); - for (Player player : players) - { - player.playSound(player.getEyeLocation(), UtilNote.getInstrumentSound(note.getInstrument()), volume, (float) UtilNote.getPitch(note.getNote() - 33)); - } - } - } + float volume = _volumeMult * 1F; + _song.getLayers().stream().map(layer -> layer.getNote(tick)).filter(Objects::nonNull).forEach((note) -> playNote(note, volume, players)); } public void cancel() From 2bf1012fa41ec41d71e8bea7489786bd6ea21805 Mon Sep 17 00:00:00 2001 From: Teddy Date: Tue, 8 Dec 2015 16:34:07 +0000 Subject: [PATCH 42/54] SSM Pig bomb bug fix --- .../mineplex/core/common/util/UtilPlayer.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java index af1712362..8f4e98a6a 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java @@ -1,5 +1,7 @@ package mineplex.core.common.util; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.LinkedList; @@ -496,6 +498,20 @@ public class UtilPlayer return best; } + private static boolean checkClosest(Player player, Entity... ignore) + { + for(Entity e : ignore) + { + if(e instanceof Player) + { + if(e == player) + return true; + } + } + + return false; + } + public static Player getClosest(Location loc, Entity... ignore) { Player best = null; @@ -509,6 +525,9 @@ public class UtilPlayer if (cur.isDead()) continue; + if(checkClosest(cur, ignore)) + continue; + if (ignore != null) { for (int i = 0; i < ignore.length; i++) From 504a49278cb7e140029e4c2ceb85f3defe524a33 Mon Sep 17 00:00:00 2001 From: Teddy Date: Tue, 8 Dec 2015 16:35:49 +0000 Subject: [PATCH 43/54] SSM kit description change, grammar mistake --- .../src/nautilus/game/arcade/game/games/smash/kits/KitPig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java index 755cfa69d..4ae1fcb33 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java @@ -62,7 +62,7 @@ public class KitPig extends SmashKit ChatColor.RESET + "dealing damage and knockback to enemies.", ChatColor.RESET + "", ChatColor.RESET + "Eat the bacon to restore some Energy.", - ChatColor.RESET + "Bacon that hit an enemy will restore Health.", + ChatColor.RESET + "Bacon that hits an enemy will restore Health.", })); From 09d8367b4baa87630524cd9c2b11685dc7ad764d Mon Sep 17 00:00:00 2001 From: Cheese Date: Wed, 9 Dec 2015 07:32:36 +1100 Subject: [PATCH 44/54] fixed method --- .../mineplex/core/common/util/UtilPlayer.java | 31 +++++++------------ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java index 8f4e98a6a..f1e17e2df 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java @@ -498,20 +498,6 @@ public class UtilPlayer return best; } - private static boolean checkClosest(Player player, Entity... ignore) - { - for(Entity e : ignore) - { - if(e instanceof Player) - { - if(e == player) - return true; - } - } - - return false; - } - public static Player getClosest(Location loc, Entity... ignore) { Player best = null; @@ -525,16 +511,21 @@ public class UtilPlayer if (cur.isDead()) continue; - if(checkClosest(cur, ignore)) - continue; - + //Ignore Check if (ignore != null) { - for (int i = 0; i < ignore.length; i++) + boolean shouldIgnore = false; + for (Entity ent : ignore) { - if (cur.equals(ignore[i])) - continue; + if (cur.equals(ent)) + { + shouldIgnore = true; + break; + } } + + if (shouldIgnore) + continue; } double dist = UtilMath.offset(cur.getLocation(), loc); From 2decc049c5af3786d4326e74f50bf5e0ca485450 Mon Sep 17 00:00:00 2001 From: Cheese Date: Wed, 9 Dec 2015 07:47:07 +1100 Subject: [PATCH 45/54] fixed my muddling of perks --- .../game/games/monsterleague/kits/KitEnderman.java | 5 ++--- ...{PerkBlink.java => PerkBlinkMonsterLeague.java} | 8 +++----- .../nautilus/game/arcade/kit/perks/PerkBlink.java | 14 ++++++++++---- 3 files changed, 15 insertions(+), 12 deletions(-) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/{PerkBlink.java => PerkBlinkMonsterLeague.java} (94%) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java index 20796f801..5f1c52111 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java @@ -6,12 +6,11 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; -import mineplex.core.disguise.disguises.DisguiseEnderman; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.monsterleague.perks.PerkBlinkMonsterLeague; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBlink; import nautilus.game.arcade.kit.perks.PerkDoubleJump; public class KitEnderman extends LeagueKit @@ -28,7 +27,7 @@ public class KitEnderman extends LeagueKit new Perk[] { new PerkDoubleJump("Double Jump", 1, 1, true), - new PerkBlink("Blink", 32, 16000), + new PerkBlinkMonsterLeague("Blink", 32, 16000), }, EntityType.ENDERMAN, new ItemStack(Material.AIR), 1.4); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlink.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlinkMonsterLeague.java similarity index 94% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlink.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlinkMonsterLeague.java index 75e0654a9..de32a72e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlink.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlinkMonsterLeague.java @@ -19,14 +19,15 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashPerk; -public class PerkBlink extends SmashPerk +public class PerkBlinkMonsterLeague extends Perk { private double _range = 32; private long _recharge = 24000; - public PerkBlink(String name, double range, long recharge) + public PerkBlinkMonsterLeague(String name, double range, long recharge) { super("Blink", new String[] { @@ -51,9 +52,6 @@ public class PerkBlink extends SmashPerk return; Player player = event.getPlayer(); - - if (isSuperActive(player)) - return; if (!Kit.HasKit(player)) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java index 4890bc63e..dfbc490a4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java @@ -17,11 +17,12 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; -import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.SmashPerk; -public class PerkBlink extends Perk +public class PerkBlink extends SmashPerk { private String _name = ""; private double _range; @@ -45,17 +46,22 @@ public class PerkBlink extends Perk if (event.isCancelled()) return; - if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK && - event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) return; if (UtilBlock.usable(event.getClickedBlock())) return; + + if (!UtilGear.isAxe(event.getPlayer().getItemInHand())) + return; Player player = event.getPlayer(); if (!Kit.HasKit(player)) return; + + if (isSuperActive(player)) + return; if (!Recharge.Instance.use(player, _name, _recharge, true, true)) return; From fba88ec231a1aa2a68868faa7e6436c4448da0b5 Mon Sep 17 00:00:00 2001 From: Cheese Date: Wed, 9 Dec 2015 08:19:55 +1100 Subject: [PATCH 46/54] mount stuff is fixed --- .../mineplex/core/mount/types/MountCart.java | 2 +- .../mineplex/core/mount/types/MountSlime.java | 98 ++++++++++--------- 2 files changed, 51 insertions(+), 49 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java index 3abbf00e0..f5aa7f809 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java @@ -75,7 +75,7 @@ public class MountCart extends Mount> if (event.getRightClicked() == null) return; - SingleEntityMountData mount = GetActive().get(event.getPlayer()); + SingleEntityMountData mount = getMountData(event.getRightClicked()); if(mount == null) return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java index 2a0b3831a..e8a1bd649 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java @@ -30,11 +30,11 @@ public class MountSlime extends Mount> { super(manager, "Slime Mount", Material.SLIME_BALL, (byte)0, new String[] { - ChatColor.RESET + "Bounce around on your very", - ChatColor.RESET + "own personal slime friend!", + ChatColor.RESET + "Bounce around on your very", + ChatColor.RESET + "own personal slime friend!", }, 15000); - + KnownPackage = false; } @@ -42,153 +42,155 @@ public class MountSlime extends Mount> { player.leaveVehicle(); player.eject(); - + //Remove other mounts Manager.DeregisterAll(player); - + SingleEntityMountData mount = new SingleEntityMountData(player, player.getWorld().spawn(player.getLocation(), Slime.class)); mount.getEntity().setSize(2); - + mount.getEntity().setCustomName(player.getName() + "'s " + GetName()); //Inform UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); - + //Store _active.put(player, mount); } - + public void Disable(Player player) { SingleEntityMountData mount = _active.remove(player); if (mount != null) { mount.remove(); - + //Inform UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + ".")); - + Manager.removeActive(player); } } - + @EventHandler public void interactMount(PlayerInteractEntityEvent event) { if (event.getRightClicked() == null) return; - - if (!GetActive().containsKey(event.getPlayer())) - return; - - if(!GetActive().get(event.getPlayer()).ownsMount(event.getPlayer())) - return; - + + SingleEntityMountData data = GetActive().get(event.getPlayer()); + + if(data == null) return; + + if(!data.ownsMount(event.getPlayer())) return; + + if(!data.isPartOfMount(event.getRightClicked())) return; + event.getPlayer().leaveVehicle(); event.getPlayer().eject(); - + event.getRightClicked().setPassenger(event.getPlayer()); } - + @EventHandler public void target(EntityTargetEvent event) { if (!GetActive().containsKey(event.getTarget())) return; - + if (!GetActive().get(event.getTarget()).equals(event.getEntity())) event.setCancelled(true); } - + @EventHandler public void updateBounce(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; - + //Bounce for (SingleEntityMountData slimeData : GetActive().values()) { Slime slime = slimeData.getEntity(); - + if (slime.getPassenger() == null) { UtilEnt.setFakeHead(slime, false); continue; } - + if (!UtilEnt.isGrounded(slime)) continue; - + if (!(slime.getPassenger() instanceof Player)) continue; - + Player player = (Player)slime.getPassenger(); - + if (!Recharge.Instance.use(player, GetName(), 200, false, false)) continue; Vector dir = slime.getPassenger().getLocation().getDirection(); - + UtilAction.velocity(slime, dir, 1, true, 0, 0.4, 1, true); - + UtilEnt.CreatureForceLook(slime, 0, UtilAlg.GetYaw(dir)); - + slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.75f); } - + //Collide for (SingleEntityMountData slimeData : GetActive().values()) { Slime slime = slimeData.getEntity(); if (slime.getPassenger() == null) continue; - + if (!(slime.getPassenger() instanceof Player)) continue; - + Player player = (Player)slime.getPassenger(); - + if (!Recharge.Instance.usable(player, GetName() + " Collide")) continue; - + for (SingleEntityMountData otherSlime : GetActive().values()) { Slime other = otherSlime.getEntity(); - + if (other.equals(slime)) continue; - + if (other.getPassenger() == null) continue; - + if (!(other.getPassenger() instanceof Player)) continue; - + Player otherPlayer = (Player)other.getPassenger(); - + if (!Recharge.Instance.usable(otherPlayer, GetName() + " Collide")) continue; - + //Collide if (UtilMath.offset(slime, other) > 2) continue; - + Recharge.Instance.useForce(player, GetName() + " Collide", 500); Recharge.Instance.useForce(otherPlayer, GetName() + " Collide", 500); - + UtilAction.velocity(slime, UtilAlg.getTrajectory(other, slime), 1.2, false, 0, 0.8, 10, true); UtilAction.velocity(other, UtilAlg.getTrajectory(slime, other), 1.2, false, 0, 0.8, 10, true); - + slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_ATTACK, 1f, 0.5f); slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.5f); other.getWorld().playSound(other.getLocation(), Sound.SLIME_WALK, 1f, 0.5f); - + slime.playEffect(EntityEffect.HURT); other.playEffect(EntityEffect.HURT); } } } - - + + } From 26c5c419f8ee1c75357063822608f525bfab438a Mon Sep 17 00:00:00 2001 From: Cheese Date: Wed, 9 Dec 2015 08:38:05 +1100 Subject: [PATCH 47/54] fixed a bug where old displayName would be used after name was updated. --- .../src/nautilus/game/arcade/game/Game.java | 18 ++++++++++++++++++ .../nautilus/game/arcade/game/GameTeam.java | 9 ++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 7616b98ad..edf144f5e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -36,6 +36,7 @@ import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.hanging.HangingPlaceEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -1723,4 +1724,21 @@ public abstract class Game implements Listener } } } + + @EventHandler + public void debug(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().equals("/debugteams")) + { + for (GameTeam team : GetTeamList()) + { + event.getPlayer().sendMessage(team.GetFormattedName()); + + for (Player player : team.GetPlayers(false)) + { + event.getPlayer().sendMessage(player.getName() + ": " + team.IsAlive(player)); + } + } + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java index ddbd4f68c..7d8264b88 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java @@ -79,7 +79,7 @@ public class GameTeam { Host = host; - _displayName = name; + _displayName = null; _name = name; _color = color; _spawns = spawns; @@ -178,7 +178,7 @@ public class GameTeam { _players.put(player, in ? PlayerState.IN : PlayerState.OUT); - UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + _displayName + " Team.")); + UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + getDisplayName() + " Team.")); VisibilityManager.Instance.refreshPlayerToAll(player); } @@ -192,7 +192,7 @@ public class GameTeam other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name + _name.toUpperCase()).removePlayer(player); other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name).addPlayer(player); } - UtilPlayer.message(player, F.main("Team", _color + C.Bold + _displayName + " Team was disbanded.")); + UtilPlayer.message(player, F.main("Team", _color + C.Bold + getDisplayName() + " Team was disbanded.")); } _players.clear(); @@ -323,6 +323,9 @@ public class GameTeam public String getDisplayName() { + if (_displayName == null) + return _name; + return _displayName; } From 2e496110355bf265705015b054b63e9c85f75af2 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Tue, 8 Dec 2015 17:45:27 -0500 Subject: [PATCH 48/54] LinkedHashMaps, Buttons --- .../hub/server/ui/ServerGameMenu.java | 6 +++-- .../hub/server/ui/button/SelectBHButton.java | 23 +++++++++++++++++++ .../hub/server/ui/button/SelectMSButton.java | 23 +++++++++++++++++++ .../nautilus/game/arcade/world/WorldData.java | 8 +++---- 4 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBHButton.java create mode 100644 Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectMSButton.java diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 3cafbb8bf..4e3bc8320 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -14,12 +14,14 @@ import mineplex.core.donation.DonationManager; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.shop.page.ShopPageBase; import mineplex.hub.server.ServerManager; +import mineplex.hub.server.ui.button.SelectBHButton; import mineplex.hub.server.ui.button.SelectBLDButton; import mineplex.hub.server.ui.button.SelectBRButton; import mineplex.hub.server.ui.button.SelectCSButton; import mineplex.hub.server.ui.button.SelectDMTButton; import mineplex.hub.server.ui.button.SelectDOMButton; import mineplex.hub.server.ui.button.SelectMINButton; +import mineplex.hub.server.ui.button.SelectMSButton; import mineplex.hub.server.ui.button.SelectPLAYERButton; import mineplex.hub.server.ui.button.SelectSGButton; import mineplex.hub.server.ui.button.SelectSKYButton; @@ -193,9 +195,9 @@ public class ServerGameMenu extends ShopPageBase getButtonMap().put(8, new SelectWIZButton(this)); getButtonMap().put(18, new SelectCSButton(this)); -// getButtonMap().put(20, new SelectBHButton(this)); + getButtonMap().put(20, new SelectBHButton(this)); getButtonMap().put(22, new SelectSSMButton(this)); -// getButtonMap().put(24, new SelectMSButton(this)); + getButtonMap().put(24, new SelectMSButton(this)); getButtonMap().put(26, new SelectDMTButton(this)); getButtonMap().put(36, new SelectDOMButton(this)); getButtonMap().put(38, new SelectTDMButton(this)); 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 new file mode 100644 index 000000000..fea9423b6 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBHButton.java @@ -0,0 +1,23 @@ +package mineplex.hub.server.ui.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.shop.item.IButton; +import mineplex.hub.server.ui.ServerGameMenu; + +public class SelectBHButton implements IButton +{ + private ServerGameMenu _menu; + + public SelectBHButton(ServerGameMenu menu) + { + _menu = menu; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + _menu.OpenBH(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 new file mode 100644 index 000000000..ca500cb25 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectMSButton.java @@ -0,0 +1,23 @@ +package mineplex.hub.server.ui.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.shop.item.IButton; +import mineplex.hub.server.ui.ServerGameMenu; + +public class SelectMSButton implements IButton +{ + private ServerGameMenu _menu; + + public SelectMSButton(ServerGameMenu menu) + { + _menu = menu; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + _menu.openMS(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java index 068035b74..74242f538 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java @@ -54,10 +54,10 @@ public class WorldData public GameType Game = null; - public HashMap> SpawnLocs = new HashMap>(); - private HashMap> DataLocs = new HashMap>(); - private HashMap> CustomLocs = new HashMap>(); - private final Map _dataEntries = new HashMap<>(); + public HashMap> SpawnLocs = new LinkedHashMap>(); + private HashMap> DataLocs = new LinkedHashMap>(); + private HashMap> CustomLocs = new LinkedHashMap>(); + private final Map _dataEntries = new LinkedHashMap<>(); public WorldData(Game game) { From fabf3dab5919f4cae2bcc256689b84e1b97240af Mon Sep 17 00:00:00 2001 From: Cheese Date: Thu, 10 Dec 2015 13:12:01 +1100 Subject: [PATCH 49/54] updated blocksearch --- .../src/mineplex/core/common/util/UtilBlock.java | 7 +++++-- Plugins/Nautilus.Game.Arcade/.classpath | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 6 +++--- .../src/nautilus/game/arcade/ArcadeManager.java | 2 -- .../nautilus/game/arcade/game/games/event/EventGame.java | 2 -- .../game/arcade/game/games/monsterleague/Ball.java | 2 -- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index 8f3b37176..c0a7f5f3b 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -835,7 +835,7 @@ public class UtilBlock return getBedHead(bed.getBlock()) != null && getBedFoot(bed.getBlock()) != null; } - public static HashSet findConnectedBlocks(Block block, HashSet blocks, int limit) + public static HashSet findConnectedBlocks(Block source, Block block, HashSet blocks, int limit, double range) { if (blocks == null) blocks = new HashSet(); @@ -852,10 +852,13 @@ public class UtilBlock { if (neighbour.getType() == Material.AIR) continue; + + if (UtilMath.offset(source.getLocation(), neighbour.getLocation()) > range) + continue; //If neighbour hasn't been searched, recursively search it! if (!blocks.contains(neighbour)) - findConnectedBlocks(neighbour, blocks, limit); + findConnectedBlocks(source, neighbour, blocks, limit, range); } return blocks; diff --git a/Plugins/Nautilus.Game.Arcade/.classpath b/Plugins/Nautilus.Game.Arcade/.classpath index 0c832983c..315ba497a 100644 --- a/Plugins/Nautilus.Game.Arcade/.classpath +++ b/Plugins/Nautilus.Game.Arcade/.classpath @@ -1,7 +1,7 @@ - + diff --git a/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.core.prefs b/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.core.prefs index 70732762e..bfbbfb4d1 100644 --- a/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.core.prefs +++ b/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.core.prefs @@ -1,14 +1,14 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=next_line org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 21e3ea398..fbf22d621 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -308,8 +308,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation new SoupAddon(plugin, this); new TeamArmorAddon(plugin, this); -// new NotificationManager(getPlugin(), clientManager); - new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, giveawayManager); //Champions Modules diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index 31e1a164a..03499db01 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -77,8 +77,6 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import com.sun.xml.internal.ws.resources.UtilMessages; - public class EventGame extends Game { private GameHostManager _mps; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java index 5b901bc62..65af10219 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java @@ -30,8 +30,6 @@ import org.bukkit.entity.Projectile; import org.bukkit.entity.Slime; import org.bukkit.util.Vector; -import sun.rmi.runtime.Log; - public class Ball { private MonsterLeague _host; From eaf393700400e4367576541879353573352e07b1 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Thu, 10 Dec 2015 20:02:12 +1300 Subject: [PATCH 50/54] Fix the damage while walking on falling block --- .../src/nautilus/game/arcade/game/games/runner/Runner.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java index 59c1a8896..1cd250deb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java @@ -302,6 +302,11 @@ public class Runner extends SoloGame implements IThrown { return; } + + if (target.getLocation().getY() > data.GetThrown().getLocation().getY() + 0.5) + { + return; + } } //Damage Event From 851b613d2e6a9e2db6ba71d19a12729888b5fe3f Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 10 Dec 2015 17:04:15 -0500 Subject: [PATCH 51/54] Now playing fix --- .../mineplex/core/noteblock/NBSReader.java | 7 +- .../mineplex/core/noteblock/NotePlayer.java | 94 +++++++++++-------- .../src/mineplex/hub/HubManager.java | 2 +- 3 files changed, 62 insertions(+), 41 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NBSReader.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NBSReader.java index 1ca887ede..e7844c9d1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NBSReader.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NBSReader.java @@ -16,10 +16,10 @@ public class NBSReader { public static NoteSong loadSong(String fileName) throws FileNotFoundException { - return loadSong(new DataInputStream(new FileInputStream(new File(fileName)))); + return loadSong(new DataInputStream(new FileInputStream(new File(fileName))), fileName); } - public static NoteSong loadSong(DataInputStream stream) + public static NoteSong loadSong(DataInputStream stream, String defaultName) { try { @@ -41,6 +41,9 @@ public class NBSReader int blocksRemoved = readInt(stream); String midiFileName = readString(stream); + if ((name == null || name.length() == 0) && defaultName != null) + name = defaultName; + HashMap layerMap = new HashMap(); // Note Block Information diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java index 70e5a8c1f..941bc1dd9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java @@ -1,10 +1,7 @@ package mineplex.core.noteblock; import java.util.ArrayList; -import java.util.Collection; import java.util.List; -import java.util.Objects; -import java.util.stream.Stream; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -43,38 +40,49 @@ public class NotePlayer private void startThread() { - Thread thread = new Thread(() -> { - while (!_finished) + Thread thread = new Thread(new Runnable() + { + @Override + public void run() { - _tick++; - if (_tick > _song.getLength()) + long startTime = System.currentTimeMillis(); + while (!_finished) { - if (_loop) + _tick++; + if (_tick > _song.getLength()) { - _tick = 1; + if (_loop) + { + _tick = 1; + } + else + { + _finished = true; + + _plugin.getServer().getScheduler().runTask(_plugin, new Runnable() + { + @Override + public void run() + { + SongFinishEvent event = new SongFinishEvent(_song); + _plugin.getServer().getPluginManager().callEvent(event); + } + }); + + return; + } } - else + + playTick(_tick); + + try { - _finished = true; - - _plugin.getServer().getScheduler().runTask(_plugin, () -> { - SongFinishEvent event = new SongFinishEvent(_song); - _plugin.getServer().getPluginManager().callEvent(event); - }); - - return; + Thread.sleep(_sleepMs); + } + catch (InterruptedException e) + { + e.printStackTrace(); } - } - - playTick(_tick); - - try - { - Thread.sleep(_sleepMs); - } - catch (InterruptedException e) - { - e.printStackTrace(); } } }); @@ -82,18 +90,28 @@ public class NotePlayer thread.start(); } - private void playNote(Note note, float volume, Collection players) - { - players.stream().filter(_verifier::shouldPlay).forEach((player) -> - player.playSound(player.getEyeLocation(), UtilNote.getInstrumentSound(note.getInstrument()), volume, (float) UtilNote.getPitch(note.getNote() - 33))); - } - private void playTick(int tick) { - Collection players = UtilServer.getPlayersCollection(); + Player[] playerArray = UtilServer.getPlayers(); + List players = new ArrayList<>(playerArray.length); + for (Player player : playerArray) + { + if (_verifier.shouldPlay(player)) + players.add(player); + } - float volume = _volumeMult * 1F; - _song.getLayers().stream().map(layer -> layer.getNote(tick)).filter(Objects::nonNull).forEach((note) -> playNote(note, volume, players)); + for (NoteLayer layer : _song.getLayers()) + { + Note note = layer.getNote(tick); + if (note != null) + { + float volume = _volumeMult * (layer.getVolume() / 100F); + for (Player player : players) + { + player.playSound(player.getEyeLocation(), UtilNote.getInstrumentSound(note.getInstrument()), volume, (float) UtilNote.getPitch(note.getNote() - 33)); + } + } + } } public void cancel() diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 78bf6f694..2dd2823cb 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -261,7 +261,7 @@ public class HubManager extends MiniClientPlugin if (file.getName().endsWith(".nbs")) { System.out.println("Loading Song " + file.getPath()); - NoteSong song = NBSReader.loadSong(new DataInputStream(new FileInputStream(file))); + NoteSong song = NBSReader.loadSong(new DataInputStream(new FileInputStream(file)), file.getName().replace("_", " ").replace(".nbs", "")); if (song != null) { _songs.add(song); From 4d05bd5c50a5f82db4ad8038d32e134364331532 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 10 Dec 2015 20:53:38 -0500 Subject: [PATCH 52/54] Player count for chiss --- .../core/playerCount/PlayerCountManager.java | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/playerCount/PlayerCountManager.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/playerCount/PlayerCountManager.java b/Plugins/Mineplex.Core/src/mineplex/core/playerCount/PlayerCountManager.java new file mode 100644 index 000000000..c73f87d00 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/playerCount/PlayerCountManager.java @@ -0,0 +1,73 @@ +package mineplex.core.playerCount; + +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.serverdata.Region; +import mineplex.serverdata.data.BungeeServer; +import mineplex.serverdata.data.DataRepository; +import mineplex.serverdata.redis.RedisDataRepository; +import mineplex.serverdata.servers.ConnectionData; +import mineplex.serverdata.servers.ServerManager; + +public class PlayerCountManager extends MiniPlugin +{ + private Region _region; + private DataRepository _repository; + private DataRepository _secondRepository; + + private volatile int _playerCount; + + public PlayerCountManager(JavaPlugin plugin) + { + super("PlayerCount", plugin); + + _region = plugin.getConfig().getBoolean("serverstatus.us") ? Region.US : Region.EU; + + _repository = new RedisDataRepository(ServerManager.getConnection(true, ServerManager.SERVER_STATUS_LABEL), ServerManager.getConnection(false, ServerManager.SERVER_STATUS_LABEL), + Region.ALL, BungeeServer.class, "bungeeServers"); + + if (_region == Region.US) + _secondRepository = new RedisDataRepository(new ConnectionData("10.81.1.156", 6379, ConnectionData.ConnectionType.MASTER, "ServerStatus"), new ConnectionData("10.81.1.156", 6377, ConnectionData.ConnectionType.SLAVE, "ServerStatus"), + Region.ALL, BungeeServer.class, "bungeeServers"); + else + _secondRepository = new RedisDataRepository(new ConnectionData("10.33.53.16", 6379, ConnectionData.ConnectionType.MASTER, "ServerStatus"), new ConnectionData("10.33.53.16", 6377, ConnectionData.ConnectionType.SLAVE, "ServerStatus"), + Region.ALL, BungeeServer.class, "bungeeServers"); + + updatePlayerCount(); + } + + private void updatePlayerCount() + { + int totalPlayers = 0; + for (BungeeServer server : _repository.getElements()) + { + totalPlayers += server.getPlayerCount(); + } + + for (BungeeServer server : _secondRepository.getElements()) + { + totalPlayers += server.getPlayerCount(); + } + + _playerCount = totalPlayers; + } + + public int getPlayerCount() + { + return _playerCount; + } + + @EventHandler + public void refresh(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + runAsync(this::updatePlayerCount); + } + +} From 1661c056c1dda8d8c9560255a4ef595b6a4088d6 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 11 Dec 2015 15:21:05 +1300 Subject: [PATCH 53/54] Added line stuff --- .../mineplex/core/common/util/UtilText.java | 591 ++++++++++++++++-- 1 file changed, 530 insertions(+), 61 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java index 771b1ec52..c5a805558 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java @@ -1,52 +1,469 @@ package mineplex.core.common.util; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; + +import javax.imageio.ImageIO; + +import mineplex.core.common.CurrencyType; import org.apache.commons.lang.WordUtils; -import org.bukkit.Material; +import org.bukkit.ChatColor; -public class UtilText { - public static String listToString(Collection inputList, boolean comma) { - String out = ""; +public class UtilText +{ + private static HashMap _characters = new HashMap(); - for (T cur : inputList) { - out += cur.toString() + (comma ? ", " : " "); + public static enum LineFormat + { + LORE(200), CHAT(319); + + private int _length; + + private LineFormat(int length) + { + _length = length; } - if (out.length() > 0) { - out = out.substring(0, out.length() - (comma ? 2 : 1)); + public int getLength() + { + return _length; } - - return out; } - - public static int upperCaseCount(String input) { - int count = 0; - - for (int k = 0; k < input.length(); k++) { - - - char ch = input.charAt(k); - if (Character.isUpperCase(ch)) - count++; - + + static + { + try + { + InputStream inputStream = CurrencyType.class.getResourceAsStream("ascii.png"); + BufferedImage image = ImageIO.read(inputStream); + + char[] text = new char[] + { + ' ', + '!', + '"', + '#', + '$', + '%', + '&', + '\'', + '(', + ')', + '*', + '+', + ',', + '-', + '.', + '/', + '0', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + ':', + ';', + '<', + '=', + '>', + '?', + '@', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '[', + '\\', + ']', + '^', + '_', + '`', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '{', + '|', + '}', + '~' + }; + + int x = 0; + int y = 16; + + for (char c : text) + { + grab(c, image, x, y); + + if (x < 15 * 8) + { + x += 8; + } + else + { + x = 0; + y += 8; + } + } + + inputStream.close(); + } + catch (IOException e) + { + e.printStackTrace(); } - - return count; } - public static int lowerCaseCount(String input) { - int count = 0; - - for (int k = 0; k < input.length(); k++) { - - - char ch = input.charAt(k); - if (Character.isLowerCase(ch)) - count++; - + + public static String center(String string, LineFormat lineFormat) + { + int length = getLength(string); + + if (length > lineFormat.getLength()) + { + return string; } - - return count; + + // Get the number of empty pixels on both sides of the string + int div = (int) Math.floor((lineFormat.getLength() - length) / 2D); + + div -= 2; // For the gap between the strings + + return fillLine(" ", div) + string + fillLine(" ", div); + } + + public static String alignRight(String string, LineFormat lineFormat) + { + int length = getLength(string); + + if (length > lineFormat.getLength()) + { + return string; + } + + // Get the number of empty pixels on both sides of the string + int div = lineFormat.getLength() - length; + + div -= 1; // For the gap between the strings + + return fillLine(" ", div) + string; + } + + public static String centerChat(String string, LineFormat lineFormat) + { + int length = getLength(string); + + if (length > lineFormat.getLength()) + { + return string; + } + + // Get the number of empty pixels on both sides of the string + int div = (int) Math.floor(((lineFormat.getLength() + 10) - length) / 2D); + + div -= 2; // For the gap between the strings + + return fillLine(" ", div) + string; + } + + public static String substringPixels(String string, int cutoff) + { + int len = 0; + + char[] array = string.toCharArray(); + boolean bold = false; + + for (int i = 0; i < array.length; i++) + { + char c = array[i]; + + if (c == '�') + { + if (++i < array.length) + { + ChatColor color = ChatColor.getByChar(array[i]); + + if (color != null) + { + if (color.equals(ChatColor.BOLD)) + { + bold = true; + } + else if (color.equals(ChatColor.RESET) || color.isColor()) + { + bold = false; + } + } + } + + continue; + } + + if (!_characters.containsKey(c)) + { + continue; + } + + int toAdd = _characters.get(c); + + if (bold) + { + toAdd++; + } + + if (len + toAdd > cutoff) + { + return string.substring(0, Math.max(0, i - 1)); + } + + if (i + 1 < array.length) + { + len++; + } + } + + return string; + } + + public static ArrayList splitLines(String[] strings, LineFormat lineFormat) + { + ArrayList lines = new ArrayList(); + + for (String s : strings) + { + lines.addAll(splitLine(s, lineFormat)); + } + + return lines; + } + + public static ArrayList splitLine(String string, LineFormat lineFormat) + { + ArrayList strings = new ArrayList(); + String current = ""; + int currentLength = 0; + String[] split = string.split(" "); + String colors = ""; + + for (int i = 0; i < split.length; i++) + { + String word = split[i]; + int wordLength = getLength(colors + word); + + if (currentLength + wordLength + 4 > lineFormat.getLength() && !current.isEmpty()) + { + strings.add(current); + current = colors + word; + currentLength = wordLength + 1; + continue; + } + + if (i != 0) + { + current += " "; + currentLength += 4; + } + + current += word; + currentLength += wordLength; + colors = ChatColor.getLastColors(current); + } + + if (!current.isEmpty()) + { + strings.add(current); + } + + return strings; + } + + public static String fillLine(String filler, int maxPixels) + { + int pixels = getLength(filler); + + if (pixels <= 0) + { + return ""; + } + + String toReturn = ""; + int currentLen = 0; + + int offset = maxPixels % 4; + boolean isOffset = false; + + if (offset > 0) + { + toReturn += C.Bold; + } + + while (currentLen + pixels <= maxPixels) + { + currentLen += pixels + 1; + toReturn += filler; + + if (offset-- > 0) + { + currentLen++; + + if (offset == 0) + { + isOffset = false; + toReturn += ChatColor.RESET; + } + } + } + + if (isOffset) + { + toReturn += ChatColor.RESET; + } + + return toReturn; + } + + public static boolean fitsOneLine(String string, LineFormat lineFormat) + { + return getLength(string) <= lineFormat.getLength(); + } + + public static int getLength(String string) + { + int len = 0; + + char[] array = string.toCharArray(); + boolean bold = false; + + for (int i = 0; i < array.length; i++) + { + char c = array[i]; + + if (c == '�') + { + if (++i < array.length) + { + ChatColor color = ChatColor.getByChar(array[i]); + + if (color != null) + { + if (color.equals(ChatColor.BOLD)) + { + bold = true; + } + else if (color.equals(ChatColor.RESET) || color.isColor()) + { + bold = false; + } + } + } + + continue; + } + + if (!_characters.containsKey(c)) + { + continue; + } + + len += _characters.get(c); + + if (bold) + { + len++; + } + + if (i + 1 < array.length) + { + len++; + } + } + + return len; + } + + private static void grab(Character character, BufferedImage image, int imageX, int imageY) + { + if (character == ' ') + { + _characters.put(character, 3); + return; + } + + for (int x = 0; x < 8; x++) + { + boolean isTransparentLine = true; + + for (int y = 0; y < 8; y++) + { + int pixel = image.getRGB(imageX + x, imageY + y); + + if ((pixel >> 24) != 0x00) + { + isTransparentLine = false; + break; + } + } + + if (isTransparentLine) + { + _characters.put(character, x); + return; + } + } + + _characters.put(character, 8); } public static boolean isStringSimilar(String newString, String oldString, float matchRequirement) @@ -55,84 +472,136 @@ public class UtilText { { return newString.toLowerCase().equals(oldString.toLowerCase()); } - - for (int i=0 ; i < newString.length() * matchRequirement ; i++) + + for (int i = 0; i < newString.length() * matchRequirement; i++) { int matchFromIndex = 0; - - //Look for substrings starting at i - for (int j=0 ; j < oldString.length() ; j++) + + // Look for substrings starting at i + for (int j = 0; j < oldString.length(); j++) { - //End of newString - if (i+j >= newString.length()) + // End of newString + if (i + j >= newString.length()) { break; } - - //Matched - if (newString.charAt(i+j) == oldString.charAt(j)) + + // Matched + if (newString.charAt(i + j) == oldString.charAt(j)) { matchFromIndex++; - + if (matchFromIndex >= newString.length() * matchRequirement) return true; } - //No Match > Reset + // No Match > Reset else { break; } } } - + return false; } - + + public static String listToString(Collection inputList, boolean comma) + { + String out = ""; + + for (T cur : inputList) + { + out += cur.toString() + (comma ? ", " : " "); + } + + if (out.length() > 0) + { + out = out.substring(0, out.length() - (comma ? 2 : 1)); + } + + return out; + } + + public static int lowerCaseCount(String input) + { + int count = 0; + + for (int k = 0; k < input.length(); k++) + { + + char ch = input.charAt(k); + if (Character.isLowerCase(ch)) + count++; + + } + + return count; + } + + public static int upperCaseCount(String input) + { + int count = 0; + + for (int k = 0; k < input.length(); k++) + { + + char ch = input.charAt(k); + if (Character.isUpperCase(ch)) + count++; + + } + + return count; + } + public static String[] wrap(String text, int lineLength) { return wrap(text, lineLength, true); } - - public static String[] wrap(String text, int lineLength, boolean wrapLongerWords) { + + public static String[] wrap(String text, int lineLength, boolean wrapLongerWords) + { return WordUtils.wrap(text, lineLength, "\00D0", wrapLongerWords).split("\00D0"); } - + public static String repeat(String txt, int times) { return new String(new byte[times]).replace("\0", txt); } - - public static boolean plural(int x){ + + public static boolean plural(int x) + { return x <= 0 ? true : x > 1; } - public static String trim(int maxLength, String s) { + public static String trim(int maxLength, String s) + { return s.length() <= maxLength ? s : s.substring(0, maxLength); } public static String arrayToString(X[] array, String delimiter) { StringBuilder string = new StringBuilder(); - + int index = 0; for (X x : array) { string.append(x.toString()); - + if (index != array.length - 1) { string.append(delimiter); } - + index++; } - + return string.toString(); } - + public static String arrayToString(X[] array) { return arrayToString(array, null); } -} +} \ No newline at end of file From 4cfa7c436b619491bc3f167124c791a8f6838c23 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 11 Dec 2015 16:48:40 +1300 Subject: [PATCH 54/54] Add missing file --- .../src/mineplex/core/common/ascii.png | Bin 0 -> 2516 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/ascii.png diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/ascii.png b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/ascii.png new file mode 100644 index 0000000000000000000000000000000000000000..587966dc34dccb49992236660b344f46c66c965c GIT binary patch literal 2516 zcmV;_2`l!AP)_m$LuoG-{_;|FwLyek9-e9{o+0 zt{v=kxUxLj#$TG<{@vsA(t+;4Y`%iR(R_=0csqm{AF?AYF2&A2N`T$69)+sEz4oK| z-fw1)Pdy(<`QJ;5%uk!KNS=&l^Pip=vC!iJAC%$T4oX$sKV$WQ6*}Vtat%YEgsQg zy+yY2@3I3tW^ug*M1K?AVJl4d*K+`Naj$hma5=j}k#CE`d^-mSp@5979Z`ai-+T2~ zD8RENe6#GA!oUm+L$uhdIaRHRzuC^!}-@-{%kNL6V{FC&2H0HW4HRD66h2e_U4Si2J;4r`Lp1yCuv z>P48LTTpGx5CJR-U_`*(D4?1EHne^L%&tt3SFi^mR9>x!U%l5x#;?E9E4Lb^A!W?| zM_Fu?MMn)e8JM_|S8#TRvyP$J@i(L*%MhY)=tRy3tlj(cgC3N-j>cr&nsUc~-Fb{b zC1dMX_{}pA6R|@maQF-zAT|E$psH-`=mJ(;oM2H#wbG_UTG9Lu%O*X)cCTZ{C9Mo& zkfZ2K|1A-VY>=qa&3`&T#9CIxP8pk6zJfc*t z_>C%+**lNO?oErLyK%htyBYmaTx?;+ukv}wD3~o{?NaLit7zw=zM(k#4u$aCX2u@S z6pP~70jli;s!3$}#$x;Qi>r5Sc}F_iq7Q+iLzzI;E9yC zVBTF0A=TmNXXqB^|3^fv{8jp2Wh|n{rw+?DJE8}>qh{I}stAC27qKZI&1#Dtg={n1ueJt8 z39u=yZZWW_IzRgSdUSjYL|cJCnum+o^ZHDAWqxLS%KXPc!MEf2pPlrRgoHA!v;#0W z8fjmt1ZU=6Wr!--0PJz@6YLDtmO#dQ+VDMk9%_aRM`U{~|a&9BrG-SG;P55Z`_;APHfs(8}yF4mm*Yhdt9F8Y|!WZRTCT zS?~T;?GQ!0|D6h9Up1GAycfWD6=zWzWJzNTB~ib6wtUsAVygFvE5w8{(B*RH>BzMw zl_?sXydJh^okCRc15&?>?4Y|0Jyo`d=#woG%UzVsXXc;f0Bv?yGBsXTD3O-ZcD~rc zDrr>;o^>|@f`JSNKv`^7MnCO~M*s^eu zt)IFcety~N`rVT;fB*K%ZMOBC)UFHN`?iRnrz|OnVAh*{5hYS)h84^cTfSKfk8psi zc6??-3XONxn|>L@5Us!0j{2>J+c`jw8&q1ynEYr2w9JBK-bPlU1dpg`4scaIqHIld zFf?k@(^1&^(eZixi*S%^e%B+&QvOCp28-SA)2wGD8U^&MTuL2ar%5QlV}T>q$v#@7 zEQ{(LmaM$$GQGaB*XO(lBAE@8E&thj;LAC{+pU_a$X^w&k$C;9vJssB{z?LZxz@(VhE|&;mmuxnYWNLy2`BjLj=H5UgUYS73x@-k57(vceN7wgnJfS3EXKDz)lN1 z9GP{Mn%%xC27zLHUYv!<`Nol%Bt*s`%2`hyv(6CKH>x8<^_!Xc1=IK5w>v@Tsxj_-rq9_Dr&vFet*y%i2D0m;m$HpafB!$h{1AOJJ;{^gAJwI zTW||8jpn@9&usrby@?scv#Y|~PcXn7r(_YYwV^79`MH>Wm z5DH=nu9^p>{H`E`VW98IF5hsZmqhEMG64`0000