From b1c8158e2f9667b3d7aec1438f96ea39a75a50a3 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Tue, 8 Mar 2016 19:52:31 -0500 Subject: [PATCH 1/4] Added @a argument to /shard, /gem and /giveitem PC-13 --- .../core/donation/command/GemCommand.java | 43 ++++++++++++++++- .../core/donation/command/ShardCommand.java | 46 ++++++++++++++++++- .../inventory/command/GiveItemCommand.java | 10 ++++ 3 files changed, 96 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/command/GemCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/command/GemCommand.java index 8690987bc..a19144834 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/command/GemCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/command/GemCommand.java @@ -10,6 +10,7 @@ import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UUIDFetcher; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.donation.DonationManager; public class GemCommand extends CommandBase @@ -32,7 +33,11 @@ public class GemCommand extends CommandBase String gemsString = args[1]; Player target = UtilPlayer.searchExact(targetName); - if (target == null) + if (targetName.equalsIgnoreCase("@a")) + { + rewardAllGems(caller, gemsString); + } + else if (target == null) { UUID uuid = UUIDFetcher.getUUIDOf(targetName); if (uuid != null) @@ -50,6 +55,42 @@ public class GemCommand extends CommandBase } } + private void rewardAllGems(Player caller, String gemsString) + { + try + { + int gems = Integer.parseInt(gemsString); + + if (gems > 1000) + { + UtilPlayer.message(caller, F.main("Gem", "You can only give everybody 1000 gems at a time.")); + return; + } + + rewardAllGems(caller, gems); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main("Gem", "Invalid gems Amount")); + } + } + + private void rewardAllGems(Player caller, int gems) + { + for (Player player : UtilServer.getPlayers()) + { + Plugin.RewardGems(new Callback() + { + public void run(Boolean completed) + { + + } + }, caller.getName(), player.getName(), player.getUniqueId(), gems); + } + + UtilPlayer.message(caller, F.main("Gem", "Gave everyone " + F.elem(gems + " gems"))); + } + private void rewardGems(final Player caller, final Player target, final String targetName, final UUID uuid, String gemsString) { try diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/command/ShardCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/command/ShardCommand.java index c65df1a4a..cbe9dc269 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/command/ShardCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/command/ShardCommand.java @@ -6,8 +6,8 @@ import mineplex.core.common.Rank; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.donation.DonationManager; - import org.bukkit.entity.Player; public class ShardCommand extends CommandBase @@ -30,7 +30,11 @@ public class ShardCommand extends CommandBase final String coinsString = args[1]; Player target = UtilPlayer.searchExact(targetName); - if (target == null) + if (targetName.equalsIgnoreCase("@a")) + { + rewardAllShards(caller, coinsString); + } + else if (target == null) { Plugin.getClientManager().loadClientByName(targetName, new Runnable() { @@ -53,6 +57,44 @@ public class ShardCommand extends CommandBase } } + private void rewardAllShards(Player caller, String shardsString) + { + try + { + int shards = Integer.parseInt(shardsString); + + if (shards > 1000) + { + UtilPlayer.message(caller, F.main("Shards", "You can only give everybody 1000 shards at a time.")); + return; + } + + rewardAllShards(caller, shards); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main("Shards", "Invalid Shards Amount")); + } + } + + private void rewardAllShards(Player caller, int shards) + { + for (Player player : UtilServer.getPlayers()) + { + CoreClient client = Plugin.getClientManager().Get(player); + + Plugin.RewardCoins(new Callback() + { + public void run(Boolean completed) + { + + } + }, caller.getName(), player.getName(), client.getAccountId(), shards); + } + + UtilPlayer.message(caller, F.main("Shards", "Gave everyone " + F.elem(shards + " Treasure Shards"))); + } + private void rewardCoins(final Player caller, final Player target, final String targetName, final int accountId, String coinsString) { try diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/command/GiveItemCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/command/GiveItemCommand.java index 94e726ad8..b5f03fe3e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/command/GiveItemCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/command/GiveItemCommand.java @@ -9,6 +9,7 @@ import mineplex.core.common.Rank; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.data.Item; @@ -47,6 +48,15 @@ public class GiveItemCommand extends CommandBase { UtilPlayer.message(caller, F.main("Item", "Item with the name " + F.item(itemName) + " not found!")); } + else if (playerName.equalsIgnoreCase("@a")) + { + for (Player pl : UtilServer.getPlayers()) + { + Plugin.addItemToInventory(pl, item.Name, amount); + } + + UtilPlayer.message(caller, F.main("Item", "You gave " + F.elem(amount + " " + itemName) + " to everyone")); + } else if (player != null) { Plugin.addItemToInventory(player, item.Name, amount); From c89669aec943fad3f4414931c93330d2823002ae Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Tue, 8 Mar 2016 20:23:33 -0500 Subject: [PATCH 2/4] Add /e announce PC-15 --- .../game/arcade/game/games/event/EventModule.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 31508193d..3b4ab272a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -17,6 +17,7 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilSystem; import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.creature.event.CreatureKillEntitiesEvent; import mineplex.core.event.StackerEvent; @@ -452,6 +453,18 @@ public class EventModule extends MiniPlugin } UtilPlayer.message(event.getPlayer(), F.main("Event", "You gave the gadget " + F.item(gadget) + " to all Players!")); } + else if (args[0].equalsIgnoreCase("announce")) + { + String text = args[1]; + + for (int i = 2; i < args.length; i++) + { + text += " " + args[i]; + } + + UtilTextMiddle.display(C.cDGreenB + "Announcement", text); + UtilServer.broadcast(F.main("Event Announcement", text)); + } } public void listSettings(Player player) From 6c0d18662f789e60ead3e3445bec10de5f89dde5 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Tue, 8 Mar 2016 20:45:23 -0500 Subject: [PATCH 3/4] Added /e clear PC-16 --- .../arcade/game/games/event/EventModule.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 3b4ab272a..ab4a9495f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -19,6 +19,7 @@ import mineplex.core.common.util.UtilSystem; import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; import mineplex.core.creature.event.CreatureKillEntitiesEvent; import mineplex.core.event.StackerEvent; import mineplex.core.gadget.gadgets.morph.MorphBlock; @@ -465,6 +466,34 @@ public class EventModule extends MiniPlugin UtilTextMiddle.display(C.cDGreenB + "Announcement", text); UtilServer.broadcast(F.main("Event Announcement", text)); } + else if (args[0].equalsIgnoreCase("clear")) + { + String playerName = args[1]; + + if (playerName.equalsIgnoreCase("@a")) + { + for (Player player : UtilServer.getPlayers()) + { + UtilInv.Clear(player); + } + + UtilPlayer.message(event.getPlayer(), F.main("Event", "Cleared everyone's inventory!")); + } + else + { + Player player = Bukkit.getPlayer(args[1]); + + if (player == null) + { + UtilPlayer.message(event.getPlayer(), "No matches for: " + F.elem(args[1])); + } + else + { + UtilInv.Clear(player); + UtilPlayer.message(event.getPlayer(), F.main("Event", "Cleared " + F.elem(player.getName() + "'s") + " inventory!")); + } + } + } } public void listSettings(Player player) From 67e844db2988233c3be5256b8a83a136a7ed42b4 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Tue, 8 Mar 2016 21:21:53 -0500 Subject: [PATCH 4/4] Added /e bridge PC-17 --- .../game/arcade/game/games/bridge/Bridge.java | 6 +++ .../arcade/game/games/event/EventModule.java | 39 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index d19dc43e7..afec06080 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -1943,4 +1943,10 @@ public class Bridge extends TeamGame implements OreObsfucation { event.setCancelled(true); } + + public void setBridgeTime(int time) + { + _bridgeTime = time; + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index ab4a9495f..379833f82 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -32,6 +32,7 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.events.PlayerDeathOutEvent; +import nautilus.game.arcade.game.games.bridge.Bridge; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -494,6 +495,44 @@ public class EventModule extends MiniPlugin } } } + else if (args[0].equalsIgnoreCase("bridge")) + { + if (!(Manager.GetGame() instanceof Bridge)) + { + UtilPlayer.message(event.getPlayer(), F.main("Event", "You can only drop the bridges in Bridges!")); + return; + } + + if (((Bridge) Manager.GetGame()).isBridgesDown()) + { + UtilPlayer.message(event.getPlayer(), F.main("Event", "The bridges have already dropped!")); + return; + } + + int seconds = 10; + + if (args.length > 1) + { + try + { + seconds = Integer.parseInt(args[1]); + } + catch (NumberFormatException e) + { + UtilPlayer.message(event.getPlayer(), F.main("Event", "Invalid integer for seconds!")); + return; + } + } + + if (seconds < 0) + { + UtilPlayer.message(event.getPlayer(), F.main("Event", "Seconds must be greater than 0!")); + return; + } + + ((Bridge) Manager.GetGame()).setBridgeTime((int) ((System.currentTimeMillis() - Manager.GetGame().GetStateTime()) + seconds * 1000)); + UtilPlayer.message(event.getPlayer(), F.main("Event", "Bridges will drop in " + F.elem(seconds + " Seconds") + "!")); + } } public void listSettings(Player player)