Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
fc44592edf
@ -5,10 +5,12 @@ import java.util.List;
|
||||
|
||||
import mineplex.core.common.DummyEntity;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
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;
|
||||
@ -21,23 +23,22 @@ 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 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
|
||||
{
|
||||
@ -51,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 (UtilPlayer.is1_8(event.getPlayer()))
|
||||
if (UtilPlayer.is1_8(owner))
|
||||
{
|
||||
if (owner.isOnline() && !_entityMap.containsKey(owner))
|
||||
_entityMap.put(owner, new NautHashMap<Integer, Integer>());
|
||||
|
||||
if (packet instanceof PacketPlayOutSpawnEntityLiving)
|
||||
{
|
||||
PacketPlayOutSpawnEntityLiving spawnPacket = (PacketPlayOutSpawnEntityLiving)packet;
|
||||
@ -71,21 +83,30 @@ public class CustomTagFix extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
final String entityName = spawnPacket.l.getString(10);
|
||||
|
||||
if (spawnPacket.l.getByte(11) == 1 || spawnPacket.l.getByte(3) == 1)
|
||||
{
|
||||
int newId = UtilEnt.getNewEntityId();
|
||||
sendProtocolPackets(owner, spawnPacket.a, newId, entityName, verifier);
|
||||
_entityMap.put(spawnPacket.a, newId);
|
||||
for (WatchableObject watchable : (List<WatchableObject>)spawnPacket.l.b())
|
||||
{
|
||||
if ((watchable.a() == 11 || watchable.a() == 3) && watchable.b() instanceof Byte)
|
||||
{
|
||||
final String entityName = spawnPacket.l.getString(10);
|
||||
|
||||
if (_entityMap.get(owner).containsKey(spawnPacket.a))
|
||||
{
|
||||
verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner).get(spawnPacket.a)));
|
||||
}
|
||||
|
||||
int newId = UtilEnt.getNewEntityId();
|
||||
sendProtocolPackets(owner, spawnPacket.a, newId, entityName, verifier);
|
||||
_entityMap.get(owner).put(spawnPacket.a, newId);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (packet instanceof PacketPlayOutEntityMetadata)
|
||||
{
|
||||
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)
|
||||
@ -100,7 +121,7 @@ public class CustomTagFix extends MiniPlugin
|
||||
{
|
||||
int newId = UtilEnt.getNewEntityId();
|
||||
sendProtocolPackets(owner, metaPacket.a, newId, entityName, verifier);
|
||||
_entityMap.put(metaPacket.a, newId);
|
||||
_entityMap.get(owner).put(metaPacket.a, newId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -110,10 +131,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -128,7 +149,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.");
|
||||
@ -304,7 +325,7 @@ public class CustomTagFix extends MiniPlugin
|
||||
|
||||
packet.l = watcher;
|
||||
|
||||
packetList.bypassProcess(packet);
|
||||
packetList.bypassProcess(packet);
|
||||
|
||||
PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity();
|
||||
vehiclePacket.a = 0;
|
||||
|
@ -18,6 +18,7 @@ import mineplex.core.cosmetic.ui.button.OpenMorphs;
|
||||
import mineplex.core.cosmetic.ui.button.OpenMounts;
|
||||
import mineplex.core.cosmetic.ui.button.OpenParticles;
|
||||
import mineplex.core.cosmetic.ui.button.OpenPets;
|
||||
import mineplex.core.cosmetic.ui.button.TreasureButton;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
@ -44,15 +45,20 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
AddItem(11, new ShopItem(175, DonationManager.Get(Player.getName()).getCoins() + " Coins", 1, false));
|
||||
|
||||
int treasureChestCount = Plugin.getInventoryManager().Get(Player).getItemCount("Treasure Chest");
|
||||
/*
|
||||
if (treasureChestCount >= 0)
|
||||
|
||||
if (treasureChestCount <= 0 && Player.getName().equals("Chiss"))
|
||||
{
|
||||
AddButton(13, new ShopItem(Material.CHEST, C.cGold + treasureChestCount + " Treasure Chests", new String[] { ChatColor.RESET + "Click to Open Treasure Chest" }, 1, false), new TreasureButton(this));
|
||||
Plugin.getInventoryManager().addItemToInventory(Player, "Utility", "Treasure Chest", 1);
|
||||
treasureChestCount = Plugin.getInventoryManager().Get(Player).getItemCount("Treasure Chest");
|
||||
}
|
||||
else
|
||||
{
|
||||
*/
|
||||
AddItem(13, new ShopItem(Material.CHEST, ChatColor.RESET + C.cGold + treasureChestCount + " Treasure Chests (COMING SOON!)" + ChatColor.RESET, 1, false));
|
||||
|
||||
// if (treasureChestCount > 0)
|
||||
// {
|
||||
// AddButton(13, new ShopItem(Material.CHEST, C.cGold + treasureChestCount + " Treasure Chests", new String[] { ChatColor.RESET + "Click to Open Treasure Chest" }, 1, false), new TreasureButton(this));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
AddItem(13, new ShopItem(Material.CHEST, ChatColor.RESET + C.cGold + treasureChestCount + " Treasure Chests" + ChatColor.RESET, new String[] { ChatColor.RESET + "Coming soon..." }, 1, false));
|
||||
//}
|
||||
|
||||
final GemBooster gemBoosterItem = new GemBooster(Shop.getBoosterEnabled(), Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster"));
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class ServerCommand extends CommandBase<Portal>
|
||||
else
|
||||
deniedAccess = true;
|
||||
}
|
||||
else if (servUp.contains("ULTRA") || servUp.contains("BETA"))
|
||||
else if (servUp.contains("ULTRA") || servUp.contains("BETA") || servUp.contains("T_"))
|
||||
{
|
||||
if (playerRank.Has(Rank.ULTRA))
|
||||
Plugin.SendPlayerToServerWithMessage(player, args[0]);
|
||||
|
@ -391,8 +391,11 @@ public class TreasureManager extends MiniPlugin
|
||||
@EventHandler
|
||||
public void command(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (!event.getPlayer().isOp())
|
||||
return;
|
||||
|
||||
//TODO Remove
|
||||
if (event.getMessage().startsWith("/treasure"))
|
||||
if (event.getMessage().startsWith("/treasuredebug"))
|
||||
{
|
||||
event.getPlayer().sendMessage("Attempting to open treasure...");
|
||||
attemptOpenTreasure(event.getPlayer());
|
||||
|
@ -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);
|
||||
|
@ -62,8 +62,8 @@ import mineplex.serverdata.MinecraftServer;
|
||||
|
||||
public class ServerManager extends MiniPlugin
|
||||
{
|
||||
private static final Long FREE_PORTAL_TIMER = 30000L;
|
||||
private static final Long BETA_PORTAL_TIMER = 600000L;
|
||||
private static final Long FREE_PORTAL_TIMER = 20000L;
|
||||
private static final Long BETA_PORTAL_TIMER = 120000L;
|
||||
|
||||
private CoreClientManager _clientManager;
|
||||
private DonationManager _donationManager;
|
||||
|
@ -25,7 +25,7 @@ import mineplex.hub.server.ui.button.JoinServerButton;
|
||||
public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> implements IServerPage
|
||||
{
|
||||
// Shop Item Messages
|
||||
private static final String MESSAGE_BETA_GET_ULTRA = ChatColor.RESET + C.Line + "Get Ultra to join Beta servers!";
|
||||
private static final String MESSAGE_BETA_GET_ULTRA = ChatColor.RESET + C.Line + "Get Ultra to join Tournament servers!";
|
||||
private static final String MESSAGE_JOIN = ChatColor.RESET + C.Line + "Click to Join";
|
||||
private static final String MESSAGE_IN_PROGRESS = ChatColor.RESET + C.Line + "Game in Progress.";
|
||||
private static final String MESSAGE_SPECTATE = ChatColor.RESET + C.Line + "Click to Spectate";
|
||||
@ -125,7 +125,7 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
|
||||
lore.add(ChatColor.RESET + "");
|
||||
lore.add(ChatColor.RESET + serverInfo.MOTD);
|
||||
|
||||
if (serverInfo.Name.contains("BETA") && !ownsUltraPackage)
|
||||
if (serverInfo.Name.contains("T_") && !ownsUltraPackage)
|
||||
{
|
||||
lore.add(MESSAGE_BETA_GET_ULTRA);
|
||||
}
|
||||
@ -186,6 +186,8 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
|
||||
boolean showGreen = true;
|
||||
|
||||
boolean beta = serverList.size() > 0 && serverList.get(0).Name.contains("BETA");
|
||||
boolean tournament = serverList.size() > 0 && serverList.get(0).Name.contains("T_");
|
||||
boolean ownsUltraPackage = DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverList.get(0).ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA);
|
||||
|
||||
long portalTime = Plugin.getMillisecondsUntilPortal(Player, beta);
|
||||
if (portalTime > 0)
|
||||
@ -193,6 +195,21 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
|
||||
showClock(portalTime, beta);
|
||||
showGreen = false;
|
||||
}
|
||||
else if (tournament && !ownsUltraPackage)
|
||||
{
|
||||
ShopItem item = new ShopItem(Material.REDSTONE_BLOCK, (byte)0, ChatColor.RESET + C.Bold + "Tournament Servers", null, new String[] {
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + C.cAqua + "Ultra and Hero players have",
|
||||
ChatColor.RESET + C.cAqua + "access to our Tournament servers!",
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "Visit " + C.cGreen + "www.mineplex.com/shop" + C.cWhite + "!"
|
||||
}, 1, false, false);
|
||||
|
||||
AddItem(22, item);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int fullCount = 0;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -73,6 +73,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;
|
||||
@ -140,7 +141,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);
|
||||
@ -228,7 +229,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);
|
||||
@ -237,7 +238,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);
|
||||
|
@ -1171,7 +1171,7 @@ public abstract class Game implements Listener
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<StatTracker<? extends Game>> getStatTrackers()
|
||||
{
|
||||
@ -1198,4 +1198,12 @@ public abstract class Game implements Listener
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void deRegisterStats()
|
||||
{
|
||||
for (StatTracker<? extends Game> tracker : _statTrackers)
|
||||
HandlerList.unregisterAll(tracker);
|
||||
|
||||
_statTrackers.clear();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
@ -1080,15 +1082,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;
|
||||
|
||||
@ -1139,7 +1140,7 @@ public class GameLobbyManager implements Listener
|
||||
packetVerifier.process(newPacket);
|
||||
_handlingPacket = false;
|
||||
|
||||
event.setCancelled(true);
|
||||
packetInfo.setCancelled(true);
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
|
@ -269,6 +269,7 @@ public class GameManager implements Listener
|
||||
return;
|
||||
|
||||
event.GetGame().DeregisterKits();
|
||||
event.GetGame().deRegisterStats();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user