Merge branch 'develop' of github.com:Mineplex-LLC/Minecraft-PC into develop

This commit is contained in:
Jonathan Williams 2016-03-21 20:31:04 -05:00
commit c9fdd83e17
5 changed files with 183 additions and 3 deletions

View File

@ -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<DonationManager>
@ -32,7 +33,11 @@ public class GemCommand extends CommandBase<DonationManager>
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<DonationManager>
}
}
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<Boolean>()
{
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

View File

@ -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<DonationManager>
@ -30,7 +30,11 @@ public class ShardCommand extends CommandBase<DonationManager>
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<DonationManager>
}
}
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<Boolean>()
{
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

View File

@ -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<InventoryManager>
{
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);

View File

@ -1949,4 +1949,10 @@ public class Bridge extends TeamGame implements OreObsfucation
{
event.setCancelled(true);
}
public void setBridgeTime(int time)
{
_bridgeTime = time;
}
}

View File

@ -17,7 +17,9 @@ 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.common.util.UtilInv;
import mineplex.core.creature.event.CreatureKillEntitiesEvent;
import mineplex.core.event.StackerEvent;
import mineplex.core.gadget.gadgets.morph.MorphBlock;
@ -30,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;
@ -452,6 +455,84 @@ 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));
}
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!"));
}
}
}
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)