diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java index 0c87a53dd..97257bd98 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java @@ -17,6 +17,7 @@ import mineplex.core.globalpacket.command.GlobalPacketCommand; import mineplex.core.globalpacket.listeners.GlobalGiveCoins; import mineplex.core.globalpacket.listeners.GlobalGiveGems; import mineplex.core.globalpacket.listeners.GlobalGiveItem; +import mineplex.core.globalpacket.listeners.GlobalRawr; import mineplex.core.globalpacket.redis.GlobalPacketHandler; import mineplex.core.globalpacket.redis.GlobalPacketMessage; import mineplex.core.inventory.InventoryManager; @@ -55,6 +56,7 @@ public class GlobalPacketManager extends MiniPlugin getPluginManager().registerEvents(new GlobalGiveItem(inventoryManager, _rewardManager), getPlugin()); getPluginManager().registerEvents(new GlobalGiveGems(donationManager), getPlugin()); getPluginManager().registerEvents(new GlobalGiveCoins(donationManager, clientManager), getPlugin()); + getPluginManager().registerEvents(new GlobalRawr(), getPlugin()); } public void callGlobalCommand(Player caller, String[] args) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveCoins.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveCoins.java index 0e20c0850..be32efbc2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveCoins.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveCoins.java @@ -31,7 +31,7 @@ public class GlobalGiveCoins implements Listener } @EventHandler - public void giveCoins(GlobalPacketEvent e) + public void giveCoins(final GlobalPacketEvent e) { if (e.getParts() == null || e.getParts().length < 1) return; @@ -41,7 +41,7 @@ public class GlobalGiveCoins implements Listener if (e.getParts().length != 2) { - if (e.getCaller().isOnline()) + if (e.getCaller() != null) UtilPlayer.message(e.getCaller(), F.main("Global", "/global givecoins ")); return; @@ -55,7 +55,7 @@ public class GlobalGiveCoins implements Listener catch (Exception ex) { // No number - if (e.getCaller().isOnline()) + if (e.getCaller() != null) UtilPlayer.message(e.getCaller(), F.main("Global", "[" + F.elem(amount + "") + "] is not a valid amount.")); return; @@ -70,7 +70,7 @@ public class GlobalGiveCoins implements Listener public void run(Boolean data) { UtilPlayer.message(p, F.main("Global", "You received " + F.elem(fAmount + " Coins") + ".")); - UtilTextMiddle.display(C.cYellow + fAmount + " Coins", C.cGold + "received from " + p.getName() + "!", p); + UtilTextMiddle.display(C.cYellow + fAmount + " Coins", C.cGold + "received from " + e.getCallerName() + "!", p); } }, "Global Coins", p.getName(), _clientManager.getAccountId(p), amount); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveGems.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveGems.java index 11ec36b43..477505ceb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveGems.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveGems.java @@ -28,7 +28,7 @@ public class GlobalGiveGems implements Listener } @EventHandler - public void giveGems(GlobalPacketEvent e) + public void giveGems(final GlobalPacketEvent e) { if (e.getParts() == null || e.getParts().length < 1) return; @@ -38,7 +38,7 @@ public class GlobalGiveGems implements Listener if (e.getParts().length != 2) { - if (e.getCaller().isOnline()) + if (e.getCaller() != null) UtilPlayer.message(e.getCaller(), F.main("Global", "/global givegems ")); return; @@ -52,7 +52,7 @@ public class GlobalGiveGems implements Listener catch (Exception ex) { // No number - if (e.getCaller().isOnline()) + if (e.getCaller() != null) UtilPlayer.message(e.getCaller(), F.main("Global", "[" + F.elem(amount + "") + "] is not a valid amount.")); return; @@ -67,7 +67,7 @@ public class GlobalGiveGems implements Listener public void run(Boolean data) { UtilPlayer.message(p, F.main("Global", "You received " + F.elem(fAmount + " Gems") + ".")); - UtilTextMiddle.display(C.cYellow + fAmount + " Gems", C.cGold + "received from " + p.getName() + "!", p); + UtilTextMiddle.display(C.cYellow + fAmount + " Gems", C.cGold + "received from " + e.getCallerName() + "!", p); } }, "Global Gems", p.getName(), p.getUniqueId(), amount); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveItem.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveItem.java index 076a099e6..28e76c4b5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveItem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveItem.java @@ -65,7 +65,7 @@ public class GlobalGiveItem implements Listener if (e.getParts().length != 3) { - if (e.getCaller().isOnline()) + if (e.getCaller() != null) UtilPlayer.message(e.getCaller(), F.main("Global", "/global giveitem ")); return; @@ -81,7 +81,7 @@ public class GlobalGiveItem implements Listener { // Wrong item - if (e.getCaller().isOnline()) + if (e.getCaller() != null) { UtilPlayer.message(e.getCaller(), F.main("Global", "That GlobalItem type can't be found. Types:")); @@ -105,7 +105,7 @@ public class GlobalGiveItem implements Listener { // Not a number - if (e.getCaller().isOnline()) + if (e.getCaller() != null) UtilPlayer.message(e.getCaller(), F.main("Global", "[" + F.elem(e.getParts()[2]) + "] is not a valid number.")); return; @@ -122,8 +122,8 @@ public class GlobalGiveItem implements Listener @Override public void run(Boolean data) { - UtilPlayer.message(p, F.main("Global", "You received " + F.elem(fAmount + " " + fItem.getInvName() + "(s)") + " from " + F.name(p.getName()) + ".")); - UtilTextMiddle.display(C.cYellow + fAmount + " " + fItem.getInvName() + "(s)", C.cGold + "received from " + p.getName() + "!", p); + UtilPlayer.message(p, F.main("Global", "You received " + F.elem(fAmount + " " + fItem.getInvName() + "(s)") + " from " + F.name(e.getCallerName()) + ".")); + UtilTextMiddle.display(C.cYellow + fAmount + " " + fItem.getInvName() + "(s)", C.cGold + "received from " + e.getCallerName() + "!", p); } }, p, item.getInvName(), amount); } @@ -140,9 +140,9 @@ public class GlobalGiveItem implements Listener @Override public void run(RewardData data) { - UtilPlayer.message(p, F.main("Global", "You received " + F.elem("Game Loot") + " from " + F.name(e.getCaller().getName()) + ".")); + UtilPlayer.message(p, F.main("Global", "You received " + F.elem("Game Loot") + " from " + F.name(e.getCallerName()) + ".")); UtilPlayer.message(p, F.main("Global", "You won " + F.elem(data.getFriendlyName()) + "!")); - UtilTextMiddle.display(C.cYellow + data.getFriendlyName(), C.cGold + "received from " + e.getCaller().getName() + "!", p); + UtilTextMiddle.display(C.cYellow + data.getFriendlyName(), C.cGold + "received from " + e.getCallerName() + "!", p); } }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalRawr.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalRawr.java new file mode 100644 index 000000000..fa177e6fa --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalRawr.java @@ -0,0 +1,50 @@ +package mineplex.core.globalpacket.listeners; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.globalpacket.event.GlobalPacketEvent; + +/** + * Created by William (WilliamTiger). + * 18/11/15 + */ +public class GlobalRawr implements Listener +{ + + @EventHandler + public void globalRawr(GlobalPacketEvent e) + { + if (e.getParts() == null || e.getParts().length < 1) + return; + + if (!e.getParts()[0].equalsIgnoreCase("rawr")) + return; + + if (e.getParts().length < 2) + { + if (e.getCaller() != null) + UtilPlayer.message(e.getCaller(), F.main("Global", "/global rawr ")); + + return; + } + + String msg = ""; + for (String cur : e.getParts()) + { + msg += cur + " "; + } + msg = msg.trim(); + + for (Player p : UtilServer.getPlayers()) + { + UtilTextMiddle.display("§6§lRAWR!", "§e" + msg, p); + } + } + +}