mirror of
https://github.com/TotalFreedomMC/TF-LibsDisguises.git
synced 2024-11-11 01:17:16 +00:00
Read desc
Fixed enderdragon flying backwards. Fixed vechiles not facing the right way Fixed entitys sometimes remaining in the world
This commit is contained in:
parent
bed69e85d3
commit
902fc99686
3 changed files with 23 additions and 10 deletions
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>LibsDisguises</groupId>
|
||||
<artifactId>LibsDisguises</artifactId>
|
||||
<version>v3.4</version>
|
||||
<version>3.4</version>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.bukkit.entity.Player;
|
|||
|
||||
public class Disguise {
|
||||
protected DisguiseType disguiseType;
|
||||
private Entity entity;
|
||||
private Entity entity = null;
|
||||
private FlagWatcher watcher;
|
||||
|
||||
protected Disguise(DisguiseType newType) {
|
||||
|
@ -40,6 +40,8 @@ public class Disguise {
|
|||
EntityLiving entityLiving = ((MobDisguise) this).getEntityLiving(((CraftPlayer) p).getHandle().world,
|
||||
p.getLocation(), p.getEntityId());
|
||||
spawnPacket = new Packet24MobSpawn(entityLiving);
|
||||
if (getType() == DisguiseType.ENDER_DRAGON)
|
||||
((Packet24MobSpawn) spawnPacket).i -= 128;
|
||||
|
||||
} else if (getType().isMisc()) {
|
||||
|
||||
|
@ -52,6 +54,8 @@ public class Disguise {
|
|||
spawnPacket = new Packet23VehicleSpawn(entity, getType().getEntityId(), ((MiscDisguise) this).getId());
|
||||
} else
|
||||
spawnPacket = new Packet23VehicleSpawn(entity, getType().getEntityId());
|
||||
((Packet23VehicleSpawn) spawnPacket).i += 64;
|
||||
|
||||
} else if (getType().isPlayer()) {
|
||||
|
||||
EntityHuman entityHuman = ((CraftPlayer) p).getHandle();
|
||||
|
@ -65,6 +69,7 @@ public class Disguise {
|
|||
public Entity getEntity(World world, Location loc, int entityId) {
|
||||
if (entity != null) {
|
||||
entity.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
|
||||
entity.id = entityId;
|
||||
return entity;
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.server.v1_5_R3.WatchableObject;
|
|||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_5_R3.CraftSound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
|
@ -28,7 +29,8 @@ public class LibsDisguises extends JavaPlugin {
|
|||
public void onEnable() {
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(
|
||||
new PacketAdapter(this, ConnectionSide.SERVER_SIDE, ListenerPriority.NORMAL, Packets.Server.NAMED_ENTITY_SPAWN,
|
||||
Packets.Server.ENTITY_METADATA, Packets.Server.NAMED_SOUND_EFFECT, Packets.Server.ARM_ANIMATION) {
|
||||
Packets.Server.ENTITY_METADATA, Packets.Server.NAMED_SOUND_EFFECT, Packets.Server.ARM_ANIMATION,
|
||||
Packets.Server.REL_ENTITY_MOVE_LOOK, Packets.Server.ENTITY_LOOK, Packets.Server.ENTITY_TELEPORT) {
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent event) {
|
||||
StructureModifier<Object> mods = event.getPacket().getModifier();
|
||||
|
@ -110,8 +112,9 @@ public class LibsDisguises extends JavaPlugin {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
org.bukkit.entity.Entity entity = event.getPacket().getEntityModifier(observer.getWorld())
|
||||
.read(0);
|
||||
StructureModifier<Entity> entityModifer = event.getPacket()
|
||||
.getEntityModifier(observer.getWorld());
|
||||
org.bukkit.entity.Entity entity = entityModifer.read(0);
|
||||
if (entity instanceof Player) {
|
||||
Player watched = (Player) entity;
|
||||
if (DisguiseAPI.isDisguised(watched.getName())) {
|
||||
|
@ -132,12 +135,17 @@ public class LibsDisguises extends JavaPlugin {
|
|||
event.setCancelled(true);
|
||||
DisguiseAPI.disguiseToPlayer(watched, observer, disguise);
|
||||
}
|
||||
} else {
|
||||
// Set the sounds and cancel bad packets.
|
||||
} else if (event.getPacketID() == Packets.Server.ARM_ANIMATION) {
|
||||
if (disguise.getType().isMisc()) {
|
||||
if (event.getPacketID() == Packets.Server.ARM_ANIMATION) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else {
|
||||
if (disguise.getType() == DisguiseType.ENDER_DRAGON) {
|
||||
byte value = (Byte) mods.read(4);
|
||||
mods.write(4, (byte) (value - 128));
|
||||
} else if (disguise.getType().isMisc()) {
|
||||
byte value = (Byte) mods.read(4);
|
||||
mods.write(4, (byte) (value + 64));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue