diff --git a/Plugins/Core/src/me/chiss/Core/Scheduler/Scheduler.java b/Plugins/Core/src/me/chiss/Core/Scheduler/Scheduler.java index e155aeedc..518b8920c 100644 --- a/Plugins/Core/src/me/chiss/Core/Scheduler/Scheduler.java +++ b/Plugins/Core/src/me/chiss/Core/Scheduler/Scheduler.java @@ -38,7 +38,7 @@ public class Scheduler extends MiniPlugin @Override public void AddCommands() { - AddCommand(new ForceDailyCommand(this)); + addCommand(new ForceDailyCommand(this)); } @EventHandler diff --git a/Plugins/Core/src/me/chiss/Core/Server/Server.java b/Plugins/Core/src/me/chiss/Core/Server/Server.java index 072971ded..767cdeb67 100644 --- a/Plugins/Core/src/me/chiss/Core/Server/Server.java +++ b/Plugins/Core/src/me/chiss/Core/Server/Server.java @@ -40,10 +40,10 @@ public class Server extends MiniPlugin @Override public void AddCommands() { - AddCommand(new BroadcastCommand(this)); - AddCommand(new ListCommand(this)); - AddCommand(new SpawnSetCommand(this)); - AddCommand(new WaterSpreadCommand(this)); + addCommand(new BroadcastCommand(this)); + addCommand(new ListCommand(this)); + addCommand(new SpawnSetCommand(this)); + addCommand(new WaterSpreadCommand(this)); } @EventHandler @@ -95,7 +95,7 @@ public class Server extends MiniPlugin for (Player cur : UtilServer.getPlayers()) cur.saveData(); - Log("Saved Clients to Disk. Took " + (System.currentTimeMillis()-epoch) + " milliseconds."); + log("Saved Clients to Disk. Took " + (System.currentTimeMillis()-epoch) + " milliseconds."); } public void saveWorlds() @@ -110,20 +110,20 @@ public class Server extends MiniPlugin F.time(UtilTime.convertString((System.currentTimeMillis()-epoch), 1, TimeUnit.FIT)) + "]."); - Log("Saved Worlds to Disk. Took " + (System.currentTimeMillis()-epoch) + " milliseconds."); + log("Saved Worlds to Disk. Took " + (System.currentTimeMillis()-epoch) + " milliseconds."); } public void reload() { UtilServer.broadcast(F.main(_moduleName, "Reloading Plugins...")); - Log("Reloading Plugins..."); + log("Reloading Plugins..."); UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "reload"); } public void restart() { UtilServer.broadcast(F.main(_moduleName, "Restarting Server...")); - Log("Restarting Server..."); + log("Restarting Server..."); for (Player cur : UtilServer.getPlayers()) UtilPlayer.kick(cur, _moduleName, "Server Restarting"); diff --git a/Plugins/Core/src/me/chiss/Core/Server/command/ListCommand.java b/Plugins/Core/src/me/chiss/Core/Server/command/ListCommand.java index 4fd47a447..090eb41c7 100644 --- a/Plugins/Core/src/me/chiss/Core/Server/command/ListCommand.java +++ b/Plugins/Core/src/me/chiss/Core/Server/command/ListCommand.java @@ -20,7 +20,7 @@ public class ListCommand extends CommandBase @Override public void Execute(Player caller, String[] args) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Listing Online Players:")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Listing Online Players:")); String staff = ""; String other = ""; diff --git a/Plugins/Core/src/me/chiss/Core/Vote/VoteManager.java b/Plugins/Core/src/me/chiss/Core/Vote/VoteManager.java index b485e7492..21d17bc8b 100644 --- a/Plugins/Core/src/me/chiss/Core/Vote/VoteManager.java +++ b/Plugins/Core/src/me/chiss/Core/Vote/VoteManager.java @@ -46,7 +46,7 @@ public class VoteManager extends MiniPlugin if (player == client.GetPlayer()) continue; - player.sendMessage(F.main(GetName(), ChatColor.YELLOW + event.GetPlayerName() + ChatColor.GRAY + " voted at bettermc.com/Vote for " + ChatColor.YELLOW + event.GetPointsReceived() + C.cGray + " points! ")); + player.sendMessage(F.main(getName(), ChatColor.YELLOW + event.GetPlayerName() + ChatColor.GRAY + " voted at bettermc.com/Vote for " + ChatColor.YELLOW + event.GetPointsReceived() + C.cGray + " points! ")); } client.GetPlayer().updateInventory(); diff --git a/Plugins/Core/src/me/chiss/Core/Weapon/Commands/WeaponCommand.java b/Plugins/Core/src/me/chiss/Core/Weapon/Commands/WeaponCommand.java index c8f306228..09fa023f8 100644 --- a/Plugins/Core/src/me/chiss/Core/Weapon/Commands/WeaponCommand.java +++ b/Plugins/Core/src/me/chiss/Core/Weapon/Commands/WeaponCommand.java @@ -22,7 +22,7 @@ public class WeaponCommand extends CommandBase { if (args == null || args.length == 0) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Listing Weapons:")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Listing Weapons:")); for (IWeapon cur : Plugin.GetWeapons()) { diff --git a/Plugins/Core/src/me/chiss/Core/Weapon/WeaponFactory.java b/Plugins/Core/src/me/chiss/Core/Weapon/WeaponFactory.java index 648bd0f5b..6eef58862 100644 --- a/Plugins/Core/src/me/chiss/Core/Weapon/WeaponFactory.java +++ b/Plugins/Core/src/me/chiss/Core/Weapon/WeaponFactory.java @@ -40,7 +40,7 @@ public class WeaponFactory extends MiniPlugin implements IWeaponFactory @Override public void AddCommands() { - AddCommand(new WeaponCommand(this)); + addCommand(new WeaponCommand(this)); } private void PopulateWeapons() 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 8c1f0fffe..5f8456aa7 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java @@ -2,6 +2,7 @@ package mineplex.bungee.motd; import java.util.concurrent.TimeUnit; +import net.md_5.bungee.api.event.PreLoginEvent; import net.md_5.bungee.api.event.ProxyPingEvent; import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.api.plugin.Plugin; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java index f595fcbd0..6add4954e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java @@ -55,17 +55,17 @@ public abstract class MiniPlugin implements Listener public final void onEnable() { long epoch = System.currentTimeMillis(); - Log("Initializing..."); + log("Initializing..."); Enable(); AddCommands(); - Log("Enabled in " + UtilTime.convertString(System.currentTimeMillis() - epoch, 1, TimeUnit.FIT) + "."); + log("Enabled in " + UtilTime.convertString(System.currentTimeMillis() - epoch, 1, TimeUnit.FIT) + "."); } public final void onDisable() { Disable(); - Log("Disabled."); + log("Disabled."); } public void Enable() { } @@ -74,23 +74,28 @@ public abstract class MiniPlugin implements Listener public void AddCommands() { } - public final String GetName() + public final String getName() { return _moduleName; } - public final void AddCommand(ICommand command) + public final void addCommand(ICommand command) { CommandCenter.Instance.AddCommand(command); } - public final void RemoveCommand(ICommand command) + public final void removeCommand(ICommand command) { CommandCenter.Instance.RemoveCommand(command); } - protected void Log(String message) + protected void log(String message) { System.out.println(F.main(_moduleName, message)); } + + protected void runAsync(Runnable runnable) + { + _plugin.getServer().getScheduler().runTaskAsynchronously(_plugin, runnable); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index 94034eee6..24a068105 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -68,7 +68,7 @@ public class CoreClientManager extends MiniPlugin @Override public void AddCommands() { - AddCommand(new UpdateRank(this)); + addCommand(new UpdateRank(this)); } public CoreClient Add(String name) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java index 5bee6a2b5..c46ed1cc1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java @@ -25,13 +25,13 @@ public class UpdateRank extends CommandBase { if (args == null) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), "/" + AliasUsed + " joeschmo MODERATOR")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " joeschmo MODERATOR")); } else { if (args.length == 0) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Player argument missing.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Player argument missing.")); return; } @@ -44,7 +44,7 @@ public class UpdateRank extends CommandBase } catch (Exception ex) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), ChatColor.RED + "" + ChatColor.BOLD + "Invalid rank!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Invalid rank!")); return; } @@ -90,7 +90,7 @@ public class UpdateRank extends CommandBase { public void run(Rank rank) { - caller.sendMessage(F.main(Plugin.GetName(), target + "'s rank has been updated to " + rank.Name + "!")); + caller.sendMessage(F.main(Plugin.getName(), target + "'s rank has been updated to " + rank.Name + "!")); } }, target, rank, true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java index 26436e1c6..36dbb45ba 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java @@ -114,7 +114,7 @@ public class AchievementManager extends MiniPlugin @Override public void AddCommands() { - AddCommand(new StatsCommand(this)); + addCommand(new StatsCommand(this)); } public void openShop(Player player) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index f291caf0e..4d335c95a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -82,8 +82,8 @@ public class Chat extends MiniPlugin @Override public void AddCommands() { - AddCommand(new SilenceCommand(this)); - AddCommand(new BroadcastCommand(this)); + addCommand(new SilenceCommand(this)); + addCommand(new BroadcastCommand(this)); } public void Silence(long duration, boolean inform) @@ -113,7 +113,7 @@ public class Chat extends MiniPlugin if (event.getMessage().toLowerCase().startsWith("/me") || event.getMessage().toLowerCase().startsWith("/bukkit")) { - event.getPlayer().sendMessage(F.main(GetName(), "No, you!")); + event.getPlayer().sendMessage(F.main(getName(), "No, you!")); event.setCancelled(true); } } @@ -123,7 +123,7 @@ public class Chat extends MiniPlugin { if (event.getMessage().equals("lag") || event.getMessage().equals("ping")) { - event.getPlayer().sendMessage(F.main(GetName(), "PONG!")); + event.getPlayer().sendMessage(F.main(getName(), "PONG!")); event.setCancelled(true); } } @@ -157,11 +157,11 @@ public class Chat extends MiniPlugin return false; if (_silenced == -1) - UtilPlayer.message(player, F.main(GetName(), "Chat is silenced permanently.")); + UtilPlayer.message(player, F.main(getName(), "Chat is silenced permanently.")); else UtilPlayer.message( player, - F.main(GetName(), + F.main(getName(), "Chat is silenced for " + F.time(UtilTime.MakeStr(_silenced - System.currentTimeMillis(), 1)) + ".")); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java index 17e3907ef..f0d0976bc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -65,8 +65,8 @@ public class GadgetPage extends ShopPageBase { if (gadget instanceof MorphNotch) { - setItem(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), "Disabled " + gadget.GetName(), new String[] { "Sorry! Currently disabled until fix is made for 1.8 players!" }, 1, false, false)); - return; + //setItem(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), "Disabled " + gadget.GetName(), new String[] { "Sorry! Currently disabled until fix is made for 1.8 players!" }, 1, false, false)); + //return; } List itemLore = new ArrayList(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java index c46db6c7b..068fed02b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java @@ -67,7 +67,7 @@ public class PetTagPage extends ShopPageBase if (_tagName.length() > 16) { - UtilPlayer.message(Player, F.main(Plugin.GetName(), ChatColor.RED + "Pet name cannot be longer than 16 characters.")); + UtilPlayer.message(Player, F.main(Plugin.getName(), ChatColor.RED + "Pet name cannot be longer than 16 characters.")); PlayDenySound(Player); Shop.OpenPageForPlayer(Player, new PetPage(Plugin, Shop, ClientManager, DonationManager, "Pets", Player)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/creature/Creature.java b/Plugins/Mineplex.Core/src/mineplex/core/creature/Creature.java index 0459f9247..7cd2b0cfc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/creature/Creature.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/creature/Creature.java @@ -43,7 +43,7 @@ public class Creature extends MiniPlugin @Override public void AddCommands() { - AddCommand(new MobCommand(this)); + addCommand(new MobCommand(this)); } public Entity SpawnEntity(Location location, EntityType entityType) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/creature/command/HelpCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/HelpCommand.java index 6a7e25e34..ca06bbad5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/creature/command/HelpCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/HelpCommand.java @@ -17,7 +17,7 @@ public class HelpCommand extends CommandBase @Override public void Execute(Player caller, String[] args) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Commands List;")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Commands List;")); UtilPlayer.message(caller, F.help("/mob", "List Entities", Rank.MODERATOR)); UtilPlayer.message(caller, F.help("/mob kill ", "Remove Entities of Type", Rank.ADMIN)); UtilPlayer.message(caller, F.help("/mob (# baby lock angry s# )", "Create", Rank.ADMIN)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/creature/command/KillCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/KillCommand.java index a040503f8..a4efed103 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/creature/command/KillCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/KillCommand.java @@ -29,7 +29,7 @@ public class KillCommand extends CommandBase { if (args == null || args.length == 0) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Missing Entity Type Parameter.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Missing Entity Type Parameter.")); return; } @@ -68,6 +68,6 @@ public class KillCommand extends CommandBase if (type != null) target = UtilEnt.getName(type); - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Killed " + target + ". " + count + " Removed.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Killed " + target + ". " + count + " Removed.")); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java index bd4c44946..d43ccccbf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java @@ -54,7 +54,7 @@ public class MobCommand extends MultiCommandBase } } - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Listing Entities:")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Listing Entities:")); for (EntityType cur : entMap.keySet()) { UtilPlayer.message(caller, F.desc(UtilEnt.getName(cur), entMap.get(cur)+"")); @@ -69,7 +69,7 @@ public class MobCommand extends MultiCommandBase if (type == null) return; - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Spawning Creature(s);")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Spawning Creature(s);")); //Store Args HashSet argSet = new HashSet(); @@ -245,7 +245,7 @@ public class MobCommand extends MultiCommandBase UtilPlayer.message(caller, F.desc("Unhandled", arg)); //Inform - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Spawned " + count + " " + UtilEnt.getName(type) + ".")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Spawned " + count + " " + UtilEnt.getName(type) + ".")); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/database/column/ColumnByte.java b/Plugins/Mineplex.Core/src/mineplex/core/database/column/ColumnByte.java new file mode 100644 index 000000000..40464a318 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/database/column/ColumnByte.java @@ -0,0 +1,43 @@ +package mineplex.core.database.column; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class ColumnByte extends Column +{ + public ColumnByte(String name) + { + super(name); + Value = (byte)0; + } + + public ColumnByte(String name, Byte value) + { + super(name, value); + } + + @Override + public String getCreateString() + { + return Name + " TINYINT"; + } + + @Override + public Byte getValue(ResultSet resultSet) throws SQLException + { + return resultSet.getByte(Name); + } + + @Override + public void setValue(PreparedStatement preparedStatement, int columnNumber) throws SQLException + { + preparedStatement.setLong(columnNumber, Value); + } + + @Override + public ColumnByte clone() + { + return new ColumnByte(Name, Value); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/database/column/ColumnDouble.java b/Plugins/Mineplex.Core/src/mineplex/core/database/column/ColumnDouble.java new file mode 100644 index 000000000..1163df926 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/database/column/ColumnDouble.java @@ -0,0 +1,43 @@ +package mineplex.core.database.column; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class ColumnDouble extends Column +{ + public ColumnDouble(String name) + { + super(name); + Value = 0.0; + } + + public ColumnDouble(String name, Double value) + { + super(name, value); + } + + @Override + public String getCreateString() + { + return Name + " DOUBLE"; + } + + @Override + public Double getValue(ResultSet resultSet) throws SQLException + { + return resultSet.getDouble(Name); + } + + @Override + public void setValue(PreparedStatement preparedStatement, int columnNumber) throws SQLException + { + preparedStatement.setDouble(columnNumber, Value); + } + + @Override + public ColumnDouble clone() + { + return new ColumnDouble(Name, Value); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java index 19c3fb90a..54560761b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java @@ -11,6 +11,7 @@ import net.minecraft.server.v1_7_R4.ChunkAddEntityEvent; import net.minecraft.server.v1_7_R4.EntityPlayer; import net.minecraft.server.v1_7_R4.Packet; import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityVelocity; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; @@ -40,6 +41,7 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseBlock; import mineplex.core.disguise.disguises.DisguiseInsentient; +import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketHandler; import mineplex.core.packethandler.PacketVerifier; @@ -58,10 +60,12 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler private NautHashMap _addTempList = new NautHashMap(); private HashSet _delTempList = new HashSet(); private NautHashMap> _disguisePlayerMap = new NautHashMap>(); + private HashSet _blockedNames = new HashSet(); private boolean _handlingPacket = false; private Field _attributesA; + private Field _attributesB; private Field _soundB; private Field _soundC; private Field _soundD; @@ -76,6 +80,8 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler { _attributesA = PacketPlayOutUpdateAttributes.class.getDeclaredField("a"); _attributesA.setAccessible(true); + _attributesB = PacketPlayOutUpdateAttributes.class.getDeclaredField("b"); + _attributesB.setAccessible(true); _soundB = PacketPlayOutNamedSoundEffect.class.getDeclaredField("b"); _soundB.setAccessible(true); _soundC = PacketPlayOutNamedSoundEffect.class.getDeclaredField("c"); @@ -144,6 +150,14 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler _spawnPacketMap.put(disguise.GetEntityId(), disguise); _disguisePlayerMap.put(disguise, new HashSet()); + + if (disguise.GetEntity() instanceof Player && disguise instanceof DisguisePlayer) + { + if (!((Player)disguise.GetEntity()).getName().equalsIgnoreCase(((DisguisePlayer)disguise).getName())) + { + _blockedNames.add(((Player)disguise.GetEntity()).getName()); + } + } reApplyDisguise(disguise); } @@ -166,9 +180,10 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle(); entityPlayer.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(entity.getEntityId())); - + if (entity instanceof Player) { + _blockedNames.remove(((Player)entity).getName()); player.hidePlayer((Player)entity); player.showPlayer((Player)entity); } @@ -229,6 +244,17 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler continue; EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle(); + + if (disguise instanceof DisguisePlayer) + { + entityPlayer.playerConnection.sendPacket(((DisguisePlayer)disguise).getNewInfoPacket(true)); + + if (disguise.GetEntity() instanceof EntityPlayer) + { + entityPlayer.playerConnection.sendPacket(((DisguisePlayer)disguise).getOldInfoPacket(false)); + } + } + entityPlayer.playerConnection.sendPacket(disguise.GetSpawnPacket()); for (Packet packet : armorPackets) @@ -368,20 +394,79 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler } public void handle(PacketInfo packetInfo) - { + { if (_handlingPacket) return; + + /* + if (packetInfo.getPlayer().getName().equalsIgnoreCase("jRayx") + && !(packetInfo.getPacket() instanceof PacketPlayOutEntityVelocity) + && !(packetInfo.getPacket() instanceof PacketPlayOutEntityHeadRotation) + && !(packetInfo.getPacket() instanceof PacketPlayOutRelEntityMove) + && !(packetInfo.getPacket() instanceof PacketPlayOutRelEntityMoveLook) + && !(packetInfo.getPacket() instanceof PacketPlayOutTileEntityData) + && !(packetInfo.getPacket() instanceof PacketPlayOutUpdateTime) + && !(packetInfo.getPacket() instanceof PacketPlayOutAbilities) + && !(packetInfo.getPacket() instanceof PacketPlayOutSpawnEntityLiving) + && !(packetInfo.getPacket() instanceof PacketPlayOutEntityMetadata) + && !(packetInfo.getPacket() instanceof PacketPlayOutEntityEquipment) + && !(packetInfo.getPacket() instanceof PacketPlayOutEntityLook) + && !(packetInfo.getPacket() instanceof PacketPlayOutEntityDestroy) + && !(packetInfo.getPacket() instanceof PacketPlayOutScoreboardScore) + && !(packetInfo.getPacket() instanceof PacketPlayOutScoreboardObjective) + && !(packetInfo.getPacket() instanceof PacketPlayOutKeepAlive) + && !(packetInfo.getPacket() instanceof PacketPlayOutEntityTeleport) + && !(packetInfo.getPacket() instanceof PacketPlayOutBlockChange) + && !(packetInfo.getPacket() instanceof PacketPlayOutMapChunkBulk) + && !(packetInfo.getPacket() instanceof PacketPlayOutNamedSoundEffect) + && !(packetInfo.getPacket() instanceof PacketPlayOutUpdateSign) + && !(packetInfo.getPacket() instanceof PacketPlayOutWorldEvent)) + { + System.out.println(packetInfo.getPacket().getClass().toString()); + + if (packetInfo.getPacket() instanceof PacketPlayOutUpdateAttributes) + { + try + { + for (Object attrObject : (List)_attributesB.get(packetInfo.getPacket())) + { + AttributeSnapshot attribute = (AttributeSnapshot)attrObject; + System.out.println(attribute.a()); + System.out.println(attribute.b()); + System.out.println(attribute.c()); + } + } + catch (IllegalArgumentException | IllegalAccessException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + */ final Packet packet = packetInfo.getPacket(); Player owner = packetInfo.getPlayer(); final PacketVerifier packetVerifier = packetInfo.getVerifier(); - if (packet instanceof PacketPlayOutNamedEntitySpawn) + if (packet instanceof PacketPlayOutPlayerInfo) + { + if (_blockedNames.contains(((PacketPlayOutPlayerInfo)packet).username)) + { + packetInfo.setCancelled(true); + } + } + else if (packet instanceof PacketPlayOutNamedEntitySpawn) { int entityId = ((PacketPlayOutNamedEntitySpawn)packet).a; if (_spawnPacketMap.containsKey(entityId) && (_spawnPacketMap.get(entityId).Global || _disguisePlayerMap.get(_spawnPacketMap.get(entityId)).contains(owner))) { + if (_spawnPacketMap.get(entityId) instanceof DisguisePlayer) + { + handlePacket(((DisguisePlayer)_spawnPacketMap.get(entityId)).getNewInfoPacket(true), packetVerifier); + } + handlePacket(_spawnPacketMap.get(entityId).GetSpawnPacket(), packetVerifier); packetInfo.setCancelled(true); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java index 738df6891..b374e61f8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java @@ -1,10 +1,12 @@ package mineplex.core.disguise.disguises; -import org.spigotmc.ProtocolData; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.entity.Player; import net.minecraft.server.v1_7_R4.MathHelper; import net.minecraft.server.v1_7_R4.Packet; import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo; import net.minecraft.util.com.mojang.authlib.GameProfile; public class DisguisePlayer extends DisguiseHuman @@ -34,6 +36,35 @@ public class DisguisePlayer extends DisguiseHuman _sneaking = sneaking; } + public Packet getOldInfoPacket(boolean add) + { + PacketPlayOutPlayerInfo playerInfo = new PacketPlayOutPlayerInfo(); + + if (Entity instanceof Player) + { + playerInfo.username = Entity.getName(); + playerInfo.action = add ? 0 : 4; + playerInfo.ping = 90; + playerInfo.player = ((CraftPlayer)(Player)Entity).getProfile(); + playerInfo.gamemode = 0; + } + + return playerInfo; + } + + public Packet getNewInfoPacket(boolean add) + { + PacketPlayOutPlayerInfo newDisguiseInfo = new PacketPlayOutPlayerInfo(); + newDisguiseInfo.username = _profile.getName(); + newDisguiseInfo.action = add ? 0 : 4; + newDisguiseInfo.ping = 90; + newDisguiseInfo.player = _profile; + newDisguiseInfo.gamemode = 0; + + + return newDisguiseInfo; + } + @Override public void UpdateDataWatcher() { @@ -62,4 +93,9 @@ public class DisguisePlayer extends DisguiseHuman return packet; } + + public String getName() + { + return _profile.getName(); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java index 95ae0a980..0b559f9ba 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java @@ -15,6 +15,7 @@ import mineplex.core.common.util.Callback; import mineplex.core.common.util.NautHashMap; import mineplex.core.donation.repository.DonationRepository; import mineplex.core.donation.repository.token.DonorTokenWrapper; +import mineplex.core.server.remotecall.JsonWebCall; import mineplex.core.server.util.TransactionResponse; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -42,8 +43,8 @@ public class DonationManager extends MiniPlugin @Override public void AddCommands() { - AddCommand(new GemCommand(this)); - AddCommand(new CoinCommand(this)); + addCommand(new GemCommand(this)); + addCommand(new CoinCommand(this)); } @EventHandler @@ -300,4 +301,9 @@ public class DonationManager extends MiniPlugin //Clean _coinQueue.clear(); } + + public void applyKits(String playerName) + { + _repository.applyKits(playerName); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java index 9523c2e06..71c8129ec 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java @@ -13,6 +13,7 @@ import mineplex.core.database.column.ColumnVarChar; import mineplex.core.donation.repository.token.GemRewardToken; import mineplex.core.donation.repository.token.PurchaseToken; import mineplex.core.donation.repository.token.UnknownPurchaseToken; +import mineplex.core.server.remotecall.AsyncJsonWebCall; import mineplex.core.server.remotecall.JsonWebCall; import mineplex.core.server.util.TransactionResponse; @@ -184,4 +185,9 @@ public class DonationRepository extends RepositoryBase } }), "Error updating player's null gems and coins DonationRepository : "); } + + public void applyKits(String playerName) + { + new AsyncJsonWebCall(_webAddress + "PlayerAccount/ApplyKits").Execute(playerName); + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java index 87e56c607..92daeeea0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java @@ -51,8 +51,8 @@ public class FriendManager extends MiniClientPlugin @Override public void AddCommands() { - AddCommand(new AddFriend(this)); - AddCommand(new DeleteFriend(this)); + addCommand(new AddFriend(this)); + addCommand(new DeleteFriend(this)); } @Override @@ -124,17 +124,17 @@ public class FriendManager extends MiniClientPlugin } else if (status.Status == FriendStatusType.Denied) { - caller.sendMessage(F.main(GetName(), ChatColor.GREEN + name + ChatColor.GRAY + " has denied your friend request.")); + caller.sendMessage(F.main(getName(), ChatColor.GREEN + name + ChatColor.GRAY + " has denied your friend request.")); return; } else if (status.Status == FriendStatusType.Accepted) { - caller.sendMessage(F.main(GetName(), "You are already friends with " + ChatColor.GREEN + name)); + caller.sendMessage(F.main(getName(), "You are already friends with " + ChatColor.GREEN + name)); return; } else if (status.Status == FriendStatusType.Sent) { - caller.sendMessage(F.main(GetName(), ChatColor.GREEN + name + ChatColor.GRAY + " has yet to respond to your friend request.")); + caller.sendMessage(F.main(getName(), ChatColor.GREEN + name + ChatColor.GRAY + " has yet to respond to your friend request.")); return; } } @@ -195,9 +195,9 @@ public class FriendManager extends MiniClientPlugin public void run() { if (updateFinal) - caller.sendMessage(F.main(GetName(), "You and " + ChatColor.GREEN + name + ChatColor.GRAY + " are now friends!")); + caller.sendMessage(F.main(getName(), "You and " + ChatColor.GREEN + name + ChatColor.GRAY + " are now friends!")); else - caller.sendMessage(F.main(GetName(), "Added " + ChatColor.GREEN + name + ChatColor.GRAY + " to your friends list!")); + caller.sendMessage(F.main(getName(), "Added " + ChatColor.GREEN + name + ChatColor.GRAY + " to your friends list!")); } }); } @@ -253,7 +253,7 @@ public class FriendManager extends MiniClientPlugin } } - caller.sendMessage(F.main(GetName(), "Deleted " + ChatColor.GREEN + name + ChatColor.GRAY + " from your friends list!")); + caller.sendMessage(F.main(getName(), "Deleted " + ChatColor.GREEN + name + ChatColor.GRAY + " from your friends list!")); } }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/command/DeleteFriend.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/command/DeleteFriend.java index 36fe4583e..cf1a38734 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/command/DeleteFriend.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/command/DeleteFriend.java @@ -19,7 +19,7 @@ public class DeleteFriend extends CommandBase public void Execute(final Player caller, final String[] args) { if (args == null) - F.main(Plugin.GetName(), "You need to include a player's name."); + F.main(Plugin.getName(), "You need to include a player's name."); else { CommandCenter.GetClientManager().checkPlayerName(caller, args[0], new Callback() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index d1627e5ad..ae493699c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -112,7 +112,7 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphBlock(this)); addGadget(new MorphEnderman(this)); addGadget(new MorphBat(this)); - //addGadget(new MorphNotch(this)); + addGadget(new MorphNotch(this)); addGadget(new MorphPumpkinKing(this)); addGadget(new MorphPig(this)); addGadget(new MorphCreeper(this)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java index 34fc34c8c..62a1c7fe3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java @@ -152,6 +152,6 @@ public class InventoryManager extends MiniClientPlugin @Override public void AddCommands() { - AddCommand(new GiveItemCommand(this)); + addCommand(new GiveItemCommand(this)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/map/Map.java b/Plugins/Mineplex.Core/src/mineplex/core/map/Map.java index 2854e3ede..c23e8a627 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/map/Map.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/map/Map.java @@ -36,7 +36,7 @@ public class Map extends MiniPlugin @Override public void AddCommands() { - AddCommand(new MapImage(this)); + addCommand(new MapImage(this)); } public ItemStack GetMap() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/AdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/AdminCommand.java index dc3917cdf..d141e4a6c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/AdminCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/AdminCommand.java @@ -29,7 +29,7 @@ public class AdminCommand extends CommandBase { if (args.length == 0) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Message argument missing.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Message argument missing.")); return; } @@ -56,7 +56,7 @@ public class AdminCommand extends CommandBase } if (!staff) - UtilPlayer.message(caller, F.main(Plugin.GetName(), "There are no Staff Members online.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "There are no Staff Members online.")); //Log XXX //Logger().logChat("Staff Chat", from, staff, message); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/MessageAdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/MessageAdminCommand.java index 6e2990a0c..1a871aa3f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/MessageAdminCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/MessageAdminCommand.java @@ -29,7 +29,7 @@ public class MessageAdminCommand extends CommandBase if (args.length == 0) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Player argument missing.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Player argument missing.")); return; } @@ -41,7 +41,7 @@ public class MessageAdminCommand extends CommandBase //Parse Message if (args.length < 2) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Message argument missing.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Message argument missing.")); return; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/MessageCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/MessageCommand.java index e268096d7..ff9d8543d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/MessageCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/MessageCommand.java @@ -26,7 +26,7 @@ public class MessageCommand extends CommandBase { if (args.length == 0) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Player argument missing.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Player argument missing.")); return; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/ResendAdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/ResendAdminCommand.java index 3b7ce415b..07e7a3d75 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/ResendAdminCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/ResendAdminCommand.java @@ -30,21 +30,21 @@ public class ResendAdminCommand extends CommandBase //Get To if (Plugin.Get(caller).LastAdminTo == null) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), "You have not admin messaged anyone recently.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "You have not admin messaged anyone recently.")); return; } Player to = UtilPlayer.searchOnline(caller, Plugin.Get(caller).LastAdminTo, false); if (to == null) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), F.name(Plugin.Get(caller).LastAdminTo) + " is no longer online.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), F.name(Plugin.Get(caller).LastAdminTo) + " is no longer online.")); return; } //Parse Message if (args.length < 1) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Message argument missing.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Message argument missing.")); return; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/ResendCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/ResendCommand.java index eb1aedcac..b1a5d1047 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/ResendCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/Commands/ResendCommand.java @@ -27,14 +27,14 @@ public class ResendCommand extends CommandBase //Get To if (Plugin.Get(caller).LastTo == null) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), "You have not messaged anyone recently.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "You have not messaged anyone recently.")); return; } Player to = UtilPlayer.searchOnline(caller, Plugin.Get(caller).LastTo, false); if (to == null) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), F.name(Plugin.Get(caller).LastTo) + " is no longer online.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), F.name(Plugin.Get(caller).LastTo) + " is no longer online.")); return; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java index 269962a36..f88ad5d5d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java @@ -78,14 +78,14 @@ public class MessageManager extends MiniClientPlugin public void AddCommands() { - AddCommand(new MessageCommand(this)); - AddCommand(new ResendCommand(this)); + addCommand(new MessageCommand(this)); + addCommand(new ResendCommand(this)); - AddCommand(new MessageAdminCommand(this)); - AddCommand(new ResendAdminCommand(this)); + addCommand(new MessageAdminCommand(this)); + addCommand(new ResendAdminCommand(this)); - AddCommand(new AdminCommand(this)); + addCommand(new AdminCommand(this)); } public void Help(Player caller, String message) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java b/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java index 8a745c64a..39361a43f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java @@ -106,10 +106,10 @@ public class LagMeter extends MiniPlugin player.sendMessage(" "); player.sendMessage(" "); 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 + "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"); + 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 + "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"); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java index cdd86d982..cab2e8195 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java @@ -132,7 +132,7 @@ public class NpcManager extends MiniPlugin @Override public void AddCommands() { - AddCommand(new NpcCommand(this)); + addCommand(new NpcCommand(this)); } public void help(Player caller, String message) @@ -236,9 +236,9 @@ public class NpcManager extends MiniPlugin try { if (deleteNpc(event.getRightClicked())) - event.getPlayer().sendMessage(F.main(GetName(), "Deleted npc.")); + event.getPlayer().sendMessage(F.main(getName(), "Deleted npc.")); else - event.getPlayer().sendMessage(F.main(GetName(), "Failed to delete npc. That one isn't in the list.")); + event.getPlayer().sendMessage(F.main(getName(), "Failed to delete npc. That one isn't in the list.")); } catch (SQLException e) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/command/ClearCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/command/ClearCommand.java index 57cb5d99d..ff1a59bbf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/npc/command/ClearCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/command/ClearCommand.java @@ -28,7 +28,7 @@ public class ClearCommand extends CommandBase { Plugin.clearNpcs(true); - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Cleared NPCs.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Cleared NPCs.")); } catch (SQLException e) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/command/DeleteCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/command/DeleteCommand.java index 8e5012d6a..4b7ab183b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/npc/command/DeleteCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/command/DeleteCommand.java @@ -24,7 +24,7 @@ public class DeleteCommand extends CommandBase { Plugin.prepDeleteNpc(caller); - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Now right click npc.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Now right click npc.")); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/command/HomeCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/command/HomeCommand.java index c5da7ee50..957816f12 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/npc/command/HomeCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/command/HomeCommand.java @@ -24,7 +24,7 @@ public class HomeCommand extends CommandBase { Plugin.teleportNpcsHome(); - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Npcs teleported to home locations.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Npcs teleported to home locations.")); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/command/RefreshCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/command/RefreshCommand.java index a789f8e3b..24eca9ed5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/npc/command/RefreshCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/command/RefreshCommand.java @@ -29,7 +29,7 @@ public class RefreshCommand extends CommandBase Plugin.clearNpcs(false); Plugin.loadNpcs(); - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Refreshed NPCs.")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Refreshed NPCs.")); } catch (SQLException e) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java index 162e475e0..34750ae83 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java @@ -22,7 +22,7 @@ public class SendCommand extends CommandBase { if(args == null || args.length == 0) { - UtilPlayer.message(player, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!")); + UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!")); return; } else if(args.length == 2) @@ -36,7 +36,7 @@ public class SendCommand extends CommandBase { if (!playerExists) { - UtilPlayer.message(player, F.main(Plugin.GetName(), C.cGray + "Player " + C.cGold + playerTarget + C.cGray + " does not exist!")); + UtilPlayer.message(player, F.main(Plugin.getName(), C.cGray + "Player " + C.cGold + playerTarget + C.cGray + " does not exist!")); return; } @@ -46,13 +46,13 @@ public class SendCommand extends CommandBase { if (!serverExists) { - UtilPlayer.message(player, F.main(Plugin.GetName(), C.cGray + "Server " + C.cGold + serverTarget + C.cGray + " does not exist!")); + UtilPlayer.message(player, F.main(Plugin.getName(), C.cGray + "Server " + C.cGold + serverTarget + C.cGray + " does not exist!")); return; } Portal.transferPlayer(playerTarget, serverTarget); - UtilPlayer.message(player, F.main(Plugin.GetName(), C.cGray + "You have sent player: " + C.cGold + playerTarget + C.cGray + " to server: " + C.cGold + serverTarget + C.cGray + "!")); + UtilPlayer.message(player, F.main(Plugin.getName(), C.cGray + "You have sent player: " + C.cGold + playerTarget + C.cGray + " to server: " + C.cGold + serverTarget + C.cGray + "!")); return; } }); @@ -61,7 +61,7 @@ public class SendCommand extends CommandBase } else { - UtilPlayer.message(player, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!")); + UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!")); return; } } 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 8f71b331d..32ac08afc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java @@ -26,7 +26,7 @@ public class ServerCommand extends CommandBase if (args == null || args.length == 0) { UtilPlayer.message(player, - F.main(Plugin.GetName(), C.cGray + "You are currently on server: " + C.cGold + serverName)); + F.main(Plugin.getName(), C.cGray + "You are currently on server: " + C.cGold + serverName)); return; } else if (args.length == 1) @@ -35,7 +35,7 @@ public class ServerCommand extends CommandBase { UtilPlayer.message( player, - F.main(Plugin.GetName(), "You are already on " + C.cGold + serverName + C.cGray + F.main(Plugin.getName(), "You are already on " + C.cGold + serverName + C.cGray + "!")); } else @@ -48,7 +48,7 @@ public class ServerCommand extends CommandBase { UtilPlayer.message( player, - F.main(Plugin.GetName(), "Server " + C.cGold + args[0] + F.main(Plugin.getName(), "Server " + C.cGold + args[0] + C.cGray + " does not exist!")); return; } @@ -93,7 +93,7 @@ public class ServerCommand extends CommandBase { UtilPlayer.message( player, - F.main(Plugin.GetName(), C.cRed + "You don't have permission to join " + C.cGold + args[0])); + F.main(Plugin.getName(), C.cRed + "You don't have permission to join " + C.cGold + args[0])); } } }); @@ -102,7 +102,7 @@ public class ServerCommand extends CommandBase else { UtilPlayer.message(player, - F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!")); + F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!")); return; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java index cabf6f869..55e91c8f7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java @@ -44,7 +44,7 @@ public class Portal extends MiniPlugin Bukkit.getMessenger().registerOutgoingPluginChannel(GetPlugin(), "BungeeCord"); // Register the server command type for future use - //ServerCommandManager.getInstance().registerCommandType(TransferCommand.class.getSimpleName(), TransferCommand.class); + ServerCommandManager.getInstance().registerCommandType(TransferCommand.class, new TransferHandler()); } public void SendAllPlayers(String serverName) @@ -64,7 +64,7 @@ public class Portal extends MiniPlugin UtilPlayer .message( player, - F.main(GetName(), C.cGray + "You have been sent to server: " + C.cGold + serverName + F.main(getName(), C.cGray + "You have been sent to server: " + C.cGold + serverName + C.cGray + "!")); } @@ -140,7 +140,7 @@ public class Portal extends MiniPlugin public void AddCommands() { - AddCommand(new ServerCommand(this)); - AddCommand(new SendCommand(this)); + addCommand(new ServerCommand(this)); + addCommand(new SendCommand(this)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java index defec6261..c9e783eb4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java @@ -41,7 +41,7 @@ public class PreferencesManager extends MiniClientPlugin _repository = new PreferencesRepository(plugin, plugin.getConfig().getString("preferences.connectionurl")); _shop = new PreferencesShop(this, clientManager, donationManager); - AddCommand(new PreferencesCommand(this)); + addCommand(new PreferencesCommand(this)); } private void setupConfigValues() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java index 4c53b769f..478685f5d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java @@ -54,7 +54,7 @@ public class Punish extends MiniPlugin @Override public void AddCommands() { - AddCommand(new PunishCommand(this)); + addCommand(new PunishCommand(this)); } @EventHandler @@ -102,7 +102,7 @@ public class Punish extends MiniPlugin if (client != null && client.IsMuted()) { - event.getPlayer().sendMessage(F.main(GetName(), "Shh, you're muted because " + client.GetPunishment(PunishmentSentence.Mute).GetReason() + " by " + client.GetPunishment(PunishmentSentence.Mute).GetAdmin() + " for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + ".")); + event.getPlayer().sendMessage(F.main(getName(), "Shh, you're muted because " + client.GetPunishment(PunishmentSentence.Mute).GetReason() + " by " + client.GetPunishment(PunishmentSentence.Mute).GetAdmin() + " for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + ".")); event.setCancelled(true); } } @@ -114,7 +114,7 @@ public class Punish extends MiniPlugin if (client != null && client.IsMuted()) { - event.getPlayer().sendMessage(F.main(GetName(), "Shh, you're muted because " + client.GetPunishment(PunishmentSentence.Mute).GetReason() + " by " + client.GetPunishment(PunishmentSentence.Mute).GetAdmin() + " for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + ".")); + event.getPlayer().sendMessage(F.main(getName(), "Shh, you're muted because " + client.GetPunishment(PunishmentSentence.Mute).GetReason() + " by " + client.GetPunishment(PunishmentSentence.Mute).GetAdmin() + " for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + ".")); event.setMessage(" "); event.setCancelled(true); } @@ -146,16 +146,16 @@ public class Punish extends MiniPlugin if (banResult == PunishmentResponse.AccountDoesNotExist) { if (caller != null) - caller.sendMessage(F.main(GetName(), "Account with name " + F.elem(playerName) + " does not exist.")); + caller.sendMessage(F.main(getName(), "Account with name " + F.elem(playerName) + " does not exist.")); else - System.out.println(F.main(GetName(), "Account with name " + F.elem(playerName) + " does not exist.")); + System.out.println(F.main(getName(), "Account with name " + F.elem(playerName) + " does not exist.")); } else if (banResult == PunishmentResponse.InsufficientPrivileges) { if (caller != null) - caller.sendMessage(F.main(GetName(), "You have insufficient rights to punish " + F.elem(playerName) + ".")); + caller.sendMessage(F.main(getName(), "You have insufficient rights to punish " + F.elem(playerName) + ".")); else - System.out.println(F.main(GetName(), "You have insufficient rights to punish " + F.elem(playerName) + ".")); + System.out.println(F.main(getName(), "You have insufficient rights to punish " + F.elem(playerName) + ".")); } else if (banResult == PunishmentResponse.Punished) { @@ -164,7 +164,7 @@ public class Punish extends MiniPlugin if (sentence == PunishmentSentence.Ban) { if (caller == null) - System.out.println(F.main(GetName(), F.elem(caller == null ? "Mineplex Anti-Cheat" : caller.getName()) + " banned " + F.elem(playerName) + " because of " + F.elem(reason) + " for " + durationString + ".")); + System.out.println(F.main(getName(), F.elem(caller == null ? "Mineplex Anti-Cheat" : caller.getName()) + " banned " + F.elem(playerName) + " because of " + F.elem(reason) + " for " + durationString + ".")); Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable() { @@ -181,19 +181,19 @@ public class Punish extends MiniPlugin } }); - informOfPunish(playerName, F.main(GetName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " banned " + playerName + " for " + durationString + ".")); + informOfPunish(playerName, F.main(getName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " banned " + playerName + " for " + durationString + ".")); } else { if (caller == null) - System.out.println(F.main(GetName(), F.elem(caller == null ? "Mineplex Anti-Cheat" : caller.getName()) + " muted " + F.elem(playerName) + " because of " + F.elem(reason) + " for " + + System.out.println(F.main(getName(), F.elem(caller == null ? "Mineplex Anti-Cheat" : caller.getName()) + " muted " + F.elem(playerName) + " because of " + F.elem(reason) + " for " + durationString + ".")); //Warning if (finalDuration == 0) - informOfPunish(playerName, F.main(GetName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " issued a friendly warning to " + playerName + ".")); + informOfPunish(playerName, F.main(getName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " issued a friendly warning to " + playerName + ".")); else - informOfPunish(playerName, F.main(GetName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " muted " + playerName + " for " + durationString + ".")); + informOfPunish(playerName, F.main(getName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " muted " + playerName + " for " + durationString + ".")); //Inform Player target = UtilPlayer.searchExact(playerName); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java index b660151d7..ef4dc6b91 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java @@ -461,7 +461,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener if (punishResponse != PunishmentResponse.PunishmentRemoved) { - _player.sendMessage(F.main(_plugin.GetName(), "There was a problem removing the punishment.")); + _player.sendMessage(F.main(_plugin.getName(), "There was a problem removing the punishment.")); } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportPlugin.java index 5462203fa..c37a34aff 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportPlugin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportPlugin.java @@ -23,9 +23,9 @@ public class ReportPlugin extends MiniPlugin @Override public void AddCommands() { - AddCommand(new ReportCommand(this)); - AddCommand(new ReportHandleCommand(this)); - AddCommand(new ReportCloseCommand(this)); + addCommand(new ReportCommand(this)); + addCommand(new ReportHandleCommand(this)); + addCommand(new ReportCloseCommand(this)); //AddCommand(new ReportDebugCommand(this)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCloseCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCloseCommand.java index 49e232446..03ce14e9a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCloseCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCloseCommand.java @@ -25,7 +25,7 @@ public class ReportCloseCommand extends CommandBase { if(args == null || args.length < 2) { - UtilPlayer.message(player, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!")); + UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!")); return; } else diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCommand.java index f9cebd2aa..9faf41139 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCommand.java @@ -25,7 +25,7 @@ public class ReportCommand extends CommandBase { if(args == null || args.length < 2) { - UtilPlayer.message(player, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!")); + UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!")); return; } else @@ -40,7 +40,7 @@ public class ReportCommand extends CommandBase } else { - UtilPlayer.message(player, F.main(Plugin.GetName(), C.cRed + "Unable to find player '" + UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Unable to find player '" + playerName + "'!")); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java index 099bbe14b..3b037a0a2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java @@ -25,7 +25,7 @@ public class ReportHandleCommand extends CommandBase { if(args == null || args.length < 1) { - UtilPlayer.message(player, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!")); + UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!")); return; } else diff --git a/Plugins/Mineplex.Core/src/mineplex/core/spawn/Spawn.java b/Plugins/Mineplex.Core/src/mineplex/core/spawn/Spawn.java index 491c982d9..3645b82fa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/spawn/Spawn.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/spawn/Spawn.java @@ -38,7 +38,7 @@ public class Spawn extends MiniPlugin @Override public void AddCommands() { - AddCommand(new SpawnCommand(this)); + addCommand(new SpawnCommand(this)); } public Location getSpawn() @@ -67,7 +67,7 @@ public class Spawn extends MiniPlugin UtilPlayer.message(player, F.main(_moduleName, "You added a Spawn Node.")); //Log - Log("Added Spawn [" + UtilWorld.locToStr(loc) + "] by [" + player.getName() + "]."); + log("Added Spawn [" + UtilWorld.locToStr(loc) + "] by [" + player.getName() + "]."); } public void ClearSpawn(Player player) @@ -82,7 +82,7 @@ public class Spawn extends MiniPlugin UtilPlayer.message(player, F.main(_moduleName, "You cleared all Spawn Nodes.")); //Log - Log("Cleared Spawn [ALL] by [" + player.getName() + "]."); + log("Cleared Spawn [ALL] by [" + player.getName() + "]."); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java index a231b097b..8a776d29d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java @@ -182,7 +182,7 @@ public class StatsManager extends MiniClientPlugin @Override public void AddCommands() { - AddCommand(new TimeCommand(this)); - AddCommand(new GiveStatCommand(this)); + addCommand(new TimeCommand(this)); + addCommand(new GiveStatCommand(this)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/command/GiveStatCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/command/GiveStatCommand.java index 088a4e052..3ce6a847b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/command/GiveStatCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/command/GiveStatCommand.java @@ -1,10 +1,13 @@ package mineplex.core.stats.command; +import java.util.UUID; + 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.UUIDFetcher; import mineplex.core.common.util.UtilPlayer; import mineplex.core.stats.StatsManager; @@ -27,12 +30,28 @@ public class GiveStatCommand extends CommandBase try { Player player = UtilPlayer.searchOnline(caller, args[0], true); + + String statName = args[1]; + + for (int i = 2; i < args.length - 1; i++) + { + statName += " " + args[i]; + } + if (player == null) - return; + { + UUID uuid = UUIDFetcher.getUUIDOf(args[0]); + if (uuid != null) + { + Plugin.incrementStat(uuid.toString(), statName, Integer.parseInt(args[args.length - 1])); + } + } + else + { + Plugin.incrementStat(player, statName, Integer.parseInt(args[args.length - 1])); + } - Plugin.incrementStat(player, args[1], Integer.parseInt(args[2])); - - UtilPlayer.message(caller, F.main("Stats", "Applied " + F.elem(Integer.parseInt(args[2]) + " " + args[1]) + " to " + F.elem(player.getName()) + ".")); + UtilPlayer.message(caller, F.main("Stats", "Applied " + F.elem(Integer.parseInt(args[args.length - 1]) + " " + statName) + " to " + F.elem(player.getName()) + ".")); } catch (Exception e) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java b/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java index 68d972a8c..493bd3381 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java @@ -41,7 +41,7 @@ public class Teleport extends MiniPlugin @Override public void AddCommands() { - AddCommand(new TeleportCommand(this)); + addCommand(new TeleportCommand(this)); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/TeleportCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/TeleportCommand.java index 0ab4e2ea6..27b3d7f6b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/TeleportCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/TeleportCommand.java @@ -44,7 +44,7 @@ public class TeleportCommand extends MultiCommandBase Plugin.playerToLoc(caller, args[0], args[1], args[2], args[3]); else { - UtilPlayer.message(caller, F.main(Plugin.GetName(), "Commands List:")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Commands List:")); UtilPlayer.message(caller, F.help("/tp ", "Teleport to Player", Rank.MODERATOR)); UtilPlayer.message(caller, F.help("/tp b(ack) (amount) (player)", "Undo Teleports", Rank.MODERATOR)); UtilPlayer.message(caller, F.help("/tp here ", "Teleport Player to Self", Rank.ADMIN)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/updater/FileUpdater.java b/Plugins/Mineplex.Core/src/mineplex/core/updater/FileUpdater.java index be07e57a8..9ff7af863 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/updater/FileUpdater.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/updater/FileUpdater.java @@ -136,7 +136,7 @@ public class FileUpdater extends MiniPlugin } catch (Exception ex) { - System.out.println(F.main(GetName(), "Error parsing jar md5's")); + System.out.println(F.main(getName(), "Error parsing jar md5's")); ex.printStackTrace(); } finally @@ -186,7 +186,7 @@ public class FileUpdater extends MiniPlugin } catch (Exception ex) { - System.out.println(F.main(GetName(), "Error parsing jar md5's")); + System.out.println(F.main(getName(), "Error parsing jar md5's")); ex.printStackTrace(); } finally diff --git a/Plugins/Mineplex.Game.Clans/.classpath b/Plugins/Mineplex.Game.Clans/.classpath new file mode 100644 index 000000000..dbcbd71a8 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/.classpath @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/Plugins/Mineplex.Game.Clans/.externalToolBuilders/ClansBuilder.launch b/Plugins/Mineplex.Game.Clans/.externalToolBuilders/ClansBuilder.launch new file mode 100644 index 000000000..71b1d0ddd --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/.externalToolBuilders/ClansBuilder.launch @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Plugins/Mineplex.Game.Clans/.project b/Plugins/Mineplex.Game.Clans/.project new file mode 100644 index 000000000..f5ddd40a1 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/.project @@ -0,0 +1,27 @@ + + + Mineplex.Game.Clans + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/ClansBuilder.launch + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Mineplex.Game.Clans/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.Game.Clans/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7341ab168 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +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.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +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 diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java new file mode 100644 index 000000000..0a580d70d --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java @@ -0,0 +1,147 @@ +package mineplex.game.clans; + +import java.io.File; + +import mineplex.core.CustomTagFix; +import mineplex.core.account.CoreClientManager; +import mineplex.core.antihack.AntiHack; +import mineplex.core.antistack.AntiStack; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.command.CommandCenter; +import mineplex.core.common.util.FileUtil; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.creature.Creature; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.friend.FriendManager; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.logger.Logger; +import mineplex.core.memory.MemoryFix; +import mineplex.core.message.MessageManager; +import mineplex.core.monitor.LagMeter; +import mineplex.core.mount.MountManager; +import mineplex.core.npc.NpcManager; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.pet.PetManager; +import mineplex.core.portal.Portal; +import mineplex.core.preferences.PreferencesManager; +import mineplex.core.projectile.ProjectileManager; +import mineplex.core.punish.Punish; +import mineplex.core.recharge.Recharge; +import mineplex.core.serverConfig.ServerConfiguration; +import mineplex.core.spawn.Spawn; +import mineplex.core.status.ServerStatusManager; +import mineplex.core.teleport.Teleport; +import mineplex.core.updater.FileUpdater; +import mineplex.core.updater.Updater; +import mineplex.minecraft.game.core.combat.CombatManager; +import mineplex.minecraft.game.core.damage.DamageManager; +import net.minecraft.server.v1_7_R4.MinecraftServer; + +import org.bukkit.plugin.java.JavaPlugin; + +public class Clans extends JavaPlugin +{ + private String WEB_CONFIG = "webServer"; + + //Modules + private CoreClientManager _clientManager; + private DonationManager _donationManager; + private DamageManager _damageManager; + + private ServerConfiguration _serverConfiguration; + + @Override + public void onEnable() + { + //Delete Old Games Folders + DeleteFolders(); + + //Configs + getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/"); + getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + saveConfig(); + + String webServerAddress = getConfig().getString(WEB_CONFIG); + + Logger.initialize(this); + + //Static Modules + CommandCenter.Initialize(this); + _clientManager = new CoreClientManager(this, webServerAddress); + CommandCenter.Instance.setClientManager(_clientManager); + + ItemStackFactory.Initialize(this, false); + Recharge.Initialize(this); + + _donationManager = new DonationManager(this, webServerAddress); + + _serverConfiguration = new ServerConfiguration(this); + + PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager); + new MessageManager(this, _clientManager, preferenceManager); + + AntiStack antistack = new AntiStack(this); + Creature creature = new Creature(this); + Spawn spawn = new Spawn(this); + Teleport teleport = new Teleport(this, _clientManager, spawn); + ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, _clientManager)); + Portal portal = new Portal(this, serverStatusManager.getCurrentServerName()); + new FileUpdater(this, portal); + PacketHandler packetHandler = new PacketHandler(this); + + DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler); + + _damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, creature), disguiseManager); + + Punish punish = new Punish(this, webServerAddress, _clientManager); + AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager); + AntiHack.Instance.setKick(false); + + BlockRestore blockRestore = new BlockRestore(this); + + ProjectileManager projectileManager = new ProjectileManager(this); + + //Inventory + InventoryManager inventoryManager = new InventoryManager(this); + PetManager petManager = new PetManager(this, _clientManager, _donationManager, creature, webServerAddress); + MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager); + GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager); + CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, true); + cosmeticManager.setInterfaceSlot(7); + + new MemoryFix(this); + new CustomTagFix(this, packetHandler); + + new FriendManager(this, _clientManager, preferenceManager); + + //Updates + getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); + + MinecraftServer.getServer().getPropertyManager().setProperty("debug", true); + } + + private void DeleteFolders() + { + File curDir = new File("."); + + File[] filesList = curDir.listFiles(); + for(File file : filesList) + { + if (!file.isDirectory()) + continue; + + if (file.getName().length() < 4) + continue; + + if (!file.getName().substring(0, 4).equalsIgnoreCase("Game")) + continue; + + FileUtil.DeleteFolder(file); + + System.out.println("Deleted Old Game: " + file.getName()); + } + } +} 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 new file mode 100644 index 000000000..0eae99feb --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java @@ -0,0 +1,469 @@ +package mineplex.game.clans.clans; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedList; + +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.game.clans.clans.repository.tokens.ClanAllianceToken; +import mineplex.game.clans.clans.repository.tokens.ClanToken; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +public class ClanInfo +{ + public enum Role + { + LEADER(4), ADMIN(3), MEMBER(2), RECRUIT(1), NONE(0); + + private int i; + + private Role(int value) + { + this.i = value; + } + + public int toInt() + { + return i; + } + } + + private String _name = ""; + private String _desc = ""; + private Location _home = null; + + private boolean _admin = false; + + private long _dateCreated = 0; + private long _lastOnline = 0; + + private NautHashMap _allyMap = new NautHashMap(); + + // Loaded from Client + private NautHashMap _memberMap = new NautHashMap(); + private HashSet _claimSet = new HashSet(); + + // Temporary + private NautHashMap _inviteeMap = new NautHashMap(); + private NautHashMap _inviterMap = new NautHashMap(); + + private NautHashMap _requestMap = new NautHashMap(); + + public ClansManager Clans; + + public ClanInfo(ClansManager clans, ClanToken token) + { + Clans = clans; + + _name = token.Name; + _desc = token.Description; + + try + { + _home = UtilWorld.strToLoc(token.Home); + } + catch (Exception e) + { + + } + _admin = token.Admin; + + _dateCreated = token.DateCreated; + _lastOnline = token.LastOnline; + } + + public int getClaims() + { + return getClaimSet().size(); + } + + public int getClaimsMax() + { + if (ssAdmin()) + return 1000; + + return 2 + getMembers().size(); + } + + public int getAllies() + { + return getAllyMap().size(); + } + + public int getAlliesMax() + { + if (ssAdmin()) + return 1000; + + return Math.max(2, 9 - _memberMap.size()); + } + + public boolean isRequested(String clan) + { + if (!getRequestMap().containsKey(clan)) + return false; + + if (System.currentTimeMillis() > getRequestMap().get(clan) + (Clans.getInviteExpire() * 60000)) + return false; + + return true; + } + + public boolean isInvited(String player) + { + if (!getInviteeMap().containsKey(player)) + return false; + + if (System.currentTimeMillis() > getInviteeMap().get(player) + (Clans.getInviteExpire() * 60000)) + return false; + + return true; + } + + public boolean isMember(String clan) + { + return getMembers().containsKey(clan); + } + + public boolean isAlly(String other) + { + return getAllyMap().containsKey(other); + } + + public boolean isSelf(String other) + { + return this.getName().equals(other); + } + + public boolean isNeutral(String other) + { + return (!isAlly(other) && !isSelf(other)); + } + + public long getTimer() + { + int penalty = 0; + return System.currentTimeMillis() + (penalty * 1000); + } + + public boolean getTrust(String clan) + { + if (!getAllyMap().containsKey(clan)) + return false; + + return getAllyMap().get(clan); + } + + public LinkedList mDetails(String caller) + { + LinkedList stringList = new LinkedList(); + + stringList.add(F.main("Clans", C.mRel(C.relPC(caller, this), getName() + " Information;", true))); + // stringList.add(F.value("Desc", _desc)); + + // Age + stringList.add(F.value("Age", + UtilTime.convertString(System.currentTimeMillis() - _dateCreated, 1, TimeUnit.FIT))); + + // Home + if (C.relPC(caller, this) == ClanRelation.SELF) + stringList.add(F.value("Home", UtilWorld.locToStrClean(getHome()))); + + // Land + stringList.add(F.value("Territory", getClaims() + "/" + getClaimsMax())); + + // Ally String + String allySorted = ""; + HashSet allyUnsorted = new HashSet(); + + for (String allyName : getAllyMap().keySet()) + allyUnsorted.add(allyName); + + for (String cur : UtilAlg.sortKey(allyUnsorted)) + allySorted += C.mRel(C.relPC(caller, Clans.getClanMap().get(cur)), cur, false) + + ", "; + + stringList.add(F.value("Allies", allySorted)); + + // Members + String members = ""; + for (String cur : UtilAlg.sortKey(getMembers().keySet())) + { + String name = C.listValueOff + cur; + if (UtilPlayer.isOnline(cur)) + name = C.listValueOn + cur; + + if (getMembers().get(cur) == Role.LEADER) + members += C.listValue + "L." + name + C.mBody + ", "; + + if (getMembers().get(cur) == Role.ADMIN) + members += C.listValue + "A." + name + C.mBody + ", "; + + if (getMembers().get(cur) == Role.MEMBER) + members += C.listValue + "M." + name + C.mBody + ", "; + + if (getMembers().get(cur) == Role.RECRUIT) + members += C.listValue + "R." + name + C.mBody + ", "; + } + stringList.add(F.value("Members", members)); + + // Protected + stringList.add(F.value("TNT Protection", getProtected())); + + // Dominance + ClanInfo callerClan = Clans.CUtil().getClanByPlayer(caller); + if (callerClan != null) + if (this.isEnemy(callerClan.getName())) + stringList.add(F.value("Dominance", callerClan.getDominanceString(this))); + + return stringList; + } + + public LinkedList mTerritory() + { + LinkedList stringList = new LinkedList(); + + stringList.add(F.main("Clans", getName() + " Territory;")); + + for (String cur : getClaimSet()) + { + stringList.add(cur); + } + + return stringList; + } + + public void inform(String message, String ignore) + { + for (String cur : getMembers().keySet()) + { + if (ignore != null && cur.equals(ignore)) + continue; + + Player player = UtilPlayer.searchOnline(null, cur, false); + + if (player == null) + continue; + + UtilPlayer.message(player, F.main("Clans", message)); + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 2f); + } + } + + public void chat(Player sender, String message, String filteredMessage) + { + for (String cur : getMembers().keySet()) + { + Player player = UtilPlayer.searchOnline(null, cur, false); + + if (player == null) + continue; + + CoreClient client = Clans.Clients().Get(player); + + if (client.Game().GetFilterChat()) + UtilPlayer.message(player, C.cAqua + sender.getName() + C.cDAqua + " " + filteredMessage); + else + UtilPlayer.message(player, C.cAqua + sender.getName() + C.cDAqua + " " + message); + } + } + + public void allyChat(ClanInfo senderClan, Player sender, String message, String filteredMessage) + { + for (String cur : getMembers().keySet()) + { + Player player = UtilPlayer.searchOnline(null, cur, false); + + if (player == null) + continue; + + CoreClient client = Clans.Clients().Get(player); + + // C.cDGreen + senderClan.GetName() + " " + + + if (client.Game().GetFilterChat()) + UtilPlayer.message(player, C.cDGreen + sender.getName() + C.cGreen + " " + filteredMessage); + else + UtilPlayer.message(player, C.cDGreen + sender.getName() + C.cGreen + " " + message); + } + } + + public String getName() + { + return _name; + } + + public String getDesc() + { + return _desc; + } + + public void setDesc(String desc) + { + _desc = desc; + } + + public NautHashMap getMembers() + { + return _memberMap; + } + + public HashSet getClaimSet() + { + return _claimSet; + } + + public Location getHome() + { + return _home; + } + + public void setHome(Location loc) + { + _home = loc; + } + + public boolean ssAdmin() + { + return _admin; + } + + public void setAdmin(boolean admin) + { + _admin = admin; + } + + public NautHashMap getInviterMap() + { + return _inviterMap; + } + + public NautHashMap getInviteeMap() + { + return _inviteeMap; + } + + public NautHashMap getAllyMap() + { + return _allyMap; + } + + public NautHashMap getRequestMap() + { + return _requestMap; + } + + public long getDateCreated() + { + return _dateCreated; + } + + public long getLastOnline() + { + return _lastOnline; + } + + public void setLastOnline(long lastOnline) + { + _lastOnline = lastOnline; + } + + public ClanToken GetToken() + { + // Update Members + _token.Members = new ArrayList(); + for (String name : getMembers().keySet()) + { + ClanMemberToken token = new ClanMemberToken(); + token.Name = name; + token.ClanRole = getMembers().get(name).toString(); + + _token.Members.add(token); + } + + // Update Territory + _token.Territories = new ArrayList(); + for (String chunk : getClaimSet()) + { + ClanTerritoryToken token = new ClanTerritoryToken(); + token.ClanName = _token.Name; + token.ClanId = _token.ClanId; + token.ServerName = Clans.GetServerName(); + token.Chunk = chunk; + + if (Clans.GetClaimMap().get(chunk) != null) + token.Safe = Clans.GetClaimMap().get(chunk).safe; + + _token.Territories.add(token); + } + + // Update Relations + _token.Alliances = new ArrayList(); + for (String clanName : getAllyMap().keySet()) + { + ClanInfo clan = Clans.getClan(clanName); + ClanAllianceToken token = new ClanAllianceToken(); + token.ClanId = clan.GetTokenUnupdated().ClanId; + token.ClanName = clan.GetTokenUnupdated().Name; + + if (getAllyMap().get(clanName)) + token.Trusted = true; + + _token.Alliances.add(token); + } + + return _token; + } + + public boolean isOnlineNow() + { + for (String cur : getMembers().keySet()) + if (UtilPlayer.isOnline(cur)) + return true; + + return false; + } + + public boolean isOnline() + { + for (String cur : getMembers().keySet()) + if (UtilPlayer.isOnline(cur)) + return true; + + return System.currentTimeMillis() - _lastOnline < Clans.GetOnlineTime(); + } + + public String getProtected() + { + for (String cur : getMembers().keySet()) + if (UtilPlayer.isOnline(cur)) + return C.cRed + "No - Clan Members are Online"; + + if (System.currentTimeMillis() - _lastOnline > Clans.GetOnlineTime()) + return C.cGreen + "Yes - Clan Members are Offline"; + + return C.cGold + + "No, " + + UtilTime.convertString(Clans.GetOnlineTime() - (System.currentTimeMillis() - _lastOnline), 1, + TimeUnit.FIT) + " to Protection"; + } + + public boolean isAdmin() + { + return _admin; + } +} 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 new file mode 100644 index 000000000..b61293a0e --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java @@ -0,0 +1,53 @@ +package mineplex.game.clans.clans; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.NautHashMap; +import mineplex.game.clans.clans.repository.ClanTerritory; + +public class ClansManager extends MiniPlugin +{ + private int _dominanceLimit = 16; + private int _inviteExpire = 2; + private int _nameMin = 3; + private int _nameMax = 10; + private long _reclaimTime = 1800000; + private long _onlineTime = 1200000; + + //Clans + private NautHashMap _clanMap = new NautHashMap(); + private NautHashMap _clanMemberMap = new NautHashMap(); + private NautHashMap _claimMap = new NautHashMap(); + private NautHashMap _unclaimMap = new NautHashMap(); + + public ClansManager(String moduleName, JavaPlugin plugin) + { + super(moduleName, plugin); + } + + public int getInviteExpire() + { + return _inviteExpire; + } + + public NautHashMap getClanMap() + { + return _clanMap; + } + + public NautHashMap getClanMemberMap() + { + return _clanMemberMap; + } + + public ClanInfo getClan(String clan) + { + return _clanMap.get(clan); + } + + public NautHashMap getClaimMap() + { + return _claimMap; + } +} 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 new file mode 100644 index 000000000..181898923 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java @@ -0,0 +1,551 @@ +package mineplex.game.clans.clans; + +import java.util.LinkedList; +import java.util.Map.Entry; + +import org.bukkit.ChatColor; +import org.bukkit.Chunk; +import org.bukkit.Location; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClient; +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.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import mineplex.game.clans.clans.repository.ClanTerritory; +import mineplex.game.clans.clans.repository.tokens.ClanTerritoryToken; + +public class ClansUtility +{ + private ClansManager Clans; + + public ClansUtility(ClansManager clans) + { + Clans = clans; + } + + public enum ClanRelation + { + SELF, + ALLY, + ALLY_TRUST, + NEUTRAL, + ENEMY, + PILLAGE, + ADMIN, + SAFE + } + + public ClanInfo searchClanPlayer(Player caller, String name, boolean inform) + { + //CLAN + LinkedList clanMatchList = new LinkedList(); + + for (ClanInfo cur : Clans.getClanMap().values()) + { + if (cur.getName().equalsIgnoreCase(name)) + return cur; + + if (cur.getName().toLowerCase().contains(name.toLowerCase())) + clanMatchList.add(cur); + } + + if (clanMatchList.size() == 1) + return clanMatchList.get(0); + + //No / Non-Unique + String clanMatchString = "None"; + if (clanMatchList.size() > 1) + { + for (ClanInfo cur : clanMatchList) + clanMatchString += cur.getName() + " "; + } + + //PLAYER + LinkedList playerMatchList = new LinkedList(); + + for (Entry clanMemberEntry : Clans.getClanMemberMap().entrySet()) + { + if (clanMemberEntry.getKey().equalsIgnoreCase(name)) + return clanMemberEntry.getValue(); + + if (clanMemberEntry.getKey().toLowerCase().contains(name.toLowerCase())) + playerMatchList.add(clanMemberEntry.getValue()); + } + + if (playerMatchList.size() == 1) + return playerMatchList.get(0); + + //No / Non-Unique + String playerMatchString = "None"; + if (playerMatchList.size() > 1) + { + for (ClanInfo cur : playerMatchList) + playerMatchString += cur.getName() + " "; + } + + if (inform) + { + UtilPlayer.message(caller, F.main("Clan Search", "" + + C.mCount + (clanMatchList.size() + playerMatchList.size()) + + C.mBody + " matches for [" + + C.mElem + name + + C.mBody + "]."), false); + + UtilPlayer.message(caller, F.desc("Matches via Clan", clanMatchString), false); + UtilPlayer.message(caller, F.desc("Matches via Player", playerMatchString), false);; + } + + return null; + } + + public ClanInfo searchClan(Player caller, String name, boolean inform) + { + LinkedList matchList = new LinkedList(); + + for (ClanInfo cur : Clans.getClanMap().values()) + { + if (cur.getName().equalsIgnoreCase(name)) + return cur; + + if (cur.getName().toLowerCase().contains(name.toLowerCase())) + matchList.add(cur); + } + + //No / Non-Unique + if (matchList.size() != 1) + { + if (!inform) + return null; + + //Inform + UtilPlayer.message(caller, F.main("Clan Search", "" + + C.mCount + matchList.size() + + C.mBody + " matches for [" + + C.mElem + name + + C.mBody + "]."), false); + + if (matchList.size() > 0) + { + String matchString = ""; + for (ClanInfo cur : matchList) + matchString += cur.getName() + " "; + + UtilPlayer.message(caller, F.main("Clan Search", "" + + C.mBody + " Matches [" + + C.mElem + matchString + + C.mBody + "]."), false); + } + + return null; + } + + return matchList.get(0); + } + + public ClanInfo getClanByClanName(String clan) + { + return Clans.getClan(clan); + } + + public ClanInfo getClanByPlayer(Player player) + { + return getClanByPlayer(player.getName()); + } + + public ClanInfo getClanByPlayer(String name) + { + if (!Clans.getClanMemberMap().containsKey(name)) + return null; + + return Clans.getClanMemberMap().get(name); + } + + public Role getRole(Player player) + { + try + { + return getClanByPlayer(player).getMembers().get(player.getName()); + } + catch (Exception e) + { + return Role.NONE; + } + } + + public boolean isSafe(Player player) + { + ClanInfo clan = getClanByPlayer(player); + + if (!UtilTime.elapsed(Clans.Clients().Get(player).Player().GetLastDamager(), 15000)) + return false; + + return isSafe(player.getLocation()); + } + + public boolean isSafe(Location loc) + { + if (!Clans.getClaimMap().containsKey(UtilWorld.chunkToStr(loc.getChunk()))) + return false; + + return Clans.getClaimMap().get(UtilWorld.chunkToStr(loc.getChunk())).Safe; + } + + public boolean isChunkHome(ClanInfo clan, Chunk chunk) + { + if (clan == null) + return false; + + if (clan.getHome() == null) + return false; + + return clan.getHome().getChunk().equals(chunk); + } + + public ClanTerritory getClaim(Location loc) + { + String chunk = UtilWorld.chunkToStr(loc.getChunk()); + return Clans.getClaimMap().get(chunk); + } + + public ClanTerritory getClaim(String chunk) + { + return Clans.getClaimMap().get(chunk); + } + + public ClanInfo getOwner(String chunk) + { + ClanTerritory claim = getClaim(chunk); + + if (claim == null) + return null; + + return getOwner(claim); + } + + public ClanInfo getOwner(Location loc) + { + ClanTerritory claim = getClaim(loc); + + if (claim != null) + return getOwner(claim); + + return null; + } + + public ClanInfo getOwner(ClanTerritory claim) + { + return getClanByClanName(claim.Owner); + } + + public String getOwnerString(Location loc) + { + ClanInfo owner = getOwner(loc); + + if (owner == null) + return "Wilderness"; + + return owner.getName(); + } + + public String getOwnerStringRel(Location loc, String player) + { + ClanRelation rel = relPT(player, UtilWorld.chunkToStr(loc.getChunk())); + return mRel(rel, getOwnerString(loc), true); + } + + public boolean isClaimed(Location loc) + { + String chunk = UtilWorld.chunkToStr(loc.getChunk()); + + return Clans.getClaimMap().containsKey(chunk); + } + + public boolean isAlliance(String player, Location loc) + { + if (!Clans.getClanMemberMap().containsKey(player)) + return false; + + if (!isClaimed(loc)) + return false; + + return getOwner(getClaim(loc)).isAlly(Clans.getClanMemberMap().get(player).getName()); + } + + public boolean isSelf(String player, Location loc) + { + if (!Clans.getClanMemberMap().containsKey(player)) + return false; + + if (!isClaimed(loc)) + return false; + + return getOwner(getClaim(loc)).isSelf(Clans.getClanMemberMap().get(player).getName()); + } + + public boolean isAdmin(Location loc) + { + if (!isClaimed(loc)) + return false; + + return getOwner(getClaim(loc)).isAdmin(); + } + + public boolean isSpecial(Location loc, String special) + { + if (!isClaimed(loc)) + return false; + + if (!isAdmin(loc)) + return false; + + return getOwner(getClaim(loc)).getName().toLowerCase().contains(special.toLowerCase()); + } + + public ClanRelation getAccess(Player player, Location loc) + { + //Observer Override + if (Clans.Observer().isObserver(player, false)) + { + if (Clans.Observer().isObserver(player, true)) + return ClanRelation.SELF; + else + return ClanRelation.NEUTRAL; + } + + ClanInfo owner = this.getOwner(loc); + ClanInfo clan = getClanByPlayer(player); + + if (owner == null) + return ClanRelation.SELF; + + if (owner.equals(Clans.CAdmin().getMimic(player, false))) + return ClanRelation.SELF; + + if (owner.equals(clan)) + return ClanRelation.SELF; + + if (clan != null) + if (owner.getTrust(clan.getName())) + return ClanRelation.ALLY_TRUST; + + if (clan != null) + if (owner.isAlly(clan.getName())) + return ClanRelation.ALLY; + + if (clan != null) + if (owner.isEnemy(clan.getName())) + return ClanRelation.ENEMY; + + return ClanRelation.NEUTRAL; + } + + //Player Player + public ClanRelation relPP(String pA, String pB) + { + return rel(getClanByPlayer(pA), getClanByPlayer(pB)); + } + + //Clan Clan + public ClanRelation relCC(String cA, String cB) + { + return rel(searchClan(null, cA, false), searchClan(null, cB, false)); + } + + //Territory Territory + public ClanRelation relTT(String tA, String tB) + { + return rel(getOwner(tA), getOwner(tB)); + } + + //Player Clan + public ClanRelation relPC(String pA, String cB) + { + return rel(getClanByPlayer(pA), searchClan(null, cB, false)); + } + + //Player Clan (Object) + public ClanRelation relPC(String pA, ClanInfo cB) + { + return rel(getClanByPlayer(pA), cB); + } + + //Player Territory + public ClanRelation relPT(String pA, String tB) + { + ClanTerritory claim = getClaim(tB); + if (claim != null) + if (claim.Safe) + return ClanRelation.SAFE; + + return rel(getClanByPlayer(pA), getOwner(tB)); + } + + //Clan Territory + public ClanRelation relCT(String cA, String tB) + { + ClanTerritory claim = getClaim(tB); + if (claim != null) + if (claim.Safe) + return ClanRelation.SAFE; + + return rel(searchClan(null, cA, false), getOwner(tB)); + } + + public ClanRelation rel(ClanInfo cA, ClanInfo cB) + { + if (cA == null || cB == null) + return ClanRelation.NEUTRAL; + + //Self + if (cA.isAdmin() || cB.isAdmin()) + return ClanRelation.ADMIN; + + if (cA.getName().equals(cB.getName())) + return ClanRelation.SELF; + + //Ally + if (cA.getTrust(cB.getName())) + return ClanRelation.ALLY_TRUST; + + if (cA.isAlly(cB.getName())) + return ClanRelation.ALLY; + + //Enemy + return ClanRelation.NEUTRAL; + } + + public ChatColor relChatColor(ClanRelation relation, boolean dark) + { + if (relation == ClanRelation.SAFE) return C.xAdmin; + if (relation == ClanRelation.ADMIN) return C.xAdmin; + + if (!dark) + { + if (relation == ClanRelation.SELF) return C.xSelf; + if (relation == ClanRelation.ALLY_TRUST) return C.xdAlly; + if (relation == ClanRelation.ALLY) return C.xAlly; + if (relation == ClanRelation.ENEMY) return C.xWar; + if (relation == ClanRelation.PILLAGE) return C.xPillage; + return C.xEnemy; + } + + if (relation == ClanRelation.SELF) return C.xdSelf; + if (relation == ClanRelation.ALLY_TRUST) return C.xAlly; + if (relation == ClanRelation.ALLY) return C.xdAlly; + if (relation == ClanRelation.ENEMY) return C.xdWar; + if (relation == ClanRelation.PILLAGE) return C.xdPillage; + return C.xdEnemy; + } + + public String relColor(ClanRelation relation, boolean dark) + { + if (relation == ClanRelation.SAFE) return C.xAdmin + "(" + C.xSafe + "SAFE" + C.xAdmin + ") "; + + return relChatColor(relation, dark) + ""; + } + + public String mRel(ClanRelation relation, String message, boolean dark) + { + return relColor(relation, dark) + message + C.mChat; + } + + public boolean playerSelf(String pA, String pB) + { + ClanInfo cA = getClanByPlayer(pA); + ClanInfo cB = getClanByPlayer(pB); + + if (cA == null || cB == null) + return false; + + return cA.isSelf(cB.getName()); + } + + public boolean playerAlly(String pA, String pB) + { + ClanInfo cA = getClanByPlayer(pA); + ClanInfo cB = getClanByPlayer(pB); + + if (cA == null || cB == null) + return false; + + return cA.isAlly(cB.getName()); + } + + public boolean playerEnemy(String pA, String pB) + { + ClanInfo cA = getClanByPlayer(pA); + ClanInfo cB = getClanByPlayer(pB); + + if (cA == null || cB == null) + return true; + + return !(cA.isAlly(cB.getName()) || cA.isSelf(cB.getName())); + } + + public boolean canHurt(Player damagee, Player damager) + { + if (damagee == null) + return false; + + if (isSafe(damagee)) + return false; + + if (damager == null) + return true; + + if (isSafe(damager)) + return false; + + ClanRelation rel = Clans.CUtil().relPP(damagee.getName(), damager.getName()); + + if (rel == ClanRelation.ALLY || rel == ClanRelation.ALLY_TRUST || rel == ClanRelation.SELF) + return false; + + return true; + } + + public void updateRelations(String name) + { + updateRelations(UtilPlayer.searchExact(name)); + } + + public void updateRelations(Player player) + { + if (player == null) + return; + + CoreClient client = Clans.Clients().Get(player); + + for (Player cur : UtilServer.getPlayers()) + { + //For Player + client.Clan().SetRelationship( + cur.getName(), relPP(cur.getName(), player.getName())); + + //For Other + Clans.Clients().Get(cur.getName()).Clan().SetRelationship( + player.getName(), relPP(player.getName(), cur.getName())); + + if (player.canSee(cur)) + { + player.hidePlayer(cur); + player.showPlayer(cur); + } + + if (cur.canSee(player)) + { + cur.hidePlayer(player); + cur.showPlayer(player); + } + } + } + + public boolean isBorderlands(Location loc) + { + return (Math.abs(loc.getX()) > 400 || Math.abs(loc.getZ()) > 400); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/ClanRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/ClanRepository.java new file mode 100644 index 000000000..6b03f54ab --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/ClanRepository.java @@ -0,0 +1,23 @@ +package mineplex.game.clans.clans.repository; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.database.RepositoryBase; + +public class ClanRepository extends RepositoryBase +{ + public ClanRepository(JavaPlugin plugin) + { + super(plugin, "jdbc:mysql://db.mineplex.com:3306/Account?autoReconnect=true&failOverReadOnly=false&maxReconnects=10", "root", "tAbechAk3wR7tuTh"); + } + + @Override + protected void initialize() + { + } + + @Override + protected void update() + { + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/ClanTerritory.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/ClanTerritory.java new file mode 100644 index 000000000..9db9852a1 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/ClanTerritory.java @@ -0,0 +1,7 @@ +package mineplex.game.clans.clans.repository; + +public class ClanTerritory +{ + public boolean Safe; + public String Owner; +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/tokens/ClanAllianceToken.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/tokens/ClanAllianceToken.java new file mode 100644 index 000000000..fe4520969 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/tokens/ClanAllianceToken.java @@ -0,0 +1,7 @@ +package mineplex.game.clans.clans.repository.tokens; + +public class ClanAllianceToken +{ + public String ClanName; + public boolean Trusted; +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/tokens/ClanMemberToken.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/tokens/ClanMemberToken.java new file mode 100644 index 000000000..3ff8fe52f --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/tokens/ClanMemberToken.java @@ -0,0 +1,7 @@ +package mineplex.game.clans.clans.repository.tokens; + +public class ClanMemberToken +{ + public String Name; + public String ClanRole; +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/tokens/ClanTerritoryToken.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/tokens/ClanTerritoryToken.java new file mode 100644 index 000000000..5b7ca2108 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/tokens/ClanTerritoryToken.java @@ -0,0 +1,10 @@ +package mineplex.game.clans.clans.repository.tokens; + +public class ClanTerritoryToken +{ + public String ClanName; + public int ClanId; + public String ServerName; + public String Chunk; + public boolean Safe; +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/tokens/ClanToken.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/tokens/ClanToken.java new file mode 100644 index 000000000..99b18e668 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/repository/tokens/ClanToken.java @@ -0,0 +1,17 @@ +package mineplex.game.clans.clans.repository.tokens; + +import java.util.List; + +public class ClanToken +{ + public String Name; + public String Description; + public String Home; + public boolean Admin; + public long DateCreated; + public long LastOnline; + + List Members; + List Territories; + List Alliances; +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/Field.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/Field.java new file mode 100644 index 000000000..19e08b7f2 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/Field.java @@ -0,0 +1,41 @@ +package mineplex.game.clans.fields; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.creature.Creature; +import mineplex.core.energy.Energy; +import mineplex.game.clans.fields.repository.FieldRepository; +import mineplex.minecraft.game.core.condition.ConditionFactory; + +public class Field extends MiniPlugin +{ + private FieldBlock _block; + private FieldOre _ore; + private FieldMonster _mob; + + public Field(JavaPlugin plugin, Creature creature, ConditionFactory condition, Energy energy, String serverName) + { + super("Field Factory", plugin); + + FieldRepository repository = new FieldRepository(plugin); + _block = new FieldBlock(plugin, condition, energy, repository, serverName); + _ore = new FieldOre(plugin, repository, serverName); + _mob = new FieldMonster(plugin, repository, creature, serverName); + } + + public FieldBlock GetBlock() + { + return _block; + } + + public FieldOre GetOre() + { + return _ore; + } + + public FieldMonster GetMonster() + { + return _mob; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlock.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldBlock.java similarity index 59% rename from Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlock.java rename to Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldBlock.java index 72d0d1d47..d2a980f2a 100644 --- a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlock.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldBlock.java @@ -1,11 +1,9 @@ -package me.chiss.Core.Field; +package mineplex.game.clans.fields; import java.util.HashMap; import java.util.HashSet; import java.util.WeakHashMap; -import nautilus.minecraft.core.webserver.token.Server.FieldBlockToken; - import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; @@ -17,19 +15,26 @@ import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.plugin.java.JavaPlugin; -import me.chiss.Core.Module.AModule; -import mineplex.core.server.IRepository; +import mineplex.core.MiniPlugin; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.core.common.Rank; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.energy.Energy; +import mineplex.game.clans.fields.repository.FieldBlockToken; +import mineplex.game.clans.fields.repository.FieldRepository; +import mineplex.minecraft.game.core.condition.ConditionFactory; -public class FieldBlock extends AModule +public class FieldBlock extends MiniPlugin { + private ConditionFactory _conditionFactory; + private Energy _energy; + private FieldRepository _repository; private HashMap _blocks; private HashSet _active = new HashSet(); @@ -44,183 +49,25 @@ public class FieldBlock extends AModule private String _serverName; - public FieldBlock(JavaPlugin plugin, IRepository repository, String serverName) + public FieldBlock(JavaPlugin plugin, ConditionFactory conditionFactory, Energy energy, FieldRepository repository, String serverName) { - super("Field Block", plugin, repository); - + super("Field Block", plugin); + + _conditionFactory = conditionFactory; + _energy = energy; + _repository = repository; _blocks = new HashMap(); _serverName = serverName; load(); } - - //Module Functions - @Override - public void enable() - { - - } - - @Override - public void disable() - { - clean(); - } - - @Override - public void config() - { - - } - - @Override - public void commands() - { - AddCommand("fb"); - } - - @Override - public void command(Player caller, String cmd, String[] args) - { - if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) - return; - - if (args.length == 0) - { - showSettings(caller); - return; - } - - if (args[0].equalsIgnoreCase("toggle")) - { - if (!_active.remove(caller.getName())) - _active.add(caller.getName()); - - UtilPlayer.message(caller, F.main(GetName(), "Interact Active: " + F.tf(_active.contains(caller.getName())))); - } - - else if (args[0].equalsIgnoreCase("load")) - { - load(); - UtilPlayer.message(caller, F.main(_moduleName, "Reloaded Field Blocks from Database.")); - } - - else if (args[0].equalsIgnoreCase("wipe")) - { - wipe(caller); - } - - else if (args[0].equalsIgnoreCase("help")) - { - help(caller); - } - - else if (args.length <= 1) - { - help(caller); - } - - else if (args[0].equalsIgnoreCase("title")) - { - _title.put(caller, args[1]); - showSettings(caller); - } - - else if (args[0].equalsIgnoreCase("stock")) - { - try - { - int count = Integer.parseInt(args[1]); - if (count < 1) count = 1; - _stock.put(caller, count); - showSettings(caller); - } - catch (Exception e) - { - UtilPlayer.message(caller, F.main(_moduleName, "Invalid Stock Max.")); - } - } - - else if (args[0].equalsIgnoreCase("regen")) - { - try - { - double regen = Double.parseDouble(args[1]); - if (regen < 0) regen = 0; - _regen.put(caller, UtilMath.trim(1, regen)); - showSettings(caller); - } - catch (Exception e) - { - UtilPlayer.message(caller, F.main(_moduleName, "Invalid Stock Regeneration Time.")); - } - } - - else if (args[0].equalsIgnoreCase("empty")) - { - try - { - String[] toks = args[1].split(":"); - - int id = Integer.parseInt(toks[0]); - byte data = Byte.parseByte(toks[1]); - - _emptyId.put(caller, id); - _emptyData.put(caller, data); - showSettings(caller); - } - catch (Exception e) - { - UtilPlayer.message(caller, F.main(_moduleName, "Invalid Empty Block.")); - } - } - - - else if (args[0].equalsIgnoreCase("loot")) - { - boolean error = false; - for (String cur : args[1].split(",")) - { - String[] loot = cur.split(":"); - - if (loot.length != 5) - { - error = true; - break; - } - - try - { - Integer.parseInt(loot[0]); - Byte.parseByte(loot[1]); - Integer.parseInt(loot[2]); - Integer.parseInt(loot[3]); - Integer.parseInt(loot[4]); - } - catch (Exception e) - { - error = true; - break; - } - } - - if (error) - { - UtilPlayer.message(caller, F.main(_moduleName, "Invalid Loot String.")); - return; - } - - _lootString.put(caller, args[1]); - showSettings(caller); - } - } - - private void showSettings(Player caller) + + public void showSettings(Player caller) { populateSettings(caller); - UtilPlayer.message(caller, F.main(_moduleName, "Field Addition Settings;")); + UtilPlayer.message(caller, F.main(getName(), "Field Addition Settings;")); UtilPlayer.message(caller, F.desc("Title", _title.get(caller))); UtilPlayer.message(caller, F.desc("Stock", _stock.get(caller)+"")); UtilPlayer.message(caller, F.desc("Regen", _regen.get(caller)+"")); @@ -257,34 +104,31 @@ public class FieldBlock extends AModule if (event.getPlayer().getItemInHand() != null && event.getPlayer().getItemInHand().getType().toString().contains("PICKAXE")) { - if (Util().Event().isAction(event, ActionType.R_BLOCK)) + if (UtilEvent.isAction(event, ActionType.R_BLOCK)) showBlock(event.getPlayer(), event); } - else if (Util().Gear().isMat(event.getPlayer().getItemInHand(), Material.GLOWSTONE_DUST)) + else if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.GLOWSTONE_DUST)) { - if (Util().Event().isAction(event, ActionType.L_BLOCK)) + if (UtilEvent.isAction(event, ActionType.L_BLOCK)) addBlock(event.getPlayer(), event); - else if (Util().Event().isAction(event, ActionType.R)) + else if (UtilEvent.isAction(event, ActionType.R)) glowBlocks(event.getPlayer(), event); } - else if (Util().Gear().isMat(event.getPlayer().getItemInHand(), Material.REDSTONE)) + else if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.REDSTONE)) { - if (Util().Event().isAction(event, ActionType.L_BLOCK)) + if (UtilEvent.isAction(event, ActionType.L_BLOCK)) delBlock(event.getPlayer(), event); - else if (Util().Event().isAction(event, ActionType.R)) + else if (UtilEvent.isAction(event, ActionType.R)) glowBlocks(event.getPlayer(), event); } } private void glowBlocks(Player player, PlayerInteractEvent event) { - if (!Clients().Get(player).Rank().Has(Rank.ADMIN, false)) - return; - load(); for (FieldBlockData cur : _blocks.values()) @@ -293,12 +137,12 @@ public class FieldBlock extends AModule event.setCancelled(true); } - private void wipe(Player player) + public void wipe(Player player) { for (FieldBlockData cur : _blocks.values()) { cur.setEmpty(); - GetRepository().DeleteFieldBlock(_serverName, UtilWorld.locToStr(cur.getLocation())); + _repository.deleteFieldBlock(_serverName, UtilWorld.locToStr(cur.getLocation())); } _blocks.clear(); @@ -308,10 +152,7 @@ public class FieldBlock extends AModule private void delBlock(Player player, PlayerInteractEvent event) { - if (!Clients().Get(player).Rank().Has(Rank.ADMIN, false)) - return; - - GetRepository().DeleteFieldBlock(_serverName, UtilWorld.locToStr(event.getClickedBlock().getLocation())); + _repository.deleteFieldBlock(_serverName, UtilWorld.locToStr(event.getClickedBlock().getLocation())); //Inform event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, 42); @@ -322,9 +163,6 @@ public class FieldBlock extends AModule private void addBlock(Player player, PlayerInteractEvent event) { - if (!Clients().Get(player).Rank().Has(Rank.ADMIN, false)) - return; - populateSettings(player); showSettings(player); @@ -340,7 +178,7 @@ public class FieldBlock extends AModule token.StockRegenTime = _regen.get(player); token.Loot = _lootString.get(player); - GetRepository().AddFieldBlock(token); + _repository.addFieldBlock(token); //Inform event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, 41); @@ -388,7 +226,7 @@ public class FieldBlock extends AModule { clean(); - for (FieldBlockToken token : GetRepository().GetFieldBlocks(_serverName)) + for (FieldBlockToken token : _repository.getFieldBlocks(_serverName)) { Location loc = UtilWorld.strToLoc(token.Location); _blocks.put(token.Location, new FieldBlockData(this, loc, token.BlockId, token.BlockData, token.EmptyId, token.EmptyData, token.StockMax, token.StockRegenTime, token.Loot)); @@ -409,5 +247,50 @@ public class FieldBlock extends AModule return _blocks.get(UtilWorld.locToStr(block.getLocation())); return null; + } + + public Energy getEnergy() + { + return _energy; + } + + public HashSet getActive() + { + return _active; + } + + public WeakHashMap getLootString() + { + return _lootString; + } + + public WeakHashMap getEmptyId() + { + return _emptyId; + } + + public WeakHashMap getEmptyData() + { + return _emptyData; + } + + public WeakHashMap getRegen() + { + return _regen; + } + + public WeakHashMap getStock() + { + return _stock; + } + + public WeakHashMap getTitle() + { + return null; + } + + public ConditionFactory getCondition() + { + return _conditionFactory; } } diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlockData.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldBlockData.java similarity index 93% rename from Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlockData.java rename to Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldBlockData.java index 8dc5afe28..b81f8c853 100644 --- a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlockData.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldBlockData.java @@ -1,4 +1,4 @@ -package me.chiss.Core.Field; +package mineplex.game.clans.fields; import java.util.ArrayList; @@ -53,7 +53,7 @@ public class FieldBlockData if (loot.length != 5) { - Field.Log("Loot Failure: " + cur); + System.out.println("Loot Failure: " + cur); continue; } @@ -68,7 +68,7 @@ public class FieldBlockData } catch (Exception e) { - Field.Log("Loot Failure: " + cur); + System.out.println("Loot Failure: " + cur); } } @@ -129,7 +129,7 @@ public class FieldBlockData public void handleMined(Player player) { - if (!Field.Energy().use(player, "Mine Field Block", 60, true, true)) + if (!Field.getEnergy().Use(player, "Mine Field Block", 60, true, true)) return; //Set Break Time - Avoid Instant Regen @@ -151,7 +151,7 @@ public class FieldBlockData } //Slow - Field.Condition().Factory().Slow("Field Slow", player, player, 6, 1, false, true, false); + Field.getCondition().Slow("Field Slow", player, player, 6, 1, false, true, false, false); } public boolean tryMine() diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlockLootData.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldBlockLootData.java similarity index 96% rename from Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlockLootData.java rename to Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldBlockLootData.java index e1c3b6796..3c906cf92 100644 --- a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldBlockLootData.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldBlockLootData.java @@ -1,4 +1,4 @@ -package me.chiss.Core.Field; +package mineplex.game.clans.fields; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilMath; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldMonster.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldMonster.java new file mode 100644 index 000000000..5690bea14 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldMonster.java @@ -0,0 +1,174 @@ +package mineplex.game.clans.fields; + +import java.util.HashSet; +import java.util.WeakHashMap; + +import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.creature.Creature; +import mineplex.game.clans.fields.monsters.FieldMonsterBase; +import mineplex.game.clans.fields.repository.FieldMonsterToken; +import mineplex.game.clans.fields.repository.FieldRepository; + +public class FieldMonster extends MiniPlugin +{ + private Creature _creature; + private FieldRepository _repository; + private HashSet _pits; + private String _serverName; + + private WeakHashMap _input = new WeakHashMap(); + + public FieldMonster(JavaPlugin plugin, FieldRepository repository, Creature creature, String serverName) + { + super("Field Monster", plugin); + + _repository = repository; + _creature = creature; + _pits = new HashSet(); + _serverName = serverName; + + Load(); + } + + public void Help(Player caller) + { + UtilPlayer.message(caller, F.main(getName(), "Commands List;")); + UtilPlayer.message(caller, F.help("/fm type ", "Set Monster Type", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm max <#>", "Set Monster Limit", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm rate ", "Set Monster Rate", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm radius <#>", "Set Area Radius", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm height <#>", "Set Area Height", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm create ", "Create at your Location", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm delete ", "Delete Field", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm list", "List Monster Fields", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm info ", "Display Monster Field", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm kill", "Kills all Field Monsters", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/fm wipe", "Delete All Monster Field (Database)", Rank.ADMIN)); + } + + public void Create(Player caller, String name) + { + FieldMonsterInput input = _input.get(caller); + + if (input.type == null) + { + UtilPlayer.message(caller, F.main(getName(), "You have not set Monster Type.")); + return; + } + + for (FieldMonsterBase pit : _pits) + { + if (name.equalsIgnoreCase(pit.GetName())) + { + UtilPlayer.message(caller, F.main(getName(), "Monster Field with this name already exists.")); + return; + } + } + + FieldMonsterBase pit = new FieldMonsterBase(this, name, _serverName, input.type, input.mobMax, input.mobRate, caller.getLocation(), input.radius, input.height); + Add(pit, true); + + UtilPlayer.message(caller, F.main(getName(), "You created Monster Field.")); + pit.Display(caller); + } + + private void Add(FieldMonsterBase pit, boolean repo) + { + UtilServer.getServer().getPluginManager().registerEvents(pit, GetPlugin()); + _pits.add(pit); + + if (repo) + _repository.addFieldMonster(pit.GetToken()); + } + + public void Delete(Player caller, String name) + { + HashSet remove = new HashSet(); + + for (FieldMonsterBase pit : _pits) + if (pit.GetName().equalsIgnoreCase(name)) + remove.add(pit); + + int i = remove.size(); + + for (FieldMonsterBase pit : remove) + Delete(pit, true); + + UtilPlayer.message(caller, F.main(getName(), "Deleted " + i + " Monster Field(s).")); + } + + private void Delete(FieldMonsterBase pit, boolean repo) + { + _pits.remove(pit); + pit.RemoveMonsters(); + HandlerList.unregisterAll(pit); + + if (repo) + _repository.deleteFieldMonster(_serverName, pit.GetToken().Name); + } + + public void Wipe(Player player, boolean repo) + { + HashSet remove = new HashSet(); + + for (FieldMonsterBase pit : _pits) + remove.add(pit); + + _pits.clear(); + + for (FieldMonsterBase pit : remove) + Delete(pit, repo); + + UtilPlayer.message(player, F.main(_moduleName, "Field Monsters Wiped.")); + } + + private void Load() + { + Wipe(null, false); + + for (FieldMonsterToken token : _repository.getFieldMonsters(_serverName)) + { + EntityType type = UtilEnt.searchEntity(null, token.Type, false); + if (type == null) continue; + + Location loc = UtilWorld.strToLoc(token.Centre); + if (loc == null) continue; + + FieldMonsterBase pit = new FieldMonsterBase(this, token.Name, _serverName, type, token.MobMax, token.MobRate, loc, token.Radius, token.Height); + Add(pit, false); + } + } + + private void Clean() + { + for (FieldMonsterBase pit : _pits) + pit.RemoveMonsters(); + } + + public WeakHashMap getInput() + { + return _input; + } + + public HashSet getPits() + { + return _pits; + } + + public Creature getCreature() + { + return _creature; + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldMonsterInput.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldMonsterInput.java similarity index 95% rename from Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldMonsterInput.java rename to Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldMonsterInput.java index d8227a054..ac3d0a60f 100644 --- a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldMonsterInput.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldMonsterInput.java @@ -1,4 +1,4 @@ -package me.chiss.Core.Field; +package mineplex.game.clans.fields; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldOre.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOre.java similarity index 73% rename from Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldOre.java rename to Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOre.java index c64bf2609..f4c4d122a 100644 --- a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldOre.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOre.java @@ -1,10 +1,8 @@ -package me.chiss.Core.Field; +package mineplex.game.clans.fields; import java.util.ArrayList; import java.util.HashSet; -import nautilus.minecraft.core.webserver.token.Server.FieldOreToken; - import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; @@ -16,20 +14,24 @@ import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.plugin.java.JavaPlugin; -import me.chiss.Core.Module.AModule; -import mineplex.core.server.IRepository; +import mineplex.core.MiniPlugin; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.core.common.Rank; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.game.clans.fields.repository.FieldOreToken; +import mineplex.game.clans.fields.repository.FieldRepository; -public class FieldOre extends AModule +public class FieldOre extends MiniPlugin { + private FieldRepository _repository; private HashSet _active = new HashSet(); private ArrayList _oreInactive = new ArrayList(); @@ -42,86 +44,15 @@ public class FieldOre extends AModule private String _serverName; - public FieldOre(JavaPlugin plugin, IRepository repository, String serverName) + public FieldOre(JavaPlugin plugin, FieldRepository repository, String serverName) { - super("Field Ore", plugin, repository); + super("Field Ore", plugin); + _repository = repository; _serverName = serverName; load(); } - - @Override - public void enable() - { - - } - - @Override - public void disable() - { - clean(); - } - - @Override - public void config() - { - - } - - @Override - public void commands() - { - AddCommand("fo"); - } - - @Override - public void command(Player caller, String cmd, String[] args) - { - if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) - return; - - if (args.length == 0) - { - help(caller); - return; - } - - if (args[0].equalsIgnoreCase("toggle")) - { - if (!_active.remove(caller.getName())) - _active.add(caller.getName()); - - UtilPlayer.message(caller, F.main(GetName(), "Interact Active: " + F.tf(_active.contains(caller.getName())))); - } - - else if (args[0].equalsIgnoreCase("help")) - { - help(caller); - } - - else if (args[0].equalsIgnoreCase("reset")) - { - reset(caller); - } - - else if (args[0].equalsIgnoreCase("fill")) - { - fill(caller); - } - - else if (args[0].equalsIgnoreCase("list")) - { - list(caller); - } - - else if (args[0].equalsIgnoreCase("wipe")) - { - wipe(caller); - } - - - } public void help(Player caller) { @@ -139,17 +70,17 @@ public class FieldOre extends AModule if (!_active.contains(event.getPlayer().getName())) return; - if (Util().Gear().isMat(event.getPlayer().getItemInHand(), Material.DIAMOND)) + if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.DIAMOND)) { - if (Util().Event().isAction(event, ActionType.L)) + if (UtilEvent.isAction(event, ActionType.L)) addBlock(event.getPlayer(), event); - else if (Util().Event().isAction(event, ActionType.R_BLOCK)) + else if (UtilEvent.isAction(event, ActionType.R_BLOCK)) delBlock(event.getPlayer(), event); } } - private void reset(Player player) + public void reset(Player player) { for (FieldOreData ore : _oreActive) { @@ -162,7 +93,7 @@ public class FieldOre extends AModule UtilPlayer.message(player, F.main(_moduleName, "Field Ore Reset.")); } - private void fill(Player player) + public void fill(Player player) { while (!_oreInactive.isEmpty()) _oreInactive.get(UtilMath.r(_oreInactive.size())).StartVein(2 + UtilMath.r(5)); @@ -170,20 +101,20 @@ public class FieldOre extends AModule UtilPlayer.message(player, F.main(_moduleName, "Field Ore Generated.")); } - private void list(Player player) + public void list(Player player) { UtilPlayer.message(player, F.main(_moduleName, F.value("Total", ""+_oreLocations.size()))); UtilPlayer.message(player, F.main(_moduleName, F.value("Active", ""+_oreActive.size()))); UtilPlayer.message(player, F.main(_moduleName, F.value("Inactive", ""+_oreInactive.size()))); } - private void wipe(Player player) + public void wipe(Player player) { reset(player); for (Location loc : _oreLocations) { - GetRepository().DeleteFieldOre(_serverName, UtilWorld.locToStr(loc)); + _repository.deleteFieldOre(_serverName, UtilWorld.locToStr(loc)); } _oreInactive.clear(); @@ -194,9 +125,6 @@ public class FieldOre extends AModule private void addBlock(Player player, PlayerInteractEvent event) { - if (!Clients().Get(player).Rank().Has(Rank.ADMIN, false)) - return; - Block block = player.getTargetBlock(null, 0); if (Get(block.getLocation()) != null) @@ -209,7 +137,7 @@ public class FieldOre extends AModule FieldOreToken token = new FieldOreToken(); token.Server = _serverName; token.Location = UtilWorld.locToStr(block.getLocation()); - GetRepository().AddFieldOre(token); + _repository.addFieldOre(token); //Memory _oreInactive.add(new FieldOreData(this, block.getLocation())); @@ -223,9 +151,6 @@ public class FieldOre extends AModule private void delBlock(Player player, PlayerInteractEvent event) { - if (!Clients().Get(player).Rank().Has(Rank.ADMIN, false)) - return; - event.setCancelled(true); FieldOreData ore = Get(event.getPlayer().getTargetBlock(null, 0).getLocation()); @@ -236,7 +161,7 @@ public class FieldOre extends AModule return; } - GetRepository().DeleteFieldOre(_serverName, UtilWorld.locToStr(event.getClickedBlock().getLocation())); + _repository.deleteFieldOre(_serverName, UtilWorld.locToStr(event.getClickedBlock().getLocation())); ore.GetLocation().getBlock().setType(Material.STONE); @@ -320,7 +245,7 @@ public class FieldOre extends AModule { clean(); - for (FieldOreToken token : GetRepository().GetFieldOres(_serverName)) + for (FieldOreToken token : _repository.getFieldOres(_serverName)) { Location loc = UtilWorld.strToLoc(token.Location); @@ -337,4 +262,9 @@ public class FieldOre extends AModule _oreActive.clear(); _oreLocations.clear(); } + + public HashSet getActivePlayers() + { + return _active; + } } diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldOreData.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOreData.java similarity index 99% rename from Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldOreData.java rename to Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOreData.java index c7fa15213..7e5d9bd5e 100644 --- a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldOreData.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOreData.java @@ -1,4 +1,4 @@ -package me.chiss.Core.Field; +package mineplex.game.clans.fields; import java.util.HashSet; diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/UtilField.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/UtilField.java similarity index 88% rename from Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/UtilField.java rename to Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/UtilField.java index a631b7b72..e2758e357 100644 --- a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/UtilField.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/UtilField.java @@ -1,4 +1,4 @@ -package me.chiss.Core.Field; +package mineplex.game.clans.fields; import mineplex.core.common.util.UtilServer; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/commands/FieldBlockCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/commands/FieldBlockCommand.java new file mode 100644 index 000000000..aa6c16fd1 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/commands/FieldBlockCommand.java @@ -0,0 +1,145 @@ +package mineplex.game.clans.fields.commands; + +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.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.fields.FieldBlock; + +public class FieldBlockCommand extends CommandBase +{ + public FieldBlockCommand(FieldBlock plugin) + { + super(plugin, Rank.ADMIN, "fb"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args[0].equalsIgnoreCase("toggle")) + { + if (!Plugin.getActive().remove(caller.getName())) + Plugin.getActive().add(caller.getName()); + + UtilPlayer.message(caller, F.main(Plugin.getName(), "Interact Active: " + F.tf(Plugin.getActive().contains(caller.getName())))); + } + + else if (args[0].equalsIgnoreCase("load")) + { + Plugin.load(); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Reloaded Field Blocks from Database.")); + } + + else if (args[0].equalsIgnoreCase("wipe")) + { + Plugin.wipe(caller); + } + + else if (args[0].equalsIgnoreCase("help")) + { + Plugin.help(caller); + } + + else if (args.length <= 1) + { + Plugin.help(caller); + } + + else if (args[0].equalsIgnoreCase("title")) + { + Plugin.getTitle().put(caller, args[1]); + Plugin.showSettings(caller); + } + + else if (args[0].equalsIgnoreCase("stock")) + { + try + { + int count = Integer.parseInt(args[1]); + if (count < 1) count = 1; + Plugin.getStock().put(caller, count); + Plugin.showSettings(caller); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Stock Max.")); + } + } + + else if (args[0].equalsIgnoreCase("regen")) + { + try + { + double regen = Double.parseDouble(args[1]); + if (regen < 0) regen = 0; + Plugin.getRegen().put(caller, UtilMath.trim(1, regen)); + Plugin.showSettings(caller); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Stock Regeneration Time.")); + } + } + + else if (args[0].equalsIgnoreCase("empty")) + { + try + { + String[] toks = args[1].split(":"); + + int id = Integer.parseInt(toks[0]); + byte data = Byte.parseByte(toks[1]); + + Plugin.getEmptyId().put(caller, id); + Plugin.getEmptyData().put(caller, data); + Plugin.showSettings(caller); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Empty Block.")); + } + } + + + else if (args[0].equalsIgnoreCase("loot")) + { + boolean error = false; + for (String cur : args[1].split(",")) + { + String[] loot = cur.split(":"); + + if (loot.length != 5) + { + error = true; + break; + } + + try + { + Integer.parseInt(loot[0]); + Byte.parseByte(loot[1]); + Integer.parseInt(loot[2]); + Integer.parseInt(loot[3]); + Integer.parseInt(loot[4]); + } + catch (Exception e) + { + error = true; + break; + } + } + + if (error) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Loot String.")); + return; + } + + Plugin.getLootString().put(caller, args[1]); + Plugin.showSettings(caller); + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/commands/FieldMonsterCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/commands/FieldMonsterCommand.java new file mode 100644 index 000000000..93c6fd633 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/commands/FieldMonsterCommand.java @@ -0,0 +1,170 @@ +package mineplex.game.clans.fields.commands; + +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.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.fields.FieldMonster; +import mineplex.game.clans.fields.FieldMonsterInput; +import mineplex.game.clans.fields.monsters.FieldMonsterBase; + +public class FieldMonsterCommand extends CommandBase +{ + public FieldMonsterCommand(FieldMonster plugin) + { + super(plugin, Rank.ADMIN, "fm"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (!Plugin.getInput().containsKey(caller)) + Plugin.getInput().put(caller, new FieldMonsterInput()); + + FieldMonsterInput input = Plugin.getInput().get(caller); + + if (args.length == 0) + { + Plugin.getInput().get(caller).Display(caller); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Type " + F.elem("/fm help") + " for commands.")); + } + + else if (args[0].equalsIgnoreCase("help")) + { + Plugin.Help(caller); + } + + else if (args[0].equalsIgnoreCase("type")) + { + try + { + input.type = UtilEnt.searchEntity(caller, args[1], true); + if (input.type != null) + input.Display(caller); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Monster Type.")); + } + } + + else if (args[0].equalsIgnoreCase("max")) + { + try + { + int value = Integer.parseInt(args[1]); + if (value < 1) value = 1; + input.mobMax = value; + input.Display(caller); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Monster Max.")); + } + } + + else if (args[0].equalsIgnoreCase("rate")) + { + try + { + double value = Double.parseDouble(args[1]); + if (value < 0) value = 0; + input.mobRate = value; + input.Display(caller); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Monster Rate.")); + } + } + + else if (args[0].equalsIgnoreCase("radius")) + { + try + { + int integer = Integer.parseInt(args[1]); + if (integer < 1) integer = 1; + input.radius = integer; + input.Display(caller); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Area Radius.")); + } + } + + else if (args[0].equalsIgnoreCase("height")) + { + try + { + int integer = Integer.parseInt(args[1]); + if (integer < 1) integer = 1; + input.height = integer; + input.Display(caller); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Area Height.")); + } + } + + else if (args[0].equalsIgnoreCase("create")) + { + if (args.length < 2) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Missing Monster Field Name.")); + } + else + { + Plugin.Create(caller, args[1]); + } + } + + else if (args[0].equalsIgnoreCase("delete")) + { + if (args.length < 2) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Missing Monster Field Name.")); + } + else + { + Plugin.Delete(caller, args[1]); + } + } + + else if (args[0].equalsIgnoreCase("list")) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Listing Monster Fields;")); + + for (FieldMonsterBase pit : Plugin.getPits()) + pit.Display(caller); + } + + else if (args[0].equalsIgnoreCase("info")) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Listing Monster Fields;")); + + for (FieldMonsterBase pit : Plugin.getPits()) + pit.Display(caller); + } + + else if (args[0].equalsIgnoreCase("wipe")) + { + Plugin.Wipe(caller, true); + } + + else if (args[0].equalsIgnoreCase("kill")) + { + for (FieldMonsterBase pit : Plugin.getPits()) + pit.RemoveMonsters(); + } + + else + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Command.")); + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/commands/FieldOreCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/commands/FieldOreCommand.java new file mode 100644 index 000000000..b231a57d8 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/commands/FieldOreCommand.java @@ -0,0 +1,60 @@ +package mineplex.game.clans.fields.commands; + +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.game.clans.fields.FieldOre; + +public class FieldOreCommand extends CommandBase +{ + public FieldOreCommand(FieldOre plugin) + { + super(plugin, Rank.ADMIN, "fo"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 0) + { + Plugin.help(caller); + return; + } + + if (args[0].equalsIgnoreCase("toggle")) + { + if (!Plugin.getActivePlayers().remove(caller.getName())) + Plugin.getActivePlayers().add(caller.getName()); + + UtilPlayer.message(caller, F.main(Plugin.getName(), "Interact Active: " + F.tf(Plugin.getActivePlayers().contains(caller.getName())))); + } + + else if (args[0].equalsIgnoreCase("help")) + { + Plugin.help(caller); + } + + else if (args[0].equalsIgnoreCase("reset")) + { + Plugin.reset(caller); + } + + else if (args[0].equalsIgnoreCase("fill")) + { + Plugin.fill(caller); + } + + else if (args[0].equalsIgnoreCase("list")) + { + Plugin.list(caller); + } + + else if (args[0].equalsIgnoreCase("wipe")) + { + Plugin.wipe(caller); + } + } +} diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/Monsters/FieldMonsterBase.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/monsters/FieldMonsterBase.java similarity index 91% rename from Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/Monsters/FieldMonsterBase.java rename to Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/monsters/FieldMonsterBase.java index 766fc4c5d..d9ba62a23 100644 --- a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/Monsters/FieldMonsterBase.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/monsters/FieldMonsterBase.java @@ -1,11 +1,9 @@ -package me.chiss.Core.Field.Monsters; +package mineplex.game.clans.fields.monsters; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import me.chiss.Core.Field.FieldMonster; -import me.chiss.Core.Field.UtilField; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.core.common.util.F; @@ -14,13 +12,15 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilWorld; -import nautilus.minecraft.core.webserver.token.Server.FieldMonsterToken; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.Navigation; +import mineplex.game.clans.fields.FieldMonster; +import mineplex.game.clans.fields.UtilField; +import mineplex.game.clans.fields.repository.FieldMonsterToken; +import net.minecraft.server.v1_7_R4.EntityCreature; +import net.minecraft.server.v1_7_R4.Navigation; import org.bukkit.Location; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -84,7 +84,7 @@ public class FieldMonsterBase implements Listener _mobLast = System.currentTimeMillis(); - Entity ent = Manager.Creature().SpawnEntity(SelectLocation(), _type); + Entity ent = Manager.getCreature().SpawnEntity(SelectLocation(), _type); _mobs.put(ent, 0); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldBlockToken.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldBlockToken.java new file mode 100644 index 000000000..4185a6080 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldBlockToken.java @@ -0,0 +1,14 @@ +package mineplex.game.clans.fields.repository; + +public class FieldBlockToken +{ + public String Server; + public String Location; + public int BlockId; + public byte BlockData; + public int EmptyId; + public byte EmptyData; + public int StockMax; + public double StockRegenTime; + public String Loot; +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldMonsterToken.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldMonsterToken.java new file mode 100644 index 000000000..e85ba1e16 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldMonsterToken.java @@ -0,0 +1,13 @@ +package mineplex.game.clans.fields.repository; + +public class FieldMonsterToken +{ + public String Name; + public String Server; + public String Type; + public int MobMax; + public double MobRate; + public String Centre; + public int Radius; + public int Height; +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldOreToken.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldOreToken.java new file mode 100644 index 000000000..9ad5dc8ed --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldOreToken.java @@ -0,0 +1,7 @@ +package mineplex.game.clans.fields.repository; + +public class FieldOreToken +{ + public String Server; + public String Location; +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldRepository.java new file mode 100644 index 000000000..4fc3aa9ca --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldRepository.java @@ -0,0 +1,182 @@ +package mineplex.game.clans.fields.repository; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.database.RepositoryBase; +import mineplex.core.database.ResultSetCallable; +import mineplex.core.database.column.ColumnByte; +import mineplex.core.database.column.ColumnDouble; +import mineplex.core.database.column.ColumnInt; +import mineplex.core.database.column.ColumnVarChar; + +public class FieldRepository extends RepositoryBase +{ + private static String CREATE_FIELD_BLOCK_TABLE = "CREATE TABLE IF NOT EXISTS fieldBlock (id INT NOT NULL AUTO_INCREMENT, server VARCHAR(100), location VARCHAR(100), blockId INT, blockData TINYINT, emptyId INT, emptyData TINYINT, stockMax INT, stockRegenTime DOUBLE, loot VARCHAR(100) PRIMARY KEY (id), INDEX serverLocation (server, location));"; + private static String CREATE_FIELD_ORE_TABLE = "CREATE TABLE IF NOT EXISTS fieldOre (id INT NOT NULL AUTO_INCREMENT, server VARCHAR(100), location VARCHAR(100), PRIMARY KEY (id), INDEX serverLocation (server, location));"; + private static String CREATE_FIELD_MONSTER_TABLE = "CREATE TABLE IF NOT EXISTS fieldMonster (id INT NOT NULL AUTO_INCREMENT, server VARCHAR(100), name VARCHAR(100), type VARCHAR(100), mobMax INT, mobRate DOUBLE, center VARCHAR(100), radius INT, height INT PRIMARY KEY (id), INDEX serverName (server, name));"; + private static String RETRIEVE_FIELD_BLOCKS = "SELECT server, location, blockId, blockData, emptyId, emptyData, stockMax, stockRegen, loot FROM fieldBlock WHERE server = ?;"; + private static String ADD_FIELD_BLOCK = "INSERT INTO fieldBlock (server, location, blockId, blockData, emptyId, emptyData, stockMax, stockRegen, loot) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);"; + private static String DEL_FIELD_BLOCK = "DELETE FROM fieldBlock WHERE server = ? AND location = ?;"; + private static String RETRIEVE_FIELD_ORES = "SELECT server, location FROM fieldOre WHERE server = ?;"; + private static String ADD_FIELD_ORE = "INSERT INTO fieldBlock (server, location) VALUES (?, ?);"; + private static String DEL_FIELD_ORE = "DELETE FROM fieldOre WHERE server = ? AND location = ?;"; + private static String RETRIEVE_FIELD_MONSTERS = "SELECT server, name, type, mobMax, mobRate, center, radius, height FROM fieldMonster WHERE server = ?;"; + private static String ADD_FIELD_MONSTER = "INSERT INTO fieldBlock (server, name, type, mobMax, mobRate, center, radius, height) VALUES (?, ?, ?, ?, ?, ?, ?, ?);"; + private static String DEL_FIELD_MONSTER = "DELETE FROM fieldBlock WHERE server = ? AND name = ?;"; + + public FieldRepository(JavaPlugin plugin) + { + super(plugin, "jdbc:mysql://db.mineplex.com:3306/Account?autoReconnect=true&failOverReadOnly=false&maxReconnects=10", "root", "tAbechAk3wR7tuTh"); + } + + public List getFieldBlocks(String server) + { + final List fieldBlocks = new ArrayList(); + + this.executeQuery(RETRIEVE_FIELD_BLOCKS, new ResultSetCallable() + { + @Override + public void processResultSet(ResultSet resultSet) throws SQLException + { + while (resultSet.next()) + { + FieldBlockToken token = new FieldBlockToken(); + token.Server = resultSet.getString(1); + token.Location = resultSet.getString(2); + token.BlockId = resultSet.getInt(3); + token.BlockData = resultSet.getByte(4); + token.EmptyId = resultSet.getInt(5); + token.EmptyData = resultSet.getByte(6); + token.StockMax = resultSet.getInt(7); + token.StockRegenTime = resultSet.getLong(8); + token.Loot = resultSet.getString(9); + + fieldBlocks.add(token); + } + } + }, new ColumnVarChar("server", 100, server)); + + return fieldBlocks; + } + + public void addFieldBlock(FieldBlockToken token) + { + executeUpdate(ADD_FIELD_BLOCK, + new ColumnVarChar("server", 100, token.Server), + new ColumnVarChar("location", 100, token.Location), + new ColumnInt("blockId", token.BlockId), + new ColumnByte("blockData", token.BlockData), + new ColumnInt("emptyId", token.EmptyId), + new ColumnByte("emptyData", token.EmptyData), + new ColumnInt("stockMax", token.StockMax), + new ColumnDouble("stockRegen", token.StockRegenTime), + new ColumnVarChar("loot", 100, token.Loot) + ); + } + + public void deleteFieldBlock(String server, String location) + { + executeUpdate(DEL_FIELD_BLOCK, new ColumnVarChar("server", 100, server), new ColumnVarChar("location", 100, location)); + } + + public List getFieldOres(String server) + { + final List fieldOres = new ArrayList(); + + this.executeQuery(RETRIEVE_FIELD_ORES, new ResultSetCallable() + { + @Override + public void processResultSet(ResultSet resultSet) throws SQLException + { + while (resultSet.next()) + { + FieldOreToken token = new FieldOreToken(); + token.Server = resultSet.getString(1); + token.Location = resultSet.getString(2); + + fieldOres.add(token); + } + } + }, new ColumnVarChar("server", 100, server)); + + return fieldOres; + } + + public void addFieldOre(FieldOreToken token) + { + executeUpdate(ADD_FIELD_ORE, + new ColumnVarChar("server", 100, token.Server), + new ColumnVarChar("location", 100, token.Location) + ); + } + + public void deleteFieldOre(String server, String location) + { + executeUpdate(DEL_FIELD_ORE, new ColumnVarChar("server", 100, server), new ColumnVarChar("location", 100, location)); + } + + public List getFieldMonsters(String server) + { + List fieldMonsters = new ArrayList(); + + this.executeQuery(RETRIEVE_FIELD_MONSTERS, new ResultSetCallable() + { + @Override + public void processResultSet(ResultSet resultSet) throws SQLException + { + while (resultSet.next()) + { + FieldMonsterToken token = new FieldMonsterToken(); + token.Name = resultSet.getString(1); + token.Server = resultSet.getString(2); + token.Type = resultSet.getString(3); + token.MobMax = resultSet.getInt(4); + token.MobRate = resultSet.getDouble(5); + token.Centre = resultSet.getString(6); + token.Radius = resultSet.getInt(7); + token.Height = resultSet.getInt(8); + } + } + }, new ColumnVarChar("server", 100, server)); + + return fieldMonsters; + } + + public void addFieldMonster(FieldMonsterToken token) + { + executeUpdate(ADD_FIELD_MONSTER, + new ColumnVarChar("server", 100, token.Server), + new ColumnVarChar("name", 100, token.Name), + new ColumnVarChar("blockId", 100, token.Type), + new ColumnInt("mobMax", token.MobMax), + new ColumnDouble("mobRate", token.MobRate), + new ColumnVarChar("center", 100, token.Centre), + new ColumnInt("redius", token.Radius), + new ColumnInt("height", token.Height) + ); + } + + public void deleteFieldMonster(String server, String name) + { + executeUpdate(DEL_FIELD_MONSTER, new ColumnVarChar("server", 100, server), new ColumnVarChar("name", 100, name)); + } + + @Override + protected void initialize() + { + executeUpdate(CREATE_FIELD_BLOCK_TABLE); + executeUpdate(CREATE_FIELD_ORE_TABLE); + executeUpdate(CREATE_FIELD_MONSTER_TABLE); + } + + @Override + protected void update() + { + } + +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index e149227b0..1968f68c8 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -183,7 +183,7 @@ public class HubManager extends MiniClientPlugin _visibilityManager = new VisibilityManager(this); _forcefieldManager = new ForcefieldManager(this); - AddCommand(new ForcefieldRadius(_forcefieldManager)); + addCommand(new ForcefieldRadius(_forcefieldManager)); _statsManager = new StatsManager(plugin); _achievementManager = new AchievementManager(_statsManager, _clientManager, _donationManager); @@ -329,9 +329,9 @@ public class HubManager extends MiniClientPlugin @Override public void AddCommands() { - AddCommand(new GadgetToggle(this)); - AddCommand(new NewsCommand(this)); - AddCommand(new GameModeCommand(this)); + addCommand(new GadgetToggle(this)); + addCommand(new NewsCommand(this)); + addCommand(new GameModeCommand(this)); } @EventHandler(priority = EventPriority.HIGHEST) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsAddCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsAddCommand.java index 455218794..79a1c8de2 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsAddCommand.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsAddCommand.java @@ -23,7 +23,7 @@ public class NewsAddCommand extends CommandBase { if (args == null || args.length == 0 || args.length > 128) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!")); return; } else @@ -40,7 +40,7 @@ public class NewsAddCommand extends CommandBase // Check for 256 character length for MySQL! if (newsEntry.length() > 256) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "The specified news entry is too long [> 256 characters]!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "The specified news entry is too long [> 256 characters]!")); return; } @@ -57,11 +57,11 @@ public class NewsAddCommand extends CommandBase } newsEntry = newsEntry.substring(0, newsEntry.length() - 1); - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cGray + "The news entry: " + C.cGold + newsEntry + C.cGray + " has been added to the database!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cGray + "The news entry: " + C.cGold + newsEntry + C.cGray + " has been added to the database!")); } else { - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "There was an error adding the news entry to the database!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "There was an error adding the news entry to the database!")); } } }); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsConfirmCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsConfirmCommand.java index 337da8a8c..42dbe5159 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsConfirmCommand.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsConfirmCommand.java @@ -22,7 +22,7 @@ public class NewsConfirmCommand extends CommandBase { if (args == null || args.length == 0 || args.length > 1) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!")); return; } else @@ -34,11 +34,11 @@ public class NewsConfirmCommand extends CommandBase } catch (Exception exception) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "The specified news position is invalid!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "The specified news position is invalid!")); return; } - UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "tellraw " + caller.getName() + " {\"text\":\"" + Plugin.GetName() + "> \", color:blue, \"extra\":[{\"text\":\"[CONFIRM] \", color:green, \"clickEvent\":{\"action\":\"run_command\",\"value\":\"/news delete " + newsPosition + "\"}, \"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Are you absolutely sure???\"}}, {\"text\":\"News Entry " + newsPosition + "\", color:gold}, {\"text\":\" deletion?\", color:gray}]}"); + UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "tellraw " + caller.getName() + " {\"text\":\"" + Plugin.getName() + "> \", color:blue, \"extra\":[{\"text\":\"[CONFIRM] \", color:green, \"clickEvent\":{\"action\":\"run_command\",\"value\":\"/news delete " + newsPosition + "\"}, \"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Are you absolutely sure???\"}}, {\"text\":\"News Entry " + newsPosition + "\", color:gold}, {\"text\":\" deletion?\", color:gray}]}"); return; } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsDeleteCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsDeleteCommand.java index 039de916f..0c5e600ed 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsDeleteCommand.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsDeleteCommand.java @@ -23,7 +23,7 @@ public class NewsDeleteCommand extends CommandBase { if (args == null || args.length == 0 || args.length > 1) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!")); return; } else @@ -36,7 +36,7 @@ public class NewsDeleteCommand extends CommandBase } catch (Exception exception) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "The specified news position is invalid!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "The specified news position is invalid!")); return; } newsMang.DeleteNewsEntry(newsPosition, new Callback() @@ -45,11 +45,11 @@ public class NewsDeleteCommand extends CommandBase { if (success) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cGray + "The news entry at position " + C.cGold + newsPosition + C.cGray + " has been deleted!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cGray + "The news entry at position " + C.cGold + newsPosition + C.cGray + " has been deleted!")); } else { - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "There was an error deleting the news entry; likely the specified news position was invalid!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "There was an error deleting the news entry; likely the specified news position was invalid!")); } } }); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsListCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsListCommand.java index cc53857ab..e3ca7c240 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsListCommand.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsListCommand.java @@ -29,7 +29,7 @@ public class NewsListCommand extends CommandBase { final NewsManager newsMang = Plugin.GetNewsManager(); - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cGray + "Current server news messages:")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cGray + "Current server news messages:")); newsMang.RetriveNewsEntries(new Callback>() { @@ -49,7 +49,7 @@ public class NewsListCommand extends CommandBase for (int i = 0; i < newsStrings.length; i++) { - UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "tellraw " + caller.getName() + " {\"text\":\"" + Plugin.GetName() + "> \", color:blue, \"extra\":[{\"text\":\"[DELETE] \", color:red, \"clickEvent\":{\"action\":\"run_command\",\"value\":\"/news ¢¤₦₣¡₨₥ " + (i + 1) + "\"}, \"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Deletes News Entry " + (i + 1) + " : " + newsStrings[i] + "\"}}, {\"text\":\"News " + (i + 1) + "\", color:gold}, {\"text\":\" : \", color:gray}, {\"text\":\"" + newsStrings[i] + "\", color:white}]}"); + UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "tellraw " + caller.getName() + " {\"text\":\"" + Plugin.getName() + "> \", color:blue, \"extra\":[{\"text\":\"[DELETE] \", color:red, \"clickEvent\":{\"action\":\"run_command\",\"value\":\"/news ¢¤₦₣¡₨₥ " + (i + 1) + "\"}, \"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Deletes News Entry " + (i + 1) + " : " + newsStrings[i] + "\"}}, {\"text\":\"News " + (i + 1) + "\", color:gold}, {\"text\":\" : \", color:gray}, {\"text\":\"" + newsStrings[i] + "\", color:white}]}"); } } }); @@ -59,7 +59,7 @@ public class NewsListCommand extends CommandBase } else { - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!")); return; } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsSetCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsSetCommand.java index ea34f8cd5..d91e346f8 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsSetCommand.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsSetCommand.java @@ -23,7 +23,7 @@ public class NewsSetCommand extends CommandBase { if (args == null || args.length < 2 || args.length > 128) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!")); return; } else @@ -41,7 +41,7 @@ public class NewsSetCommand extends CommandBase // Check for 256 character length for MySQL! if (newsEntry.length() > 256) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "The specified news entry is too long [> 256 characters]!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "The specified news entry is too long [> 256 characters]!")); return; } @@ -51,7 +51,7 @@ public class NewsSetCommand extends CommandBase } catch (Exception exception) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "The specified news position is invalid!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "The specified news position is invalid!")); return; } newsMang.SetNewsEntry(newsEntry, newsPosition, new Callback() @@ -67,11 +67,11 @@ public class NewsSetCommand extends CommandBase } newsEntry = newsEntry.substring(0, newsEntry.length() - 1); - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cGray + "The news entry at position " + C.cGold + newsPosition + C.cGray + " has been updated to: " + C.cGold + newsEntry + C.cGray + "!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cGray + "The news entry at position " + C.cGold + newsPosition + C.cGray + " has been updated to: " + C.cGold + newsEntry + C.cGray + "!")); } else { - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "There was an error updating the news entry; likely the specified news position was invalid!")); + UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "There was an error updating the news entry; likely the specified news position was invalid!")); } } }); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/AdminMountManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/AdminMountManager.java index 0cac2bf42..1917dbb95 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/AdminMountManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/AdminMountManager.java @@ -39,7 +39,7 @@ public class AdminMountManager extends MiniPlugin @Override public void AddCommands() { - AddCommand(new HorseSpawn(this)); + addCommand(new HorseSpawn(this)); } @EventHandler diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/party/PartyManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/party/PartyManager.java index eeaeed546..2b4e0ec0d 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/party/PartyManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/party/PartyManager.java @@ -36,7 +36,7 @@ public class PartyManager extends MiniPlugin @Override public void AddCommands() { - AddCommand(new PartyCommand(this)); + addCommand(new PartyCommand(this)); } public CoreClientManager GetClients() diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java index 6aaa8c18e..a52e8b6f7 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java @@ -220,6 +220,6 @@ public class PollManager extends MiniClientPlugin @Override public void AddCommands() { - AddCommand(new PollCommand(this)); + addCommand(new PollCommand(this)); } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index efa24c2d7..005ada843 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -539,33 +539,33 @@ public class ServerManager extends MiniPlugin public void ListServerNpcs(Player caller) { - UtilPlayer.message(caller, F.main(GetName(), "Listing Server Npcs:")); + UtilPlayer.message(caller, F.main(getName(), "Listing Server Npcs:")); for (String serverNpc : _serverKeyInfoMap.keySet()) { - UtilPlayer.message(caller, F.main(GetName(), C.cYellow + serverNpc)); + UtilPlayer.message(caller, F.main(getName(), C.cYellow + serverNpc)); } } public void ListServers(Player caller, String serverNpcName) { - UtilPlayer.message(caller, F.main(GetName(), "Listing Servers for '" + serverNpcName + "':")); + UtilPlayer.message(caller, F.main(getName(), "Listing Servers for '" + serverNpcName + "':")); for (ServerInfo serverNpc : _serverKeyInfoMap.get(serverNpcName)) { - UtilPlayer.message(caller, F.main(GetName(), C.cYellow + serverNpc.Name + C.cWhite + " - " + serverNpc.MOTD + " " + serverNpc.CurrentPlayers + "/" + serverNpc.MaxPlayers)); + UtilPlayer.message(caller, F.main(getName(), C.cYellow + serverNpc.Name + C.cWhite + " - " + serverNpc.MOTD + " " + serverNpc.CurrentPlayers + "/" + serverNpc.MaxPlayers)); } } public void ListOfflineServers(Player caller) { - UtilPlayer.message(caller, F.main(GetName(), "Listing Offline Servers:")); + UtilPlayer.message(caller, F.main(getName(), "Listing Offline Servers:")); for (ServerInfo serverNpc : _serverInfoMap.values()) { if (serverNpc.MOTD.equalsIgnoreCase(ChatColor.DARK_RED + "OFFLINE")) { - UtilPlayer.message(caller, F.main(GetName(), C.cYellow + serverNpc.Name + C.cWhite + " - " + F.time(UtilTime.convertString(System.currentTimeMillis() - _serverUpdate.get(serverNpc.Name), 0, TimeUnit.FIT)))); + UtilPlayer.message(caller, F.main(getName(), C.cYellow + serverNpc.Name + C.cWhite + " - " + F.time(UtilTime.convertString(System.currentTimeMillis() - _serverUpdate.get(serverNpc.Name), 0, TimeUnit.FIT)))); } } } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java index ef5fd3b0e..d8492b753 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java @@ -580,6 +580,6 @@ public class CombatManager extends MiniPlugin } } - player.sendMessage(F.main(GetName(), nameBuilder.toString())); + player.sendMessage(F.main(getName(), nameBuilder.toString())); } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java index 01541b259..8df18e496 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java @@ -56,7 +56,7 @@ public class StaffServer extends JavaPlugin new FileUpdater(this, portal); new CustomerSupport(this, clientManager, donationManager, new SalesPackageManager(this, clientManager, donationManager, new InventoryManager(this), new StatsManager(this))); - new Password(this); + new Password(this, serverStatusManager.getCurrentServerName()); //Updates getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 0ed25b7e4..b57adc03b 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -77,12 +77,12 @@ public class CustomerSupport extends MiniPlugin @Override public void AddCommands() { - AddCommand(new checkCommand(this)); + addCommand(new checkCommand(this)); } public void Help(Player caller) { - caller.sendMessage(F.main(GetName(), "Usage : /check defek7")); + caller.sendMessage(F.main(getName(), "Usage : /check defek7")); } public void addAgentMapping(Player caller, String playerName) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/CreatePasswordCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/CreatePasswordCommand.java new file mode 100644 index 000000000..19f3086ad --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/CreatePasswordCommand.java @@ -0,0 +1,24 @@ +package mineplex.staffServer.password; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; + +public class CreatePasswordCommand extends CommandBase +{ + public CreatePasswordCommand(Password plugin) + { + super(plugin, Rank.ADMIN, "createpassword"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args != null && args.length == 1) + { + resetCommandCharge(caller); + Plugin.createPassword(caller, args[0]); + } + } +} diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/Password.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/Password.java index 8836fdb8f..db26f98bb 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/Password.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/Password.java @@ -9,30 +9,41 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; import mineplex.core.common.util.F; -import mineplex.core.recharge.Recharge; public class Password extends MiniPlugin { + private PasswordRepository _repository; private HashSet _accepted = new HashSet(); - private String _password = "ClothStarRust"; + private String _serverName; + private String _password = null; - public Password(JavaPlugin plugin) + public Password(JavaPlugin plugin, String serverName) { super("Password", plugin); + + _serverName = serverName; + + _repository = new PasswordRepository(plugin, serverName); + _password = _repository.retrievePassword(); } @Override public void AddCommands() { - AddCommand(new PasswordCommand(this)); - AddCommand(new ChangePasswordCommand(this)); + addCommand(new PasswordCommand(this)); + addCommand(new ChangePasswordCommand(this)); + addCommand(new RemovePasswordCommand(this)); + addCommand(new CreatePasswordCommand(this)); } @EventHandler public void promptForPassword(final PlayerJoinEvent event) { - event.getPlayer().sendMessage(F.main(GetName(), "Please enter the server password within 10 seconds.")); + if (_password == null) + return; + + event.getPlayer().sendMessage(F.main(getName(), "Please enter the server password within 10 seconds.")); GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable() { @@ -46,16 +57,56 @@ public class Password extends MiniPlugin public void checkPassword(Player caller, String attempt) { + if (_password == null) + return; + if (attempt.equals(_password)) { _accepted.add(caller); - caller.sendMessage(F.main(GetName(), "I guess you get to stay.")); + caller.sendMessage(F.main(getName(), "That is correct, enjoy your time here...and GET TO WORK ;)")); } } public void changePassword(Player caller, String password) { _password = password; - caller.sendMessage(F.main(GetName(), "Password changed to " + _password)); + + runAsync(new Runnable() + { + public void run() + { + _repository.updatePassword(_password); + } + }); + + caller.sendMessage(F.main(getName(), "Password changed to " + _password)); + } + + public void removePassword(Player caller) + { + runAsync(new Runnable() + { + public void run() + { + _password = null; + _repository.removePassword(); + } + }); + caller.sendMessage(F.main(getName(), "Password removed for " + _serverName)); + } + + public void createPassword(Player caller, String password) + { + _password = password; + + runAsync(new Runnable() + { + public void run() + { + _repository.createPassword(_password); + } + }); + + caller.sendMessage(F.main(getName(), "Password created : " + _password)); } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordCommand.java index 908e15d48..f24d88d40 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordCommand.java @@ -9,7 +9,7 @@ public class PasswordCommand extends CommandBase { public PasswordCommand(Password plugin) { - super(plugin, Rank.MODERATOR, "password"); + super(plugin, Rank.MODERATOR, "pass", "password"); } @Override diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordRepository.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordRepository.java new file mode 100644 index 000000000..796bde45d --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordRepository.java @@ -0,0 +1,76 @@ +package mineplex.staffServer.password; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.database.RepositoryBase; +import mineplex.core.database.ResultSetCallable; +import mineplex.core.database.column.ColumnVarChar; + +public class PasswordRepository extends RepositoryBase +{ + private static String CREATE_SERVER_PASSWORD_TABLE = "CREATE TABLE IF NOT EXISTS serverPassword (id INT NOT NULL AUTO_INCREMENT, server VARCHAR(100), password VARCHAR(100), PRIMARY KEY (id));"; + private static String RETRIEVE_SERVER_PASSWORD = "SELECT password FROM serverPassword WHERE server = ?;"; + private static String CREATE_SERVER_PASSWORD = "INSERT INTO serverPassword (server, password) VALUES(?, ?);"; + private static String UPDATE_SERVER_PASSWORD = "UPDATE serverPassword SET password = ? WHERE server = ?;"; + private static String REMOVE_SERVER_PASSWORD = "DELETE FROM serverPassword WHERE server = ?;"; + + private String _serverName; + + public PasswordRepository(JavaPlugin plugin, String serverName) + { + super(plugin, "jdbc:mysql://db.mineplex.com:3306/Account?autoReconnect=true&failOverReadOnly=false&maxReconnects=10", "root", "tAbechAk3wR7tuTh"); + + _serverName = serverName; + } + + @Override + protected void initialize() + { + executeUpdate(CREATE_SERVER_PASSWORD_TABLE); + } + + @Override + protected void update() + { + } + + public String retrievePassword() + { + final List passwords = new ArrayList(); + + executeQuery(RETRIEVE_SERVER_PASSWORD, new ResultSetCallable() + { + @Override + public void processResultSet(ResultSet resultSet) throws SQLException + { + while (resultSet.next()) + { + passwords.add(resultSet.getString(1)); + } + } + + }, new ColumnVarChar("serverName", 100, _serverName)); + + return passwords.size() > 0 ? passwords.get(0) : null; + } + + public void updatePassword(String password) + { + executeUpdate(UPDATE_SERVER_PASSWORD, new ColumnVarChar("password", 100, password), new ColumnVarChar("serverName", 100, _serverName)); + } + + public void removePassword() + { + executeUpdate(REMOVE_SERVER_PASSWORD, new ColumnVarChar("serverName", 100, _serverName)); + } + + public void createPassword(String password) + { + executeUpdate(CREATE_SERVER_PASSWORD, new ColumnVarChar("serverName", 100, _serverName), new ColumnVarChar("password", 100, password)); + } +} diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/RemovePasswordCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/RemovePasswordCommand.java new file mode 100644 index 000000000..029489189 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/RemovePasswordCommand.java @@ -0,0 +1,21 @@ +package mineplex.staffServer.password; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; + +public class RemovePasswordCommand extends CommandBase +{ + public RemovePasswordCommand(Password plugin) + { + super(plugin, Rank.ADMIN, "removepassword"); + } + + @Override + public void Execute(Player caller, String[] args) + { + resetCommandCharge(caller); + Plugin.removePassword(caller); + } +} diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java index 2efc6a980..973ff09cf 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -12,6 +12,7 @@ import mineplex.core.inventory.InventoryManager; import mineplex.core.stats.StatsManager; import mineplex.staffServer.salespackage.command.DisplayPackageCommand; import mineplex.staffServer.salespackage.command.Sales; +import mineplex.staffServer.salespackage.salespackages.ApplyKits; import mineplex.staffServer.salespackage.salespackages.Coins; import mineplex.staffServer.salespackage.salespackages.GemHunter; import mineplex.staffServer.salespackage.salespackages.LifetimeHero; @@ -47,6 +48,7 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new LifetimeHero(this)); AddSalesPackage(new GemHunter(this, 4)); AddSalesPackage(new GemHunter(this, 8)); + AddSalesPackage(new ApplyKits(this)); } private void AddSalesPackage(SalesPackageBase salesPackage) @@ -57,8 +59,8 @@ public class SalesPackageManager extends MiniPlugin @Override public void AddCommands() { - AddCommand(new DisplayPackageCommand(this)); - AddCommand(new Sales(this)); + addCommand(new DisplayPackageCommand(this)); + addCommand(new Sales(this)); } public DonationManager getDonationManager() diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/BoosterCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/BoosterCommand.java index 492f78307..aaeee75a9 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/BoosterCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/BoosterCommand.java @@ -30,6 +30,6 @@ public class BoosterCommand extends CommandBase Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Gem Booster " + amount, false, 0, false); Plugin.getInventoryManager().addItemToInventoryForOffline(uuid.toString(), "Utility", "Gem Booster", amount); - caller.sendMessage(F.main(Plugin.GetName(), "Added " + amount + " boosters to " + playerName + "'s account!")); + caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " boosters to " + playerName + "'s account!")); } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java index 117db806c..8367ce2ae 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java @@ -29,6 +29,6 @@ public class CoinCommand extends CommandBase UUID uuid = UUIDFetcher.getUUIDOf(playerName); Plugin.getDonationManager().RewardCoins(null, caller.getName(), playerName, uuid, amount); - caller.sendMessage(F.main(Plugin.GetName(), "Added " + amount + " coins to " + playerName + "'s account!")); + caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " coins to " + playerName + "'s account!")); } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/GemHunterCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/GemHunterCommand.java index 00a277c64..76f257b67 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/GemHunterCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/GemHunterCommand.java @@ -35,6 +35,6 @@ public class GemHunterCommand extends CommandBase Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Gem Hunter Level " + amount, false, 0, false); Plugin.getStatsManager().incrementStat(uuid.toString(), "Global.GemsEarned", experience); - caller.sendMessage(F.main(Plugin.GetName(), "Added Level " + amount + " Gem Hunter to " + playerName + "'s account!")); + caller.sendMessage(F.main(Plugin.getName(), "Added Level " + amount + " Gem Hunter to " + playerName + "'s account!")); } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/KitsCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/KitsCommand.java new file mode 100644 index 000000000..e6f771976 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/KitsCommand.java @@ -0,0 +1,28 @@ +package mineplex.staffServer.salespackage.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.staffServer.salespackage.SalesPackageManager; + +public class KitsCommand extends CommandBase +{ + public KitsCommand(SalesPackageManager plugin) + { + super(plugin, Rank.MODERATOR, "kits"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args == null || args.length != 1) + return; + + String playerName = args[0]; + + Plugin.getDonationManager().applyKits(playerName); + caller.sendMessage(F.main(Plugin.getName(), "Unlocked kits for " + playerName + "'s account!")); + } +} diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/RankCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/RankCommand.java index 70afd046b..bd155a57f 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/RankCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/RankCommand.java @@ -29,7 +29,7 @@ public class RankCommand extends CommandBase if (rankEnum == Rank.HERO || rankEnum == Rank.ULTRA) { Plugin.getClientManager().SaveRank(playerName, mineplex.core.common.Rank.valueOf(rank), perm); - caller.sendMessage(F.main(Plugin.GetName(), playerName + "'s rank has been updated to " + rank + "!")); + caller.sendMessage(F.main(Plugin.getName(), playerName + "'s rank has been updated to " + rank + "!")); } } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java index 47bb4faf3..8d6a4be3a 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java @@ -22,6 +22,7 @@ public class Sales extends MultiCommandBase AddCommand(new HeroCommand(plugin)); AddCommand(new LifetimeUltraCommand(plugin)); AddCommand(new LifetimeHeroCommand(plugin)); + AddCommand(new KitsCommand(plugin)); } @Override diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/TreasureChestCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/TreasureChestCommand.java index 939544ead..8f49792ae 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/TreasureChestCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/TreasureChestCommand.java @@ -30,6 +30,6 @@ public class TreasureChestCommand extends CommandBase Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Treasure Chest " + amount, false, 0, false); Plugin.getInventoryManager().addItemToInventoryForOffline(uuid.toString(), "Utility", "Treasure Chest", amount); - caller.sendMessage(F.main(Plugin.GetName(), "Added " + amount + " treasure chests to " + playerName + "'s account!")); + caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " treasure chests to " + playerName + "'s account!")); } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/TreasureKeyCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/TreasureKeyCommand.java index bbd479bd1..077b4fc28 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/TreasureKeyCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/TreasureKeyCommand.java @@ -30,6 +30,6 @@ public class TreasureKeyCommand extends CommandBase Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Treasure Key " + amount, false, 0, false); Plugin.getInventoryManager().addItemToInventoryForOffline(uuid.toString(), "Treasure", "Treasure Key", amount); - caller.sendMessage(F.main(Plugin.GetName(), "Added " + amount + " treasure Keys to " + playerName + "'s account!")); + caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " treasure Keys to " + playerName + "'s account!")); } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/ApplyKits.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/ApplyKits.java new file mode 100644 index 000000000..7591036b6 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/ApplyKits.java @@ -0,0 +1,20 @@ +package mineplex.staffServer.salespackage.salespackages; + +import mineplex.staffServer.salespackage.SalesPackageManager; + +import org.bukkit.entity.Player; + +public class ApplyKits extends SalesPackageBase +{ + public ApplyKits(SalesPackageManager manager) + { + super(manager, "Apply Kits"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales kits " + playerName, "Apply Kit Unlocks."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} 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 a052d4d6e..add6d903a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -278,9 +278,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation @Override public void AddCommands() { - AddCommand(new GameCommand(this)); - AddCommand(new WriteCommand(this)); - AddCommand(new YoutubeCommand(this)); + addCommand(new GameCommand(this)); + addCommand(new WriteCommand(this)); + addCommand(new YoutubeCommand(this)); } public GameServerConfig GetServerConfig() diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/Field.java b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/Field.java deleted file mode 100644 index 8a1fb481c..000000000 --- a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/Field.java +++ /dev/null @@ -1,69 +0,0 @@ -package me.chiss.Core.Field; - - -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -import me.chiss.Core.Module.AModule; -import mineplex.core.server.IRepository; - -public class Field extends AModule -{ - private FieldBlock _block; - private FieldOre _ore; - private FieldMonster _mob; - - public Field(JavaPlugin plugin, IRepository repository, String serverName) - { - super("Field Factory", plugin, repository); - - _block = new FieldBlock(plugin, repository, serverName); - _ore = new FieldOre(plugin, repository, serverName); - _mob = new FieldMonster(plugin, repository, serverName); - } - - @Override - public void enable() - { - - } - - @Override - public void disable() - { - - } - - @Override - public void config() - { - - } - - @Override - public void commands() - { - - } - - @Override - public void command(Player caller, String cmd, String[] args) - { - - } - - public FieldBlock GetBlock() - { - return _block; - } - - public FieldOre GetOre() - { - return _ore; - } - - public FieldMonster GetMonster() - { - return _mob; - } -} diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldMonster.java b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldMonster.java deleted file mode 100644 index 9f9dc5886..000000000 --- a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/FieldMonster.java +++ /dev/null @@ -1,332 +0,0 @@ -package me.chiss.Core.Field; - -import java.util.HashSet; -import java.util.WeakHashMap; - -import nautilus.minecraft.core.webserver.token.Server.FieldMonsterToken; - -import org.bukkit.Location; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.HandlerList; -import org.bukkit.plugin.java.JavaPlugin; - -import mineplex.core.server.IRepository; -import mineplex.core.common.Rank; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilWorld; -import me.chiss.Core.Field.Monsters.FieldMonsterBase; -import me.chiss.Core.Module.AModule; - -public class FieldMonster extends AModule -{ - private HashSet _pits; - private String _serverName; - - private WeakHashMap _input = new WeakHashMap(); - - public FieldMonster(JavaPlugin plugin, IRepository repository, String serverName) - { - super("Field Monster", plugin, repository); - - _pits = new HashSet(); - _serverName = serverName; - - Load(); - } - - @Override - public void enable() - { - - } - - @Override - public void disable() - { - Clean(); - } - - @Override - public void config() - { - - } - - @Override - public void commands() - { - AddCommand("fm"); - } - - @Override - public void command(Player caller, String cmd, String[] args) - { - if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true)) - return; - - if (!_input.containsKey(caller)) - _input.put(caller, new FieldMonsterInput()); - - FieldMonsterInput input = _input.get(caller); - - if (args.length == 0) - { - _input.get(caller).Display(caller); - UtilPlayer.message(caller, F.main(_moduleName, "Type " + F.elem("/fm help") + " for commands.")); - } - - else if (args[0].equalsIgnoreCase("help")) - { - Help(caller); - } - - else if (args[0].equalsIgnoreCase("type")) - { - try - { - input.type = UtilEnt.searchEntity(caller, args[1], true); - if (input.type != null) - input.Display(caller); - } - catch (Exception e) - { - UtilPlayer.message(caller, F.main(_moduleName, "Invalid Monster Type.")); - } - } - - else if (args[0].equalsIgnoreCase("max")) - { - try - { - int value = Integer.parseInt(args[1]); - if (value < 1) value = 1; - input.mobMax = value; - input.Display(caller); - } - catch (Exception e) - { - UtilPlayer.message(caller, F.main(_moduleName, "Invalid Monster Max.")); - } - } - - else if (args[0].equalsIgnoreCase("rate")) - { - try - { - double value = Double.parseDouble(args[1]); - if (value < 0) value = 0; - input.mobRate = value; - input.Display(caller); - } - catch (Exception e) - { - UtilPlayer.message(caller, F.main(_moduleName, "Invalid Monster Rate.")); - } - } - - else if (args[0].equalsIgnoreCase("radius")) - { - try - { - int integer = Integer.parseInt(args[1]); - if (integer < 1) integer = 1; - input.radius = integer; - input.Display(caller); - } - catch (Exception e) - { - UtilPlayer.message(caller, F.main(_moduleName, "Invalid Area Radius.")); - } - } - - else if (args[0].equalsIgnoreCase("height")) - { - try - { - int integer = Integer.parseInt(args[1]); - if (integer < 1) integer = 1; - input.height = integer; - input.Display(caller); - } - catch (Exception e) - { - UtilPlayer.message(caller, F.main(_moduleName, "Invalid Area Height.")); - } - } - - else if (args[0].equalsIgnoreCase("create")) - { - if (args.length < 2) - { - UtilPlayer.message(caller, F.main(_moduleName, "Missing Monster Field Name.")); - } - else - { - Create(caller, args[1]); - } - } - - else if (args[0].equalsIgnoreCase("delete")) - { - if (args.length < 2) - { - UtilPlayer.message(caller, F.main(_moduleName, "Missing Monster Field Name.")); - } - else - { - Delete(caller, args[1]); - } - } - - else if (args[0].equalsIgnoreCase("list")) - { - UtilPlayer.message(caller, F.main(_moduleName, "Listing Monster Fields;")); - - for (FieldMonsterBase pit : _pits) - pit.Display(caller); - } - - else if (args[0].equalsIgnoreCase("info")) - { - UtilPlayer.message(caller, F.main(GetName(), "Listing Monster Fields;")); - - for (FieldMonsterBase pit : _pits) - pit.Display(caller); - } - - else if (args[0].equalsIgnoreCase("wipe")) - { - Wipe(caller, true); - } - - else if (args[0].equalsIgnoreCase("kill")) - { - for (FieldMonsterBase pit : _pits) - pit.RemoveMonsters(); - } - - else - { - UtilPlayer.message(caller, F.main(GetName(), "Invalid Command.")); - } - } - - private void Help(Player caller) - { - UtilPlayer.message(caller, F.main(GetName(), "Commands List;")); - UtilPlayer.message(caller, F.help("/fm type ", "Set Monster Type", Rank.ADMIN)); - UtilPlayer.message(caller, F.help("/fm max <#>", "Set Monster Limit", Rank.ADMIN)); - UtilPlayer.message(caller, F.help("/fm rate ", "Set Monster Rate", Rank.ADMIN)); - UtilPlayer.message(caller, F.help("/fm radius <#>", "Set Area Radius", Rank.ADMIN)); - UtilPlayer.message(caller, F.help("/fm height <#>", "Set Area Height", Rank.ADMIN)); - UtilPlayer.message(caller, F.help("/fm create ", "Create at your Location", Rank.ADMIN)); - UtilPlayer.message(caller, F.help("/fm delete ", "Delete Field", Rank.ADMIN)); - UtilPlayer.message(caller, F.help("/fm list", "List Monster Fields", Rank.ADMIN)); - UtilPlayer.message(caller, F.help("/fm info ", "Display Monster Field", Rank.ADMIN)); - UtilPlayer.message(caller, F.help("/fm kill", "Kills all Field Monsters", Rank.ADMIN)); - UtilPlayer.message(caller, F.help("/fm wipe", "Delete All Monster Field (Database)", Rank.ADMIN)); - } - - private void Create(Player caller, String name) - { - FieldMonsterInput input = _input.get(caller); - - if (input.type == null) - { - UtilPlayer.message(caller, F.main(GetName(), "You have not set Monster Type.")); - return; - } - - for (FieldMonsterBase pit : _pits) - { - if (name.equalsIgnoreCase(pit.GetName())) - { - UtilPlayer.message(caller, F.main(GetName(), "Monster Field with this name already exists.")); - return; - } - } - - FieldMonsterBase pit = new FieldMonsterBase(this, name, _serverName, input.type, input.mobMax, input.mobRate, caller.getLocation(), input.radius, input.height); - Add(pit, true); - - UtilPlayer.message(caller, F.main(GetName(), "You created Monster Field.")); - pit.Display(caller); - } - - private void Add(FieldMonsterBase pit, boolean repo) - { - UtilServer.getServer().getPluginManager().registerEvents(pit, Plugin()); - _pits.add(pit); - - if (repo) - GetRepository().AddFieldMonster(pit.GetToken()); - } - - private void Delete(Player caller, String name) - { - HashSet remove = new HashSet(); - - for (FieldMonsterBase pit : _pits) - if (pit.GetName().equalsIgnoreCase(name)) - remove.add(pit); - - int i = remove.size(); - - for (FieldMonsterBase pit : remove) - Delete(pit, true); - - UtilPlayer.message(caller, F.main(GetName(), "Deleted " + i + " Monster Field(s).")); - } - - private void Delete(FieldMonsterBase pit, boolean repo) - { - _pits.remove(pit); - pit.RemoveMonsters(); - HandlerList.unregisterAll(pit); - - if (repo) - GetRepository().DeleteFieldMonster(_serverName, pit.GetToken().Name); - } - - private void Wipe(Player player, boolean repo) - { - HashSet remove = new HashSet(); - - for (FieldMonsterBase pit : _pits) - remove.add(pit); - - _pits.clear(); - - for (FieldMonsterBase pit : remove) - Delete(pit, repo); - - UtilPlayer.message(player, F.main(_moduleName, "Field Monsters Wiped.")); - } - - private void Load() - { - Wipe(null, false); - - for (FieldMonsterToken token : GetRepository().GetFieldMonsters(_serverName)) - { - EntityType type = UtilEnt.searchEntity(null, token.Type, false); - if (type == null) continue; - - Location loc = UtilWorld.strToLoc(token.Centre); - if (loc == null) continue; - - FieldMonsterBase pit = new FieldMonsterBase(this, token.Name, _serverName, type, token.MobMax, token.MobRate, loc, token.Radius, token.Height); - Add(pit, false); - } - } - - private void Clean() - { - for (FieldMonsterBase pit : _pits) - pit.RemoveMonsters(); - } -} diff --git a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/repository/FieldRepository.java b/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/repository/FieldRepository.java deleted file mode 100644 index 55722da6b..000000000 --- a/Plugins/Nautilus.Game.PvP/src/me/chiss/Core/Field/repository/FieldRepository.java +++ /dev/null @@ -1,72 +0,0 @@ -package me.chiss.Core.Field.repository; - -public class FieldRepository -{ - public List GetFieldBlocks(String server) - { - return new JsonWebCall(WebServerAddress + "Fields/GetFieldBlocks").Execute(new TypeToken>(){}.getType(), server); - } - - @Override - public void AddFieldBlock(FieldBlockToken token) - { - new AsyncJsonWebCall(WebServerAddress + "Fields/AddFieldBlock").Execute(token); - } - - @Override - public void DeleteFieldBlock(String server, String location) - { - FieldBlockToken token = new FieldBlockToken(); - token.Server = server; - token.Location = location; - - new AsyncJsonWebCall(WebServerAddress + "Fields/DeleteFieldBlock").Execute(token); - } - - //Field Ore - @Override - public List GetFieldOres(String server) - { - return new JsonWebCall(WebServerAddress + "Fields/GetFieldOres").Execute(new TypeToken>(){}.getType(), server); - } - - @Override - public void AddFieldOre(FieldOreToken token) - { - new AsyncJsonWebCall(WebServerAddress + "Fields/AddFieldOre").Execute(token); - } - - @Override - public void DeleteFieldOre(String server, String location) - { - FieldOreToken token = new FieldOreToken(); - token.Server = server; - token.Location = location; - - new AsyncJsonWebCall(WebServerAddress + "Fields/DeleteFieldOre").Execute(token); - } - - //Field Monster - @Override - public List GetFieldMonsters(String server) - { - return new JsonWebCall(WebServerAddress + "Fields/GetFieldMonsters").Execute(new TypeToken>(){}.getType(), server); - } - - @Override - public void AddFieldMonster(FieldMonsterToken token) - { - new AsyncJsonWebCall(WebServerAddress + "Fields/AddFieldMonster").Execute(token); - } - - @Override - public void DeleteFieldMonster(String server, String name) - { - FieldMonsterToken token = new FieldMonsterToken(); - token.Server = server; - token.Name = name; - - new AsyncJsonWebCall(WebServerAddress + "Fields/DeleteFieldMonster").Execute(token); - } - -} diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/BenefitManager.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/BenefitManager.java index b5ecfe685..e7da3c657 100644 --- a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/BenefitManager.java +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/BenefitManager.java @@ -60,7 +60,7 @@ public class BenefitManager extends MiniPlugin for (BenefitItem item : _itemMap.values()) { BenefitItemToken itemToken = new BenefitItemToken(); - itemToken.Name = item.GetName(); + itemToken.Name = item.getName(); itemToken.Material = item.GetDisplayMaterial().toString(); itemToken.SalesPackage = new GameSalesPackageToken(); @@ -78,11 +78,11 @@ public class BenefitManager extends MiniPlugin private void AddBenefitItem(BenefitItem benefitItem, boolean addToOwnerList) { - _itemMap.put(benefitItem.GetName(), benefitItem); + _itemMap.put(benefitItem.getName(), benefitItem); if (addToOwnerList) { - _itemPlayerMap.put(benefitItem.GetName(), new ArrayList()); + _itemPlayerMap.put(benefitItem.getName(), new ArrayList()); } } diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Items/EnergizedPickaxe.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Items/EnergizedPickaxe.java index 42ded9e14..37b1d2a1d 100644 --- a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Items/EnergizedPickaxe.java +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/Items/EnergizedPickaxe.java @@ -47,12 +47,12 @@ public class EnergizedPickaxe extends BenefitItem { Player player = event.getPlayer(); - if (event.getItem() != null && event.getItem().getType() == Material.DIAMOND_PICKAXE && Plugin.PlayerOwnsMe(GetName(), player)) + if (event.getItem() != null && event.getItem().getType() == Material.DIAMOND_PICKAXE && Plugin.PlayerOwnsMe(getName(), player)) { if ((event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) && !_active.contains(player.getName())) { _active.add(player.getName()); - player.sendMessage(F.main(GetName(), GetName() + " activated.")); + player.sendMessage(F.main(getName(), getName() + " activated.")); return; } } @@ -105,10 +105,10 @@ public class EnergizedPickaxe extends BenefitItem if (_active.contains(player.getName())) { - if (!_energy.use(player, Plugin.GetName(), 12, true, false)) + if (!_energy.use(player, Plugin.getName(), 12, true, false)) { _active.remove(player.getName()); - player.sendMessage(F.main(GetName(), GetName() + " deactivated.")); + player.sendMessage(F.main(getName(), getName() + " deactivated.")); event.setCancelled(true); return; } @@ -133,6 +133,6 @@ public class EnergizedPickaxe extends BenefitItem private void Deactivate(Player player) { _active.remove(player.getName()); - player.sendMessage(F.main(GetName(), GetName() + " deactivated.")); + player.sendMessage(F.main(getName(), getName() + " deactivated.")); } } diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/UI/BenefitShopPage.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/UI/BenefitShopPage.java index 6cb92700b..852df53b2 100644 --- a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/UI/BenefitShopPage.java +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Benefit/UI/BenefitShopPage.java @@ -76,7 +76,7 @@ public class BenefitShopPage extends ShopPageBase itemLore.addAll(Arrays.asList(item.GetDescription())); ShopItem shopItem = new ShopItem(item.GetDisplayMaterial(), - (byte) 0, item.GetName(), + (byte) 0, item.getName(), itemLore.toArray(new String[itemLore.size()]), 1, locked, false); diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Gameplay.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Gameplay.java index e46ca4254..6d9daa43a 100644 --- a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Gameplay.java +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/Gameplay.java @@ -692,10 +692,10 @@ public class Gameplay extends AModule if (log.GetKiller() != null) { //Inform - UtilPlayer.message(UtilPlayer.searchExact(log.GetKiller().GetName()), F.main("Death", "You stole " + F.count((lose) + " Coins") + " from " + F.name(player.getName()) + ".")); + UtilPlayer.message(UtilPlayer.searchExact(log.GetKiller().getName()), F.main("Death", "You stole " + F.count((lose) + " Coins") + " from " + F.name(player.getName()) + ".")); //Inform - UtilPlayer.message(player, F.main("Death", "You lost " + F.count((lose) + " Coins") + " to " + F.name(log.GetKiller().GetName()) + ".")); + UtilPlayer.message(player, F.main("Death", "You lost " + F.count((lose) + " Coins") + " to " + F.name(log.GetKiller().getName()) + ".")); } else { diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/ShopManager.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/ShopManager.java index c9fc24ce3..b31a40ae0 100644 --- a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/ShopManager.java +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/ShopManager.java @@ -63,9 +63,9 @@ public class ShopManager extends MiniPlugin @Override public void commands() { - AddCommand("bank"); - AddCommand("coins"); - AddCommand("balance"); + addCommand("bank"); + addCommand("coins"); + addCommand("balance"); } @Override diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Clans.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Clans.java index 71cf94390..b50ebab14 100644 --- a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Clans.java +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/Clans.java @@ -65,12 +65,12 @@ public class Clans extends AModule implements IRelation, IChat, INameColorer private boolean _powerEnabled = false; //Clans - private HashMap _clanMap = new HashMap(); - private HashMap _clanMemberMap = new HashMap(); - private HashMap _claimMap = new HashMap(); - private HashMap _unclaimMap = new HashMap(); + private HashMap _clanMap = new HashMap(); + private HashMap _clanMemberMap = new HashMap(); + private HashMap _claimMap = new HashMap(); + private HashMap _unclaimMap = new HashMap(); - private HashMap _clanOutpostMap = new HashMap(); + private HashMap _clanOutpostMap = new HashMap(); //Clans Modules private ClansAdmin _clansAdmin; diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansGame.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansGame.java index 17fbea6f2..c0df1767a 100644 --- a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansGame.java +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansGame.java @@ -263,7 +263,7 @@ public class ClansGame } else { - ClansClan killerClan = Clans.CUtil().getClanByPlayer(event.GetLog().GetKiller().GetName()); + ClansClan killerClan = Clans.CUtil().getClanByPlayer(event.GetLog().GetKiller().getName()); if (killerClan == null) return; diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansTask.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansTask.java index ecf37d936..2c001d27d 100644 --- a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansTask.java +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/clans/ClansTask.java @@ -60,7 +60,7 @@ public class ClansTask Clans.CUtil().updateRelations(cur); //Log - Clans.Log("Deleted [" + clan.GetName() + "]."); + Clans.log("Deleted [" + clan.GetName() + "]."); } public ClansClan create(String creator, String name, boolean admin) @@ -91,7 +91,7 @@ public class ClansTask Clans.CUtil().updateRelations(creator); //Log - Clans.Log("[" + clan.GetName() + "] with Admin [" + admin + "] created by [" + creator + "]."); + Clans.log("[" + clan.GetName() + "] with Admin [" + admin + "] created by [" + creator + "]."); return clan; } @@ -121,7 +121,7 @@ public class ClansTask Clans.CUtil().updateRelations(player); //Log - Clans.Log("Added [" + player + "] to [" + clan.GetName() + "]."); + Clans.log("Added [" + player + "] to [" + clan.GetName() + "]."); } public void leave(ClansClan clan, String player) @@ -145,7 +145,7 @@ public class ClansTask Clans.CUtil().updateRelations(player); //Log - Clans.Log("Removed [" + player + "] from [" + clan.GetName() + "]."); + Clans.log("Removed [" + player + "] from [" + clan.GetName() + "]."); } public void role(ClansClan clan, String player, Role role) @@ -157,7 +157,7 @@ public class ClansTask Clans.CRepo().EditClan(clan.GetToken()); //Log - Clans.Log("Removed [" + player + "] from [" + clan.GetName() + "]."); + Clans.log("Removed [" + player + "] from [" + clan.GetName() + "]."); } public void invite(ClansClan clan, String player, String inviter) @@ -166,7 +166,7 @@ public class ClansTask clan.GetInviterMap().put(player, inviter); //Log - Clans.Log("Invited [" + player + "] to [" + clan.GetName() + "] by [" + inviter + "]."); + Clans.log("Invited [" + player + "] to [" + clan.GetName() + "] by [" + inviter + "]."); } public void requestAlly(ClansClan clan, ClansClan target, String player) @@ -174,7 +174,7 @@ public class ClansTask clan.GetRequestMap().put(target.GetName(), System.currentTimeMillis()); //Log - Clans.Log("Alliance Request to [" + target.GetName() + "] from [" + clan.GetName() + "] by [" + player + "]."); + Clans.log("Alliance Request to [" + target.GetName() + "] from [" + clan.GetName() + "] by [" + player + "]."); } public void ally(ClansClan cA, ClansClan cB, String player) @@ -200,7 +200,7 @@ public class ClansTask Clans.CUtil().updateRelations(cur); //Log - Clans.Log("Added Ally for [" + cB.GetName() + "] and [" + cA.GetName() + "] by [" + player + "]."); + Clans.log("Added Ally for [" + cB.GetName() + "] and [" + cA.GetName() + "] by [" + player + "]."); } public boolean trust(ClansClan cA, ClansClan cB, String player) @@ -226,7 +226,7 @@ public class ClansTask Clans.CUtil().updateRelations(cur); //Log - Clans.Log("Gave Trust [" + trust + "] to [" + cB.GetName() + "] for [" + cA.GetName() + "] by [" + player + "]."); + Clans.log("Gave Trust [" + trust + "] to [" + cB.GetName() + "] for [" + cA.GetName() + "] by [" + player + "]."); return trust; } @@ -259,7 +259,7 @@ public class ClansTask Clans.CUtil().updateRelations(cur); //Log - Clans.Log("Added Neutral between [" + cA.GetName() + "] and [" + cB.GetName() + "] by [" + player + "]."); + Clans.log("Added Neutral between [" + cA.GetName() + "] and [" + cB.GetName() + "] by [" + player + "]."); } public void enemy(ClansWar war, String player) @@ -279,7 +279,7 @@ public class ClansTask Clans.CUtil().updateRelations(cur); //Log - Clans.Log("Added Invasion between [" + war.GetClanA().GetName() + "] and [" + war.GetClanB().GetName() + "] by [" + player + "]."); + Clans.log("Added Invasion between [" + war.GetClanA().GetName() + "] and [" + war.GetClanB().GetName() + "] by [" + player + "]."); } @@ -318,7 +318,7 @@ public class ClansTask } //Log - Clans.Log("Added Claim for [" + name + "] at [" + chunk + "] by [" + player + "]."); + Clans.log("Added Claim for [" + name + "] at [" + chunk + "] by [" + player + "]."); return true; } @@ -329,7 +329,7 @@ public class ClansTask if (claim == null) { - Clans.Log("Unclaiming NULL Chunk Failed."); + Clans.log("Unclaiming NULL Chunk Failed."); return false; } @@ -337,7 +337,7 @@ public class ClansTask if (clan == null) { - Clans.Log("Unclaiming from NULL Clan Failed."); + Clans.log("Unclaiming from NULL Clan Failed."); return false; } @@ -351,7 +351,7 @@ public class ClansTask Clans.GetUnclaimMap().put(chunk, System.currentTimeMillis()); //Log - Clans.Log("Removed Claim for [" + clan.GetName() + "] at [" + chunk + "] by [" + player + "]."); + Clans.log("Removed Claim for [" + clan.GetName() + "] at [" + chunk + "] by [" + player + "]."); return true; } @@ -365,7 +365,7 @@ public class ClansTask Clans.CRepo().EditClan(clan.GetToken()); //Log - Clans.Log("Set Home for [" + clan.GetName() + "] to " + UtilWorld.locToStrClean(loc) + " by [" + player + "]."); + Clans.log("Set Home for [" + clan.GetName() + "] to " + UtilWorld.locToStrClean(loc) + " by [" + player + "]."); } public void safe(ClansTerritory claim, String player) @@ -377,7 +377,7 @@ public class ClansTask Clans.CRepo().EditClan(Clans.getClan(claim.getOwner()).GetToken()); //Log - Clans.Log("Safe Zone at [" + claim.chunk + "] set to [" + claim.safe + "] by [" + player + "]."); + Clans.log("Safe Zone at [" + claim.chunk + "] set to [" + claim.safe + "] by [" + player + "]."); } public void pillage(ClansClan cA, ClansClan cB, boolean start) diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerReset.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerReset.java index 17f0eaccc..014e37412 100644 --- a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerReset.java +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerReset.java @@ -17,7 +17,7 @@ public class ServerReset extends MiniPlugin public void AddCommands() { - AddCommand(new ServerResetCommand(this)); + addCommand(new ServerResetCommand(this)); } public ServerResetRepository GetRepository() diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerResetCommand.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerResetCommand.java index 71a7268f4..8356e8fd6 100644 --- a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerResetCommand.java +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/modules/serverreset/ServerResetCommand.java @@ -22,8 +22,8 @@ public class ServerResetCommand extends CommandBase public void Execute(Player caller, String[] args) { ClearEconomy(); - System.out.println(F.main(Plugin.GetName(), caller.getName() + " cleared Economy.")); - caller.sendMessage(F.main(Plugin.GetName(), "Cleared Economy.")); + System.out.println(F.main(Plugin.getName(), caller.getName() + " cleared Economy.")); + caller.sendMessage(F.main(Plugin.getName(), "Cleared Economy.")); ClearNpcs(); } diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventManager.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventManager.java index 536968000..ee0a35eff 100644 --- a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventManager.java +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/worldevent/EventManager.java @@ -43,7 +43,7 @@ public class EventManager extends MiniPlugin @Override public void AddCommands() { - AddCommand(new EventCommand(this)); + addCommand(new EventCommand(this)); } @EventHandler diff --git a/Website/LOC.Website.Common/Models/AccountAdministrator.cs b/Website/LOC.Website.Common/Models/AccountAdministrator.cs index a95d73dad..6ea1af528 100644 --- a/Website/LOC.Website.Common/Models/AccountAdministrator.cs +++ b/Website/LOC.Website.Common/Models/AccountAdministrator.cs @@ -568,6 +568,82 @@ } } + public void ApplyKits(String name) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = repository.Where(x => String.Equals(x.Name, name)).Include(x => x.Rank).FirstOrDefault(); + account.LoadNavigationProperties(repository.Context); + + addAccountTransaction(repository, account, "Bacon Brawl Bebe Piggles", 0, 0); + addAccountTransaction(repository, account, "Bacon Brawl `Pig`", 0, 0); + addAccountTransaction(repository, account, "A Barbarians Life Barbarian Archer", 0, 0); + addAccountTransaction(repository, account, "A Barbarians Life Bomber", 0, 0); + addAccountTransaction(repository, account, "The Bridges Archer", 0, 0); + addAccountTransaction(repository, account, "The Bridges Bomber", 0, 0); + addAccountTransaction(repository, account, "The Bridges Brawler", 0, 0); + addAccountTransaction(repository, account, "The Bridges Miner", 0, 0); + addAccountTransaction(repository, account, "Castle Siege Castle Assassin", 0, 0); + addAccountTransaction(repository, account, "Castle Siege Castle Brawler", 0, 0); + addAccountTransaction(repository, account, "Castle Siege Castle Knight", 0, 0); + addAccountTransaction(repository, account, "Castle Siege Undead Archer", 0, 0); + addAccountTransaction(repository, account, "Castle Siege Undead Zombie", 0, 0); + addAccountTransaction(repository, account, "Death Tag Runner Archer", 0, 0); + addAccountTransaction(repository, account, "Death Tag Runner Traitor", 0, 0); + addAccountTransaction(repository, account, "Dragon Escape Disruptor", 0, 0); + addAccountTransaction(repository, account, "Dragon Escape Warper", 0, 0); + addAccountTransaction(repository, account, "Dragons Marksman", 0, 0); + addAccountTransaction(repository, account, "Dragons Pyrotechnic", 0, 0); + addAccountTransaction(repository, account, "Block Hunt Instant Hider", 0, 0); + addAccountTransaction(repository, account, "Block Hunt Shocking Hider", 0, 0); + addAccountTransaction(repository, account, "Block Hunt Radar Hunter", 0, 0); + addAccountTransaction(repository, account, "Block Hunt TNT Hunter", 0, 0); + addAccountTransaction(repository, account, "Super Paintball Machine Gun", 0, 0); + addAccountTransaction(repository, account, "Super Paintball Shotgun", 0, 0); + addAccountTransaction(repository, account, "One in the Quiver Brawler", 0, 0); + addAccountTransaction(repository, account, "One in the Quiver Enchanter", 0, 0); + addAccountTransaction(repository, account, "Runner Archer", 0, 0); + addAccountTransaction(repository, account, "Runner Frosty", 0, 0); + addAccountTransaction(repository, account, "Sheep Quest Archer", 0, 0); + addAccountTransaction(repository, account, "Sheep Quest Brute", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Blaze", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Chicken", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Mad Cow", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Creeper", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Enderman", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Undead Knight", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Magma Cube", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Pig", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Skeletal Horse", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Sky Squid", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Snowman", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Witch", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Wither", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Wither Skeleton", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Wolf", 0, 0); + addAccountTransaction(repository, account, "Snake Super Snake", 0, 0); + addAccountTransaction(repository, account, "Snake Other Snake", 0, 0); + addAccountTransaction(repository, account, "Sneaky Assassins Ranged Assassin", 0, 0); + addAccountTransaction(repository, account, "Sneaky Assassins Revealer", 0, 0); + addAccountTransaction(repository, account, "Super Spleef Archer", 0, 0); + addAccountTransaction(repository, account, "Super Spleef Brawler", 0, 0); + addAccountTransaction(repository, account, "Squid Shooter Squid Blaster", 0, 0); + addAccountTransaction(repository, account, "Squid Shooter Squid Sniper", 0, 0); + addAccountTransaction(repository, account, "Survival Games Archer", 0, 0); + addAccountTransaction(repository, account, "Survival Games Assassin", 0, 0); + addAccountTransaction(repository, account, "Survival Games Beastmaster", 0, 0); + addAccountTransaction(repository, account, "Survival Games Bomber", 0, 0); + addAccountTransaction(repository, account, "Survival Games Brawler", 0, 0); + addAccountTransaction(repository, account, "Survival Games Necromancer", 0, 0); + addAccountTransaction(repository, account, "Turf Wars Infiltrator", 0, 0); + addAccountTransaction(repository, account, "Turf Wars Shredder", 0, 0); + addAccountTransaction(repository, account, "Zombie Survival Survivor Archer", 0, 0); + addAccountTransaction(repository, account, "Zombie Survival Survivor Rogue", 0, 0); + + repository.CommitChanges(); + } + } + public string UpdateRank(RankUpdateToken token) { Rank rank = null; diff --git a/Website/LOC.Website.Common/Models/IAccountAdministrator.cs b/Website/LOC.Website.Common/Models/IAccountAdministrator.cs index 9f1dfccd5..e798162b6 100644 --- a/Website/LOC.Website.Common/Models/IAccountAdministrator.cs +++ b/Website/LOC.Website.Common/Models/IAccountAdministrator.cs @@ -21,6 +21,7 @@ void ApplySalesPackage(SalesPackage salesPackage, int accountId, decimal gross, decimal fee); Account Login(LoginRequestToken loginToken); void Logout(string name); + void ApplyKits(string name); PunishmentResponse Punish(PunishToken punish); PunishmentResponse RemovePunishment(RemovePunishmentToken ban); diff --git a/Website/LOC.Website.Web/Controllers/PlayerAccountController.cs b/Website/LOC.Website.Web/Controllers/PlayerAccountController.cs index 6713bef16..820a8212a 100644 --- a/Website/LOC.Website.Web/Controllers/PlayerAccountController.cs +++ b/Website/LOC.Website.Web/Controllers/PlayerAccountController.cs @@ -82,6 +82,12 @@ _accountAdministrator.AddTask(token); } + [HttpPost] + public void ApplyKits(string name) + { + _accountAdministrator.ApplyKits(name); + } + [HttpPost] public void Logout(string name) { diff --git a/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml b/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml index 23627865d..5ef6315c7 100644 --- a/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml +++ b/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml @@ -1,12 +1,12 @@  + - @@ -19,14 +19,17 @@ - + + + + @@ -40,16 +43,17 @@ - + - + + @@ -58,8 +62,7 @@ - - + @@ -70,23 +73,22 @@ - + + - + - - - + @@ -94,7 +96,7 @@ - + @@ -102,41 +104,44 @@ - - + - + - + + + - + + - + + - + @@ -150,51 +155,45 @@ - - - - + - - - + + - - + - + - - + - - + + @@ -203,72 +202,75 @@ - - + + - + - + - + - - + - + + - + + - + - + - - + + - + - - + + - - + + - + + + @@ -281,17 +283,13 @@ - - + - - - @@ -305,25 +303,26 @@ - + + - + - + @@ -334,28 +333,30 @@ - - + - + + + - + + @@ -363,43 +364,42 @@ + - + + - + - + - - - - + + - - - + + @@ -410,31 +410,34 @@ - + - + + + + + + - - - + + - @@ -442,29 +445,28 @@ - + - - + - + - + @@ -472,66 +474,66 @@ - - + + - + - - - - + + + - + - - + - - + + - - + + - + - - - - - + + + + + - + + + @@ -542,40 +544,39 @@ - + - + - - - + - + + + - @@ -584,9 +585,8 @@ - - + @@ -597,42 +597,44 @@ - - - + - - + + + + - + - + - + + + @@ -645,23 +647,22 @@ + - + - - - + @@ -672,62 +673,63 @@ - + - + + + + + + - - - - - + + + - - - + - + - - + + - - + + - + - + @@ -735,66 +737,66 @@ - + - + - + - - + - + - - + - - + + - - + + - + - - - - - + + + + + - + + + @@ -805,40 +807,39 @@ - + - + - - - + - + + + - @@ -847,9 +848,8 @@ - - + @@ -860,29 +860,29 @@ - - - + - - + + + + @@ -891,11 +891,13 @@ - + - + + + @@ -908,23 +910,22 @@ + - + - - - + @@ -935,62 +936,63 @@ - + - + + + + + + - - - + - - - + - + - - + + - - + + - + - + @@ -998,58 +1000,56 @@ - + - + - + - - + - + - - + - - + + - - + + - + - - - - - + + + + + - + \ No newline at end of file diff --git a/Website/LOCWebsite.suo b/Website/LOCWebsite.suo index 0f4dc2361..8bfe18747 100644 Binary files a/Website/LOCWebsite.suo and b/Website/LOCWebsite.suo differ