rawr and fixes

This commit is contained in:
William Burns 2015-11-18 15:42:33 +00:00
parent e16ee9036a
commit 2e223d0660
5 changed files with 67 additions and 15 deletions

View File

@ -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)

View File

@ -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 <amount>"));
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);
}

View File

@ -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 <amount>"));
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);
}

View File

@ -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 <item> <amount>"));
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);
}
});
}

View File

@ -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 <msg>"));
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);
}
}
}