Fixed CustomTagFix.
Updated ServerData ServerGroup and SErverMonitor for new flags in Arcade.
This commit is contained in:
parent
558231457c
commit
14c4152248
@ -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<Integer, Integer> _entityMap = new NautHashMap<Integer, Integer>();
|
||||
private NautHashMap<Player, NautHashMap<Integer, Integer>> _entityMap = new NautHashMap<Player, NautHashMap<Integer, Integer>>();
|
||||
|
||||
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<Integer, Integer>());
|
||||
|
||||
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<WatchableObject>)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;
|
||||
|
@ -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<Integer, DisguiseBase> _spawnPacketMap = new NautHashMap<Integer, DisguiseBase>();
|
||||
private NautHashMap<Integer, PacketPlayOutEntityVelocity> _movePacketMap = new NautHashMap<Integer, PacketPlayOutEntityVelocity>();
|
||||
@ -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)
|
||||
|
@ -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<FriendData>
|
||||
public class FriendManager extends MiniClientPlugin<FriendData> implements IPacketHandler
|
||||
{
|
||||
private FriendRepository _repository;
|
||||
|
||||
private NautHashMap<Player, FriendTabList> _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<Player, FriendTabList>();
|
||||
}
|
||||
@ -134,15 +138,14 @@ public class FriendManager extends MiniClientPlugin<FriendData>
|
||||
_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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,6 @@
|
||||
package mineplex.core.packethandler;
|
||||
|
||||
public interface IPacketHandler
|
||||
{
|
||||
void handle(PacketInfo packetInfo);
|
||||
}
|
@ -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<Player, PacketVerifier> _playerVerifierMap = new NautHashMap<Player, PacketVerifier>();
|
||||
private HashSet<IPacketHandler> _packetHandlers = new HashSet<IPacketHandler>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
{
|
@ -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<IPacketHandler> _packetHandlers = new ArrayList<IPacketHandler>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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<String, String> 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);
|
||||
}
|
||||
|
@ -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<Boolean>()
|
||||
{
|
||||
public void run(Boolean error)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user