Sorted members. Idiotic bug with riding still exists. It will live.

This commit is contained in:
Andrew 2013-10-18 14:11:35 +13:00
parent d82ce55ff7
commit 6c9db19f3c
3 changed files with 27 additions and 28 deletions

View File

@ -38,16 +38,6 @@ public class DisguiseAPI {
return hearSelfDisguise; return hearSelfDisguise;
} }
public static void setInventoryListenerEnabled(boolean inventoryListenerEnabled) {
if (PacketsManager.isInventoryListenerEnabled() != inventoryListenerEnabled) {
PacketsManager.setInventoryListenerEnabled(inventoryListenerEnabled);
}
}
public static boolean isInventoryListenerEnabled() {
return PacketsManager.isInventoryListenerEnabled();
}
/** /**
* Disguise the next entity to spawn with this disguise. This may not work however if the entity doesn't actually spawn. * Disguise the next entity to spawn with this disguise. This may not work however if the entity doesn't actually spawn.
*/ */
@ -146,6 +136,10 @@ public class DisguiseAPI {
return hidingHeldItem; return hidingHeldItem;
} }
public static boolean isInventoryListenerEnabled() {
return PacketsManager.isInventoryListenerEnabled();
}
/** /**
* Is the sound packets caught and modified * Is the sound packets caught and modified
*/ */
@ -246,6 +240,12 @@ public class DisguiseAPI {
} }
} }
public static void setInventoryListenerEnabled(boolean inventoryListenerEnabled) {
if (PacketsManager.isInventoryListenerEnabled() != inventoryListenerEnabled) {
PacketsManager.setInventoryListenerEnabled(inventoryListenerEnabled);
}
}
/** /**
* Set if the disguises play sounds when hurt * Set if the disguises play sounds when hurt
*/ */

View File

@ -73,16 +73,16 @@ import com.comphenix.protocol.events.PacketListener;
import com.comphenix.protocol.reflect.StructureModifier; import com.comphenix.protocol.reflect.StructureModifier;
public class PacketsManager { public class PacketsManager {
private static boolean cancelSound;
private static DisguiseAPI disguiseAPI = new DisguiseAPI();
private static PacketListener inventoryListenerClient; private static PacketListener inventoryListenerClient;
private static PacketListener inventoryListenerServer; private static PacketListener inventoryListenerServer;
private static boolean inventoryModifierEnabled; private static boolean inventoryModifierEnabled;
private static LibsDisguises libsDisguises;
private static PacketListener soundsListener; private static PacketListener soundsListener;
private static boolean soundsListenerEnabled; private static boolean soundsListenerEnabled;
private static PacketListener viewDisguisesListener; private static PacketListener viewDisguisesListener;
private static boolean viewDisguisesListenerEnabled; private static boolean viewDisguisesListenerEnabled;
private static LibsDisguises libsDisguises;
private static DisguiseAPI disguiseAPI = new DisguiseAPI();
private static boolean cancelSound;
protected static void addPacketListeners(final JavaPlugin libsDisguises) { protected static void addPacketListeners(final JavaPlugin libsDisguises) {
ProtocolManager manager = ProtocolLibrary.getProtocolManager(); ProtocolManager manager = ProtocolLibrary.getProtocolManager();
@ -612,8 +612,7 @@ public class PacketsManager {
Packets.Server.REL_ENTITY_MOVE_LOOK, Packets.Server.ENTITY_LOOK, Packets.Server.ENTITY_TELEPORT, Packets.Server.REL_ENTITY_MOVE_LOOK, Packets.Server.ENTITY_LOOK, Packets.Server.ENTITY_TELEPORT,
Packets.Server.ENTITY_HEAD_ROTATION, Packets.Server.ENTITY_METADATA, Packets.Server.ENTITY_EQUIPMENT, Packets.Server.ENTITY_HEAD_ROTATION, Packets.Server.ENTITY_METADATA, Packets.Server.ENTITY_EQUIPMENT,
Packets.Server.ARM_ANIMATION, Packets.Server.ENTITY_LOCATION_ACTION, Packets.Server.MOB_EFFECT, Packets.Server.ARM_ANIMATION, Packets.Server.ENTITY_LOCATION_ACTION, Packets.Server.MOB_EFFECT,
Packets.Server.ENTITY_STATUS, Packets.Server.ENTITY_VELOCITY, Packets.Server.UPDATE_ATTRIBUTES, Packets.Server.ENTITY_STATUS, Packets.Server.ENTITY_VELOCITY, Packets.Server.UPDATE_ATTRIBUTES) {
Packets.Server.BED) {
@Override @Override
public void onPacketSending(PacketEvent event) { public void onPacketSending(PacketEvent event) {
StructureModifier<Entity> entityModifer = event.getPacket().getEntityModifier(event.getPlayer().getWorld()); StructureModifier<Entity> entityModifer = event.getPacket().getEntityModifier(event.getPlayer().getWorld());
@ -946,6 +945,18 @@ public class PacketsManager {
}; };
} }
public static boolean isHearDisguisesEnabled() {
return soundsListenerEnabled;
}
public static boolean isInventoryListenerEnabled() {
return inventoryModifierEnabled;
}
public static boolean isViewDisguisesListenerEnabled() {
return viewDisguisesListenerEnabled;
}
/** /**
* Sends the self disguise to the player * Sends the self disguise to the player
*/ */
@ -1043,18 +1054,6 @@ public class PacketsManager {
} }
} }
public static boolean isHearDisguisesEnabled() {
return soundsListenerEnabled;
}
public static boolean isInventoryListenerEnabled() {
return inventoryModifierEnabled;
}
public static boolean isViewDisguisesListenerEnabled() {
return viewDisguisesListenerEnabled;
}
public static void setHearDisguisesListener(boolean enabled) { public static void setHearDisguisesListener(boolean enabled) {
if (soundsListenerEnabled != enabled) { if (soundsListenerEnabled != enabled) {
soundsListenerEnabled = enabled; soundsListenerEnabled = enabled;

View File

@ -51,8 +51,8 @@ public class FlagWatcher {
} }
private Disguise disguise; private Disguise disguise;
private HashMap<Integer, Object> entityValues = new HashMap<Integer, Object>(); private HashMap<Integer, Object> entityValues = new HashMap<Integer, Object>();
private org.bukkit.inventory.ItemStack[] items = new org.bukkit.inventory.ItemStack[5];
private boolean hasDied; private boolean hasDied;
private org.bukkit.inventory.ItemStack[] items = new org.bukkit.inventory.ItemStack[5];
public FlagWatcher(Disguise disguise) { public FlagWatcher(Disguise disguise) {
this.disguise = disguise; this.disguise = disguise;