diff --git a/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java b/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java index 91a9e1600..e9aa2cd90 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java @@ -5,8 +5,10 @@ import java.util.List; import mineplex.core.common.DummyEntity; import mineplex.core.common.util.NautHashMap; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketHandler; import mineplex.core.packethandler.PacketVerifier; -import mineplex.core.packethandler.PlayerPacketEvent; +import mineplex.core.packethandler.PacketInfo; import net.minecraft.server.v1_7_R4.DataWatcher; import net.minecraft.server.v1_7_R4.EnumEntitySize; import net.minecraft.server.v1_7_R4.MathHelper; @@ -20,23 +22,23 @@ import net.minecraft.server.v1_7_R4.WatchableObject; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; -public class CustomTagFix extends MiniPlugin +public class CustomTagFix extends MiniPlugin implements IPacketHandler { private static int _fakeIdCounter = 455000; - private NautHashMap _entityMap = new NautHashMap(); + private NautHashMap> _entityMap = new NautHashMap>(); private Field _destroyId; - public CustomTagFix(JavaPlugin plugin) + public CustomTagFix(JavaPlugin plugin, PacketHandler packetHandler) { super("Custom Tag Fix", plugin); + packetHandler.addPacketHandler(this); try { @@ -50,16 +52,27 @@ public class CustomTagFix extends MiniPlugin } } - @SuppressWarnings("unchecked") - @EventHandler(priority = EventPriority.HIGHEST) - public void handlePackets(PlayerPacketEvent event) + @EventHandler + public void playerQuit(PlayerQuitEvent event) { - Packet packet = event.getPacket(); - Player owner = event.getPlayer(); - PacketVerifier verifier = event.getVerifier(); + _entityMap.remove(event.getPlayer()); + } + + @SuppressWarnings("unchecked") + public void handle(PacketInfo packetInfo) + { + if (packetInfo.isCancelled()) + return; + + Packet packet = packetInfo.getPacket(); + Player owner = packetInfo.getPlayer(); + PacketVerifier verifier = packetInfo.getVerifier(); if (((CraftPlayer)owner).getHandle().playerConnection.networkManager.getVersion() >= 47) { + if (owner.isOnline() && !_entityMap.containsKey(owner)) + _entityMap.put(owner, new NautHashMap()); + if (packet instanceof PacketPlayOutSpawnEntityLiving) { PacketPlayOutSpawnEntityLiving spawnPacket = (PacketPlayOutSpawnEntityLiving)packet; @@ -68,14 +81,14 @@ public class CustomTagFix extends MiniPlugin if (spawnPacket.l.getByte(11) == 1 || spawnPacket.l.getByte(3) == 1) { - if (_entityMap.containsKey(spawnPacket.a)) + if (_entityMap.get(owner).containsKey(spawnPacket.a)) { - verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(spawnPacket.a))); + verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner).get(spawnPacket.a))); } int newId = _fakeIdCounter++; sendProtocolPackets(owner, spawnPacket.a, newId, entityName, verifier); - _entityMap.put(spawnPacket.a, newId); + _entityMap.get(owner).put(spawnPacket.a, newId); } } @@ -83,7 +96,7 @@ public class CustomTagFix extends MiniPlugin { PacketPlayOutEntityMetadata metaPacket = (PacketPlayOutEntityMetadata)packet; - if (!_entityMap.containsKey(metaPacket.a) && metaPacket.a != 777777) + if (!_entityMap.get(owner).containsKey(metaPacket.a) && metaPacket.a != 777777) { String entityName = ""; for (WatchableObject watchable : (List)metaPacket.b) @@ -98,7 +111,7 @@ public class CustomTagFix extends MiniPlugin { int newId = _fakeIdCounter++; sendProtocolPackets(owner, metaPacket.a, newId, entityName, verifier); - _entityMap.put(metaPacket.a, newId); + _entityMap.get(owner).put(metaPacket.a, newId); } } } @@ -108,10 +121,10 @@ public class CustomTagFix extends MiniPlugin { for (int id : (int[])_destroyId.get(packet)) { - if (_entityMap.containsKey(id)) + if (_entityMap.get(owner).containsKey(id)) { - verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(id))); - _entityMap.remove(id); + verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner).get(id))); + _entityMap.get(owner).remove(id); } } } @@ -126,7 +139,7 @@ public class CustomTagFix extends MiniPlugin if (attachPacket.c == owner.getEntityId()) { - event.setCancelled(true); + packetInfo.setCancelled(true); //verifier.bypassProcess(new PacketPlayOutEntityDestroy(attachPacket.b)); /* System.out.println("Adding patch item."); @@ -302,7 +315,7 @@ public class CustomTagFix extends MiniPlugin packet.l = watcher; - packetList.bypassProcess(packet); + packetList.bypassProcess(packet); PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity(); vehiclePacket.a = 0; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java index e2e57be28..19c3fb90a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java @@ -40,13 +40,15 @@ 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.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketHandler; import mineplex.core.packethandler.PacketVerifier; -import mineplex.core.packethandler.PlayerPacketEvent; +import mineplex.core.packethandler.PacketInfo; import mineplex.core.timing.TimingManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -public class DisguiseManager extends MiniPlugin +public class DisguiseManager extends MiniPlugin implements IPacketHandler { private NautHashMap _spawnPacketMap = new NautHashMap(); private NautHashMap _movePacketMap = new NautHashMap(); @@ -64,10 +66,12 @@ public class DisguiseManager extends MiniPlugin private Field _soundC; private Field _soundD; - public DisguiseManager(JavaPlugin plugin) + public DisguiseManager(JavaPlugin plugin, PacketHandler packetHandler) { super("Disguise Manager", plugin); + packetHandler.addPacketHandler(this); + try { _attributesA = PacketPlayOutUpdateAttributes.class.getDeclaredField("a"); @@ -173,6 +177,8 @@ public class DisguiseManager extends MiniPlugin entityPlayer.playerConnection.sendPacket(new PacketPlayOutSpawnEntityLiving(((CraftLivingEntity)entity).getHandle())); } } + + _disguisePlayerMap.remove(disguise); } public void reApplyDisguise(final DisguiseBase disguise) @@ -347,6 +353,7 @@ public class DisguiseManager extends MiniPlugin _entityDisguiseMap.clear(); _addTempList.clear(); _delTempList.clear(); + _disguisePlayerMap.clear(); } @EventHandler @@ -360,15 +367,14 @@ public class DisguiseManager extends MiniPlugin } } - @EventHandler - public void handlePackets(PlayerPacketEvent event) + public void handle(PacketInfo packetInfo) { if (_handlingPacket) return; - final Packet packet = event.getPacket(); - Player owner = event.getPlayer(); - final PacketVerifier packetVerifier = event.getVerifier(); + final Packet packet = packetInfo.getPacket(); + Player owner = packetInfo.getPlayer(); + final PacketVerifier packetVerifier = packetInfo.getVerifier(); if (packet instanceof PacketPlayOutNamedEntitySpawn) { @@ -377,7 +383,7 @@ public class DisguiseManager extends MiniPlugin if (_spawnPacketMap.containsKey(entityId) && (_spawnPacketMap.get(entityId).Global || _disguisePlayerMap.get(_spawnPacketMap.get(entityId)).contains(owner))) { handlePacket(_spawnPacketMap.get(entityId).GetSpawnPacket(), packetVerifier); - event.setCancelled(true); + packetInfo.setCancelled(true); } } else if (packet instanceof PacketPlayOutSpawnEntity) @@ -387,7 +393,7 @@ public class DisguiseManager extends MiniPlugin if (_spawnPacketMap.containsKey(entityId) && (_spawnPacketMap.get(entityId).Global || _disguisePlayerMap.get(_spawnPacketMap.get(entityId)).contains(owner))) { handlePacket(_spawnPacketMap.get(entityId).GetSpawnPacket(), packetVerifier); - event.setCancelled(true); + packetInfo.setCancelled(true); } } else if (packet instanceof PacketPlayOutUpdateAttributes) @@ -411,7 +417,7 @@ public class DisguiseManager extends MiniPlugin { // Crash clients with meta to a block id. if (_spawnPacketMap.get(entityId) instanceof DisguiseBlock) - event.setCancelled(true); + packetInfo.setCancelled(true); } } else if (packet instanceof PacketPlayOutAnimation) @@ -420,7 +426,7 @@ public class DisguiseManager extends MiniPlugin if (containsSpawnDisguise(owner, entityId) && owner.getEntityId() != entityId) { - event.setCancelled(true); + packetInfo.setCancelled(true); } } else if (packet instanceof PacketPlayOutEntityMetadata) @@ -430,7 +436,7 @@ public class DisguiseManager extends MiniPlugin if (containsSpawnDisguise(owner, entityId) && owner.getEntityId() != entityId) { handlePacket(_spawnPacketMap.get(entityId).GetMetaDataPacket(), packetVerifier); - event.setCancelled(true); + packetInfo.setCancelled(true); } } else if (packet instanceof PacketPlayOutEntityEquipment) @@ -441,7 +447,7 @@ public class DisguiseManager extends MiniPlugin { if (!((DisguiseInsentient)_spawnPacketMap.get(entityId)).armorVisible() && ((PacketPlayOutEntityEquipment)packet).b != 0) { - event.setCancelled(true); + packetInfo.setCancelled(true); } } } @@ -461,7 +467,7 @@ public class DisguiseManager extends MiniPlugin } else if (_spawnPacketMap.containsKey(velocityPacket.a)) { - event.setCancelled(true); + packetInfo.setCancelled(true); } } else if (packet instanceof PacketPlayOutRelEntityMove) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java index 99b6ea971..8d4cb8a8f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java @@ -20,22 +20,26 @@ import mineplex.core.friend.command.DeleteFriend; import mineplex.core.friend.data.FriendData; import mineplex.core.friend.data.FriendRepository; import mineplex.core.friend.ui.FriendTabList; -import mineplex.core.packethandler.PlayerPacketEvent; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PacketInfo; import mineplex.core.timing.TimingManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -public class FriendManager extends MiniClientPlugin +public class FriendManager extends MiniClientPlugin implements IPacketHandler { private FriendRepository _repository; private NautHashMap _playerTabMap; private boolean _sendingPackets = false; - public FriendManager(JavaPlugin plugin) + public FriendManager(JavaPlugin plugin, PacketHandler packetHandler) { super("Friends", plugin); + packetHandler.addPacketHandler(this); + _repository = new FriendRepository(plugin); _playerTabMap = new NautHashMap(); } @@ -134,15 +138,14 @@ public class FriendManager extends MiniClientPlugin _playerTabMap.remove(event.getPlayer()); } - @EventHandler - public void handleFriendPackets(PlayerPacketEvent event) + public void handle(PacketInfo packetInfo) { - if (event.isCancelled()) + if (packetInfo.isCancelled()) return; - if (event.getPacket() instanceof PacketPlayOutPlayerInfo) + if (packetInfo.getPacket() instanceof PacketPlayOutPlayerInfo) { - event.setCancelled(_sendingPackets); + packetInfo.setCancelled(_sendingPackets); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/IPacketHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/IPacketHandler.java new file mode 100644 index 000000000..3ce1c5563 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/IPacketHandler.java @@ -0,0 +1,6 @@ +package mineplex.core.packethandler; + +public interface IPacketHandler +{ + void handle(PacketInfo packetInfo); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java index b26b88406..5ee3adc78 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java @@ -1,6 +1,9 @@ package mineplex.core.packethandler; +import java.util.HashSet; + import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerJoinEvent; @@ -8,9 +11,13 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; +import mineplex.core.common.util.NautHashMap; public class PacketHandler extends MiniPlugin { + private NautHashMap _playerVerifierMap = new NautHashMap(); + private HashSet _packetHandlers = new HashSet(); + public PacketHandler(JavaPlugin plugin) { super("PacketHandler", plugin); @@ -19,12 +26,29 @@ public class PacketHandler extends MiniPlugin @EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoin(PlayerJoinEvent event) { - ((CraftPlayer) event.getPlayer()).getHandle().playerConnection.PacketVerifier.addPacketVerifier(new PacketVerifier(event.getPlayer())); + _playerVerifierMap.put(event.getPlayer(), new PacketVerifier(event.getPlayer())); + ((CraftPlayer) event.getPlayer()).getHandle().playerConnection.PacketVerifier.addPacketVerifier(_playerVerifierMap.get(event.getPlayer())); + + for (IPacketHandler packetHandler : _packetHandlers) + { + _playerVerifierMap.get(event.getPlayer()).addPacketHandler(packetHandler); + } } @EventHandler(priority = EventPriority.MONITOR) public void onPlayerQuit(PlayerQuitEvent event) { ((CraftPlayer) event.getPlayer()).getHandle().playerConnection.PacketVerifier.clearVerifiers(); + _playerVerifierMap.remove(event.getPlayer()).clearHandlers(); } + + public void addPacketHandler(IPacketHandler packetHandler) + { + _packetHandlers.add(packetHandler); + + for (PacketVerifier verifier : _playerVerifierMap.values()) + { + verifier.addPacketHandler(packetHandler); + } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PlayerPacketEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketInfo.java similarity index 66% rename from Plugins/Mineplex.Core/src/mineplex/core/packethandler/PlayerPacketEvent.java rename to Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketInfo.java index c85d82402..06ededb58 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PlayerPacketEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketInfo.java @@ -6,32 +6,20 @@ import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; -public class PlayerPacketEvent extends Event +public class PacketInfo { - private static final HandlerList handlers = new HandlerList(); - private Player _player; private Packet _packet; private PacketVerifier _verifier; private boolean _cancelled = false; - public PlayerPacketEvent(Player player, Packet packet, PacketVerifier verifier) + public PacketInfo(Player player, Packet packet, PacketVerifier verifier) { _player = player; _packet = packet; _verifier = verifier; } - - public HandlerList getHandlers() - { - return handlers; - } - - public static HandlerList getHandlerList() - { - return handlers; - } public Packet getPacket() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketVerifier.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketVerifier.java index 4d9bcb082..f318ac341 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketVerifier.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketVerifier.java @@ -1,5 +1,9 @@ package mineplex.core.packethandler; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; + import net.minecraft.server.v1_7_R4.IPacketVerifier; import net.minecraft.server.v1_7_R4.Packet; import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation; @@ -23,38 +27,41 @@ import org.bukkit.entity.Player; public class PacketVerifier implements IPacketVerifier { + private static Field _destroyId; private Player _owner; + + private List _packetHandlers = new ArrayList(); public PacketVerifier(Player owner) { _owner = owner; + + if (_destroyId == null) + { + try + { + _destroyId = PacketPlayOutEntityDestroy.class.getDeclaredField("a"); + _destroyId.setAccessible(true); + } + catch (Exception exception) + { + System.out.println("Field exception in CustomTagFix : "); + exception.printStackTrace(); + } + } } @Override public boolean verify(Packet o) { - if (o instanceof PacketPlayOutNamedEntitySpawn - || o instanceof PacketPlayOutSpawnEntity - || o instanceof PacketPlayOutSpawnEntityLiving - || o instanceof PacketPlayOutUpdateAttributes - || o instanceof PacketPlayOutAnimation - || o instanceof PacketPlayOutEntityMetadata - || o instanceof PacketPlayOutEntityEquipment - || o instanceof PacketPlayOutEntityVelocity - || o instanceof PacketPlayOutRelEntityMove - || o instanceof PacketPlayOutRelEntityMoveLook - || o instanceof PacketPlayOutPlayerInfo - || o instanceof PacketPlayOutEntityDestroy - || o instanceof PacketPlayOutAttachEntity) - { - PlayerPacketEvent event = new PlayerPacketEvent(_owner, o, this); - - Bukkit.getServer().getPluginManager().callEvent(event); - - return !event.isCancelled(); - } - - return true; + PacketInfo packetInfo = new PacketInfo(_owner, o, this); + + for (IPacketHandler handler : _packetHandlers) + { + handler.handle(packetInfo); + } + + return !packetInfo.isCancelled(); } public void bypassProcess(Packet packet) @@ -71,4 +78,14 @@ public class PacketVerifier implements IPacketVerifier { ((CraftPlayer)_owner).getHandle().playerConnection.sendPacket(packet); } + + public void clearHandlers() + { + _packetHandlers.clear(); + } + + public void addPacketHandler(IPacketHandler packetHandler) + { + _packetHandlers.add(packetHandler); + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index d565f52bb..62055c56c 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -95,7 +95,8 @@ public class Hub extends JavaPlugin implements IRelation PartyManager partyManager = new PartyManager(this, clientManager, preferenceManager); Portal portal = new Portal(this, serverStatusManager.getCurrentServerName()); AntiHack.Initialize(this, punish, portal); - DisguiseManager disguiseManager = new DisguiseManager(this); + PacketHandler packetHandler = new PacketHandler(this); + DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler); HubManager hubManager = new HubManager(this, new BlockRestore(this), clientManager, donationManager, new ConditionManager(this), disguiseManager, new TaskManager(this, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager); new PlayerTracker(this, serverStatusManager.getCurrentServerName(), serverStatusManager.getUs()); @@ -105,8 +106,7 @@ public class Hub extends JavaPlugin implements IRelation new Chat(this, clientManager, preferenceManager, serverStatusManager.getCurrentServerName()); new MemoryFix(this); new FileUpdater(this, portal); - new CustomTagFix(this); - new PacketHandler(this); + new CustomTagFix(this, packetHandler); CombatManager combatManager = new CombatManager(this); BlockRestore blockRestore = new BlockRestore(this); diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerGroup.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerGroup.java index a07e52ba4..232347e58 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerGroup.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerGroup.java @@ -71,6 +71,42 @@ public class ServerGroup private boolean _tournament; public boolean getTournament() { return _tournament; } + private boolean _teamRejoin; + public boolean getTeamRejoin() { return _teamRejoin; } + + private boolean _teamAutoJoin; + public boolean getTeamAutoJoin() { return _teamAutoJoin; } + + private boolean _teamForceBalance; + public boolean getTeamForceBalance() { return _teamForceBalance; } + + private boolean _gameAutoStart; + public boolean getGameAutoStart() { return _gameAutoStart; } + + private boolean _gameTimeout; + public boolean getGameTimeout() { return _gameTimeout; } + + private boolean _rewardGems; + public boolean getRewardGems() { return _rewardGems; } + + private boolean _rewardItems; + public boolean getRewardItems() { return _rewardItems; } + + private boolean _rewardStats; + public boolean getRewardStats() { return _rewardStats; } + + private boolean _rewardAchievements; + public boolean getRewardAchievements() { return _rewardAchievements; } + + private boolean _hotbarInventory; + public boolean getHotbarInventory() { return _hotbarInventory; } + + private boolean _hotbarHubClock; + public boolean getHotbarHubClock() { return _hotbarHubClock; } + + private boolean _playerKickIdle; + public boolean getPlayerKickIdle() { return _playerKickIdle; } + private boolean _generateFreeVersions; public boolean getGenerateFreeVersions() { return _generateFreeVersions; } @@ -95,26 +131,38 @@ public class ServerGroup */ public ServerGroup(Map data, Region region) { - this._name = data.get("name"); - this._prefix = data.get("prefix"); - this._scriptName = data.get("scriptName"); - this._requiredRam = Integer.valueOf(data.get("ram")); - this._requiredCpu = Integer.valueOf(data.get("cpu")); - this._requiredTotalServers = Integer.valueOf(data.get("totalServers")); - this._requiredJoinableServers = Integer.valueOf(data.get("joinableServers")); - this._portSection = Integer.valueOf(data.get("portSection")); - this._arcadeGroup = Boolean.valueOf(data.get("arcadeGroup")); - this._worldZip = data.get("worldZip"); - this._plugin = data.get("plugin"); - this._configPath = data.get("configPath"); - this._minPlayers = Integer.valueOf(data.get("minPlayers")); - this._maxPlayers = Integer.valueOf(data.get("maxPlayers")); - this._pvp = Boolean.valueOf(data.get("pvp")); - this._tournament = Boolean.valueOf(data.get("tournament")); - this._generateFreeVersions = Boolean.valueOf(data.get("generateFreeVersions")); - this._games = data.get("games"); - this._serverType = data.get("serverType"); - this._addNoCheat = Boolean.valueOf(data.get("addNoCheat")); + _name = data.get("name"); + _prefix = data.get("prefix"); + _scriptName = data.get("scriptName"); + _requiredRam = Integer.valueOf(data.get("ram")); + _requiredCpu = Integer.valueOf(data.get("cpu")); + _requiredTotalServers = Integer.valueOf(data.get("totalServers")); + _requiredJoinableServers = Integer.valueOf(data.get("joinableServers")); + _portSection = Integer.valueOf(data.get("portSection")); + _arcadeGroup = Boolean.valueOf(data.get("arcadeGroup")); + _worldZip = data.get("worldZip"); + _plugin = data.get("plugin"); + _configPath = data.get("configPath"); + _minPlayers = Integer.valueOf(data.get("minPlayers")); + _maxPlayers = Integer.valueOf(data.get("maxPlayers")); + _pvp = Boolean.valueOf(data.get("pvp")); + _tournament = Boolean.valueOf(data.get("tournament")); + _generateFreeVersions = Boolean.valueOf(data.get("generateFreeVersions")); + _games = data.get("games"); + _serverType = data.get("serverType"); + _addNoCheat = Boolean.valueOf(data.get("addNoCheat")); + _teamRejoin = Boolean.valueOf(data.get("teamRejoin")); + _teamAutoJoin = Boolean.valueOf(data.get("teamAutoJoin")); + _teamForceBalance = Boolean.valueOf(data.get("teamForceBalance")); + _gameAutoStart = Boolean.valueOf(data.get("gameAutoStart")); + _gameTimeout = Boolean.valueOf(data.get("gameTimeout")); + _rewardGems = Boolean.valueOf(data.get("rewardGems")); + _rewardItems = Boolean.valueOf(data.get("rewardItems")); + _rewardStats = Boolean.valueOf(data.get("rewardStats")); + _rewardAchievements = Boolean.valueOf(data.get("rewardAchievements")); + _hotbarInventory = Boolean.valueOf(data.get("hotbarInventory")); + _hotbarHubClock = Boolean.valueOf(data.get("hotbarHubClock")); + _playerKickIdle = Boolean.valueOf(data.get("playerKickIdle")); fetchServers(region); } diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java index 29bd07db9..d271edc74 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java @@ -380,12 +380,12 @@ public class ServerMonitor private static void startServer(final DedicatedServer serverSpace, final ServerGroup serverGroup, final int serverNum, final boolean free) { - String cmd = "/home/mineplex/easyRemoteStartServerCustom.sh"; + String cmd = "/home/mineplex/easyRemoteStartServer.sh"; final String groupPrefix = serverGroup.getPrefix(); final String serverName = serverSpace.getName(); final String serverAddress = serverSpace.getPublicAddress(); - ProcessRunner pr = new ProcessRunner(new String[] {"/bin/sh", cmd, serverAddress, serverSpace.getPrivateAddress(), (serverGroup.getPortSection() + serverNum) + "", serverGroup.getRequiredRam() + "", serverGroup.getWorldZip(), serverGroup.getPlugin(), serverGroup.getConfigPath(), serverGroup.getName(), serverGroup.getPrefix() + "-" + serverNum, serverGroup.getMinPlayers() + "", serverGroup.getMaxPlayers() + "", serverGroup.getPvp() + "", serverGroup.getTournament() + "", free + "", serverSpace.isUsRegion() ? "true" : "false", serverGroup.getArcadeGroup() + "", serverGroup.getGames(), serverGroup.getServerType(), serverGroup.getAddNoCheat() + ""}); + ProcessRunner pr = new ProcessRunner(new String[] {"/bin/sh", cmd, serverAddress, serverSpace.getPrivateAddress(), (serverGroup.getPortSection() + serverNum) + "", serverGroup.getRequiredRam() + "", serverGroup.getWorldZip(), serverGroup.getPlugin(), serverGroup.getConfigPath(), serverGroup.getName(), serverGroup.getPrefix() + "-" + serverNum, serverGroup.getMinPlayers() + "", serverGroup.getMaxPlayers() + "", serverGroup.getPvp() + "", serverGroup.getTournament() + "", free + "", serverSpace.isUsRegion() ? "true" : "false", serverGroup.getArcadeGroup() + "", serverGroup.getGames(), serverGroup.getServerType(), serverGroup.getAddNoCheat() + "", serverGroup.getTeamAutoJoin() + "", serverGroup.getTeamForceBalance() + "", serverGroup.getTeamRejoin() + "", serverGroup.getGameAutoStart() + "", serverGroup.getGameTimeout() + "", serverGroup.getHotbarHubClock() + "", serverGroup.getHotbarInventory() + "", serverGroup.getPlayerKickIdle() + "", serverGroup.getRewardGems() + "", serverGroup.getRewardItems() + "", serverGroup.getRewardAchievements() + "", serverGroup.getRewardStats() + ""}); pr.start(new GenericRunnable() { public void run(Boolean error) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index dd25b37b9..1eaf1d90c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -96,8 +96,9 @@ public class Arcade extends JavaPlugin ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, _clientManager)); Portal portal = new Portal(this, serverStatusManager.getCurrentServerName()); new FileUpdater(this, portal); - - DisguiseManager disguiseManager = new DisguiseManager(this); + PacketHandler packetHandler = new PacketHandler(this); + + DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler); _damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, creature), disguiseManager); @@ -115,11 +116,10 @@ public class Arcade extends JavaPlugin 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 CustomTagFix(this); - new PacketHandler(this); + new CustomTagFix(this, packetHandler); //Arcade Manager - _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, preferenceManager, inventoryManager, cosmeticManager, projectileManager, webServerAddress); + _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, webServerAddress); new PlayerTracker(this, serverStatusManager.getCurrentServerName(), serverStatusManager.getUs()); new MemoryFix(this); 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 a778ebc43..bd450a768 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -72,6 +72,7 @@ import mineplex.core.movement.Movement; import mineplex.core.elo.EloManager; import mineplex.core.energy.Energy; import mineplex.core.explosion.Explosion; +import mineplex.core.packethandler.PacketHandler; import mineplex.core.portal.Portal; import mineplex.core.preferences.PreferencesManager; import mineplex.core.projectile.ProjectileManager; @@ -139,7 +140,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, AntiStack antistack, - Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, + Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, CosmeticManager cosmeticManager, ProjectileManager projectileManager, String webAddress) { super("Game Manager", plugin); @@ -227,7 +228,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _gameCreationManager = new GameCreationManager(this); _gameGemManager = new GameGemManager(this); _gameManager = new GameManager(this); - _gameLobbyManager = new GameLobbyManager(this); + _gameLobbyManager = new GameLobbyManager(this, packetHandler); new GameFlagManager(this); _gamePlayerManager = new GamePlayerManager(this); new GameAchievementManager(this); @@ -236,7 +237,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation new IdleManager(this); _leaderboardRepository = new LeaderboardRepository(plugin); - // Game Addons new CompassAddon(plugin, this); new SoupAddon(plugin, this); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java index e9b20582d..12590bdb9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java @@ -52,8 +52,10 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilWorld; import mineplex.core.cosmetic.event.ActivateGemBoosterEvent; import mineplex.core.donation.Donor; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketHandler; import mineplex.core.packethandler.PacketVerifier; -import mineplex.core.packethandler.PlayerPacketEvent; +import mineplex.core.packethandler.PacketInfo; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; @@ -66,13 +68,11 @@ import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitSorter; -import net.minecraft.server.v1_7_R4.DataWatcher; import net.minecraft.server.v1_7_R4.Packet; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_7_R4.WatchableObject; -public class GameLobbyManager implements Listener +public class GameLobbyManager implements Listener, IPacketHandler { public ArcadeManager Manager; @@ -107,10 +107,12 @@ public class GameLobbyManager implements Listener private boolean _handlingPacket = false; - public GameLobbyManager(ArcadeManager manager) + public GameLobbyManager(ArcadeManager manager, PacketHandler packetHandler) { Manager = manager; + packetHandler.addPacketHandler(this); + World world = UtilWorld.getWorld("world"); spawn = new Location(world, 0, 104, 0); @@ -1031,15 +1033,14 @@ public class GameLobbyManager implements Listener } @SuppressWarnings("unchecked") - @EventHandler - public void handlePacket(PlayerPacketEvent event) + public void handle(PacketInfo packetInfo) { if (_handlingPacket) return; - Packet packet = event.getPacket(); - Player owner = event.getPlayer(); - PacketVerifier packetVerifier = event.getVerifier(); + Packet packet = packetInfo.getPacket(); + Player owner = packetInfo.getPlayer(); + PacketVerifier packetVerifier = packetInfo.getVerifier(); int entityId = -1; @@ -1090,7 +1091,7 @@ public class GameLobbyManager implements Listener packetVerifier.process(newPacket); _handlingPacket = false; - event.setCancelled(true); + packetInfo.setCancelled(true); } } catch (IllegalArgumentException e) diff --git a/Website/LOCWebsite.suo b/Website/LOCWebsite.suo index 60dbf9eda..6a1f5de2e 100644 Binary files a/Website/LOCWebsite.suo and b/Website/LOCWebsite.suo differ