commit 739ce9f10e25a5f52045825c39eca455f0488b10 Author: Andrew Date: Sat May 18 09:05:19 2013 +1200 First commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..412eeda7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..b9d6bd92 --- /dev/null +++ b/.gitignore @@ -0,0 +1,215 @@ +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml +*.pubxml + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +#packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + +############# +## Windows detritus +############# + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac crap +.DS_Store + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist/ +build/ +eggs/ +parts/ +var/ +sdist/ +develop-eggs/ +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg diff --git a/plugin.yml b/plugin.yml new file mode 100644 index 00000000..a4b4803a --- /dev/null +++ b/plugin.yml @@ -0,0 +1,8 @@ +name: LibsDisguises +main: me.libraryaddict.disguise.LibsDisguises +version: ${project.version} +author: libraryaddict +depend: [ProtocolLib] +commands: + disguise: + aliases: [d, dis] \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..13700f29 --- /dev/null +++ b/pom.xml @@ -0,0 +1,62 @@ + + 4.0.0 + LibsDisguises + LibsDisguises + v1.0 + + src + clean package + target + LibsDisguises + + + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + + + . + true + ${project.basedir} + + plugin.yml + README.md + + + + + + UTF-8 + + + + + comphenix-rep + Comphenix Repository + http://repo.comphenix.net/content/groups/public + + + bukkit-repo + http://repo.bukkit.org/content/groups/public + + + + + + com.comphenix.protocol + ProtocolLib + 2.4.3 + + + org.bukkit + craftbukkit + 1.5.2-R0.1-SNAPSHOT + + + \ No newline at end of file diff --git a/src/me/libraryaddict/disguise/DisguiseAPI.java b/src/me/libraryaddict/disguise/DisguiseAPI.java new file mode 100644 index 00000000..a9bd845f --- /dev/null +++ b/src/me/libraryaddict/disguise/DisguiseAPI.java @@ -0,0 +1,116 @@ +package me.libraryaddict.disguise; + +import java.util.concurrent.ConcurrentHashMap; + +import me.libraryaddict.disguise.DisguiseTypes.Disguise; +import me.libraryaddict.disguise.DisguiseTypes.MobDisguise; +import me.libraryaddict.disguise.DisguiseTypes.PlayerDisguise; +import net.minecraft.server.v1_5_R3.*; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPlayer; +import org.bukkit.entity.Player; + +public class DisguiseAPI { + + private static ConcurrentHashMap disguises = new ConcurrentHashMap(); + + /** + * @param Player + * - The player to disguise + * @param Disguise + * - The disguise to wear + */ + public static void disguiseToAll(Player p, Disguise disguise) { + disguises.put(p.getName(), disguise); + for (Player player : Bukkit.getOnlinePlayers()) { + if (p.getWorld() != player.getWorld()) + continue; + player.hidePlayer(p); + player.showPlayer(p); + } + } + + /** + * @param Player + * - The player who is being disguised + * @param Player + * - The player who is watching the disguised + * @param Disguise + * - The disguise he is wearing + */ + public static void disguiseToPlayer(Player disguiser, Player observer, Disguise disguise) { + disguises.put(disguiser.getName(), disguise); + Packet29DestroyEntity destroyPacket = new Packet29DestroyEntity(new int[] { disguiser.getEntityId() }); + Packet spawnPacket = null; + if (disguise.getType().isMob()) { + + EntityLiving entityLiving = ((MobDisguise) disguise).getEntityLiving(((CraftPlayer) disguiser).getHandle().world, + disguiser.getLocation(), disguiser.getEntityId()); + spawnPacket = new Packet24MobSpawn(entityLiving); + + } else if (disguise.getType().isMisc()) { + + Entity entity = disguise.getEntity(((CraftPlayer) disguiser).getHandle().world, disguiser.getLocation(), + disguiser.getEntityId()); + spawnPacket = new Packet23VehicleSpawn(entity, 0); + + } else if (disguise.getType().isPlayer()) { + + EntityHuman entityHuman = ((CraftPlayer) disguiser).getHandle(); + spawnPacket = new Packet20NamedEntitySpawn(entityHuman); + ((Packet20NamedEntitySpawn) spawnPacket).b = ((PlayerDisguise) disguise).getName(); + + } + ((CraftPlayer) observer).getHandle().playerConnection.sendPacket(destroyPacket); + ((CraftPlayer) observer).getHandle().playerConnection.sendPacket(spawnPacket); + + } + + /** + * @param Disguiser + * @return Disguise + */ + public static Disguise getDisguise(Player p) { + return getDisguise(p.getName()); + } + + /** + * @param Disguiser + * @return Disguise + */ + public static Disguise getDisguise(String name) { + return disguises.get(name); + } + + /** + * @param Disguiser + * @return Boolean - If the disguiser is disguised + */ + public static boolean isDisguised(Player p) { + return isDisguised(p.getName()); + } + + /** + * @param Disguiser + * @return boolean - If the disguiser is disguised + */ + public static boolean isDisguised(String name) { + return disguises.containsKey(name); + } + + /** + * @param Disguiser + * - Undisguises him + */ + public static void undisguiseToAll(Player p) { + disguises.remove(p.getName()); + for (Player player : Bukkit.getOnlinePlayers()) { + if (p.getWorld() != player.getWorld()) + continue; + player.hidePlayer(p); + player.showPlayer(p); + } + } + +} \ No newline at end of file diff --git a/src/me/libraryaddict/disguise/DisguiseCommand.java b/src/me/libraryaddict/disguise/DisguiseCommand.java new file mode 100644 index 00000000..fd1a73f9 --- /dev/null +++ b/src/me/libraryaddict/disguise/DisguiseCommand.java @@ -0,0 +1,80 @@ +package me.libraryaddict.disguise; + +import java.util.ArrayList; +import java.util.Collections; + +import me.libraryaddict.disguise.DisguiseTypes.Disguise; +import me.libraryaddict.disguise.DisguiseTypes.DisguiseType; +import me.libraryaddict.disguise.DisguiseTypes.MiscDisguise; +import me.libraryaddict.disguise.DisguiseTypes.MobDisguise; +import me.libraryaddict.disguise.DisguiseTypes.PlayerDisguise; + +import org.apache.commons.lang.StringUtils; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class DisguiseCommand implements CommandExecutor { + + public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { + if (sender.isOp()) { + Player p = (Player) sender; + if (args.length == 0) { + ArrayList names = new ArrayList(); + for (DisguiseType type : DisguiseType.values()) { + names.add(type.name().toLowerCase()); + } + Collections.sort(names); + sender.sendMessage(ChatColor.RED + "You can use the disguises: " + ChatColor.GREEN + + StringUtils.join(names, ChatColor.RED + ", " + ChatColor.GREEN)); + } else if (args[0].equalsIgnoreCase("undiguise") || args[0].equalsIgnoreCase("undis") + || args[0].equalsIgnoreCase("un")) { + if (DisguiseAPI.isDisguised(p.getName())) { + DisguiseAPI.undisguiseToAll(p); + sender.sendMessage(ChatColor.RED + "You are no longer disguised"); + } else + sender.sendMessage(ChatColor.RED + "You are not disguised!"); + } else if (args[0].equalsIgnoreCase("player")) { + if (args.length > 1) { + String name = ChatColor.translateAlternateColorCodes('&', + StringUtils.join(args, " ").substring(args[0].length() + 1)); + PlayerDisguise disguise = new PlayerDisguise(name); + DisguiseAPI.disguiseToAll(p, disguise); + sender.sendMessage(ChatColor.RED + "Now disguised as the player '" + ChatColor.GREEN + name + ChatColor.RESET + + ChatColor.RED + "'"); + } else + sender.sendMessage(ChatColor.RED + "You need to provide a player name"); + } else { + DisguiseType type; + try { + type = DisguiseType.valueOf(args[0].toUpperCase()); + } catch (Exception ex) { + sender.sendMessage(ChatColor.RED + "Failed to find disguise: " + ChatColor.GREEN + args[0] + + "\n/disguise player \n/disguise \n/disguise undisguise/un/undis"); + return true; + } + boolean adult = true; + if (args.length > 1) { + if (args[1].equalsIgnoreCase("true")) { + adult = false; + } else if (!args[1].equalsIgnoreCase("false")) { + sender.sendMessage(ChatColor.RED + "Set baby: " + ChatColor.GREEN + args[1] + ChatColor.RED + + " - Thats not true or false.."); + return true; + } + } + Disguise disguise; + if (type.isMob()) + disguise = new MobDisguise(type, adult); + else + disguise = new MiscDisguise(type); + DisguiseAPI.disguiseToAll(p, disguise); + sender.sendMessage(ChatColor.RED + "Now disguised as a " + type.name().toLowerCase() + "!"); + } + } else + sender.sendMessage(ChatColor.RED + "You do not have permission"); + return true; + } +} diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/Disguise.java b/src/me/libraryaddict/disguise/DisguiseTypes/Disguise.java new file mode 100644 index 00000000..e0950f3f --- /dev/null +++ b/src/me/libraryaddict/disguise/DisguiseTypes/Disguise.java @@ -0,0 +1,72 @@ +package me.libraryaddict.disguise.DisguiseTypes; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import net.minecraft.server.v1_5_R3.DataWatcher; +import net.minecraft.server.v1_5_R3.Entity; +import net.minecraft.server.v1_5_R3.EntityCreeper; +import net.minecraft.server.v1_5_R3.EntitySkeleton; +import net.minecraft.server.v1_5_R3.World; +import org.bukkit.Location; + +public class Disguise { + protected DisguiseType disguiseType; + private Entity entity; + + protected Disguise(DisguiseType newType) { + disguiseType = newType; + } + + public Entity getEntity(World world, Location loc, int entityId) { + Entity entity = null; + try { + String name = toReadable(disguiseType.name()); + if (disguiseType == DisguiseType.WITHER_SKELETON) { + name = "Skeleton"; + } + if (disguiseType == DisguiseType.CHARGED_CREEPER) { + name = "Creeper"; + } + if (disguiseType == DisguiseType.TNT_PRIMED) { + name = "TNTPrimed"; + } + Class entityClass = Class.forName("net.minecraft.server.v1_5_R3.Entity" + name); + Constructor contructor = entityClass.getDeclaredConstructor(World.class); + entity = (Entity) contructor.newInstance(world); + if (disguiseType == DisguiseType.WITHER_SKELETON) { + ((EntitySkeleton) entity).setSkeletonType(1); + } + if (disguiseType == DisguiseType.CHARGED_CREEPER) { + ((EntityCreeper) entity).setPowered(true); + } + Field field = Entity.class.getDeclaredField("datawatcher"); + field.setAccessible(true); + } catch (Exception ex) { + ex.printStackTrace(); + } + entity.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch()); + entity.id = entityId; + this.entity = entity; + return entity; + } + + public DisguiseType getType() { + return disguiseType; + } + + public DataWatcher getDataWatcher() { + return entity.getDataWatcher(); + } + + public Entity getEntity() { + return entity; + } + + private String toReadable(String string) { + String[] strings = string.split("_"); + string = ""; + for (String s : strings) + string += s.substring(0, 1) + s.substring(1).toLowerCase(); + return string; + } +} \ No newline at end of file diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/DisguiseType.java b/src/me/libraryaddict/disguise/DisguiseTypes/DisguiseType.java new file mode 100644 index 00000000..fd03c128 --- /dev/null +++ b/src/me/libraryaddict/disguise/DisguiseTypes/DisguiseType.java @@ -0,0 +1,38 @@ +package me.libraryaddict.disguise.DisguiseTypes; + +public enum DisguiseType { + BAT(EntityType.MOB), BLAZE(EntityType.MOB), CAVE_SPIDER(EntityType.MOB), CHARGED_CREEPER(EntityType.MOB), CHICKEN( + EntityType.MOB), COW(EntityType.MOB), CREEPER(EntityType.MOB), ENDER_CRYSTAL(EntityType.MISC), ENDER_DRAGON( + EntityType.MOB), ENDERMAN(EntityType.MOB), GHAST(EntityType.MOB), GIANT_ZOMBIE(EntityType.MOB), IRON_GOLEM(EntityType.MOB), MAGMA_CUBE( + EntityType.MOB), MUSHROOM_COW(EntityType.MOB), OCELOT(EntityType.MOB), PIG(EntityType.MOB), PIG_ZOMBIE(EntityType.MOB), PLAYER( + EntityType.PLAYER), TNT_PRIMED(EntityType.MISC), SHEEP(EntityType.MOB), SILVERFISH(EntityType.MOB), SKELETON( + EntityType.MOB), SLIME(EntityType.MOB), SNOWMAN(EntityType.MOB), SPIDER(EntityType.MOB), SQUID(EntityType.MOB), VILLAGER( + EntityType.MOB), WITCH(EntityType.MOB), WITHER(EntityType.MOB), WITHER_SKELETON(EntityType.MOB), WOLF(EntityType.MOB), ZOMBIE( + EntityType.MOB); + + public static enum EntityType { + MISC, MOB, PLAYER; + } + + public static DisguiseType getType(org.bukkit.entity.EntityType entityType) { + return DisguiseType.valueOf(entityType.name()); + } + + private EntityType entityType; + + private DisguiseType(EntityType newType) { + entityType = newType; + } + + public boolean isMisc() { + return entityType == EntityType.MISC; + } + + public boolean isMob() { + return entityType == EntityType.MOB; + } + + public boolean isPlayer() { + return entityType == EntityType.PLAYER; + } +} \ No newline at end of file diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/MiscDisguise.java b/src/me/libraryaddict/disguise/DisguiseTypes/MiscDisguise.java new file mode 100644 index 00000000..cec66e36 --- /dev/null +++ b/src/me/libraryaddict/disguise/DisguiseTypes/MiscDisguise.java @@ -0,0 +1,9 @@ +package me.libraryaddict.disguise.DisguiseTypes; + +public class MiscDisguise extends Disguise { + + public MiscDisguise(DisguiseType disguiseType) { + super(disguiseType); + } + +} \ No newline at end of file diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/MobDisguise.java b/src/me/libraryaddict/disguise/DisguiseTypes/MobDisguise.java new file mode 100644 index 00000000..531d3230 --- /dev/null +++ b/src/me/libraryaddict/disguise/DisguiseTypes/MobDisguise.java @@ -0,0 +1,40 @@ +package me.libraryaddict.disguise.DisguiseTypes; + +import net.minecraft.server.v1_5_R3.Entity; +import net.minecraft.server.v1_5_R3.EntityAgeable; +import net.minecraft.server.v1_5_R3.EntityLiving; +import net.minecraft.server.v1_5_R3.EntityZombie; +import net.minecraft.server.v1_5_R3.World; + +import org.bukkit.Location; + +public class MobDisguise extends Disguise { + + private boolean adult; + + public MobDisguise(DisguiseType disguiseType, boolean isAdult) { + super(disguiseType); + adult = isAdult; + } + + public EntityLiving getEntityLiving(World w, Location loc, int id) { + Entity entity = getEntity(w, loc, id); + if (!adult) { + if (entity instanceof EntityAgeable) + ((EntityAgeable) entity).setAge(-24000); + else if (entity instanceof EntityZombie) + ((EntityZombie) entity).setBaby(true); + } + if (entity instanceof EntityLiving) + return (EntityLiving) entity; + return null; + } + + public boolean isAdult() { + return adult; + } + + public void setAdult(boolean setAdult) { + adult = setAdult; + } +} \ No newline at end of file diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/PlayerDisguise.java b/src/me/libraryaddict/disguise/DisguiseTypes/PlayerDisguise.java new file mode 100644 index 00000000..610395ee --- /dev/null +++ b/src/me/libraryaddict/disguise/DisguiseTypes/PlayerDisguise.java @@ -0,0 +1,17 @@ +package me.libraryaddict.disguise.DisguiseTypes; + +public class PlayerDisguise extends Disguise { + private String playerName; + + public PlayerDisguise(String name) { + super(DisguiseType.PLAYER); + if (name.length() > 16) + name = name.substring(0, 16); + playerName = name; + } + + public String getName() { + return playerName; + } + +} \ No newline at end of file diff --git a/src/me/libraryaddict/disguise/LibsDisguises.java b/src/me/libraryaddict/disguise/LibsDisguises.java new file mode 100644 index 00000000..ad0c05b8 --- /dev/null +++ b/src/me/libraryaddict/disguise/LibsDisguises.java @@ -0,0 +1,101 @@ +package me.libraryaddict.disguise; + +import java.lang.reflect.Method; +import java.util.List; + +import me.libraryaddict.disguise.DisguiseTypes.Disguise; +import me.libraryaddict.disguise.DisguiseTypes.MiscDisguise; +import me.libraryaddict.disguise.DisguiseTypes.MobDisguise; +import me.libraryaddict.disguise.DisguiseTypes.PlayerDisguise; +import net.minecraft.server.v1_5_R3.DataWatcher; +import net.minecraft.server.v1_5_R3.Entity; +import net.minecraft.server.v1_5_R3.EntityLiving; +import net.minecraft.server.v1_5_R3.EntityPlayer; +import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import com.comphenix.protocol.Packets; +import com.comphenix.protocol.ProtocolLibrary; +import com.comphenix.protocol.events.ConnectionSide; +import com.comphenix.protocol.events.ListenerPriority; +import com.comphenix.protocol.events.PacketAdapter; +import com.comphenix.protocol.events.PacketEvent; +import com.comphenix.protocol.reflect.StructureModifier; + +public class LibsDisguises extends JavaPlugin { + + public void onEnable() { + getCommand("disguise").setExecutor(new DisguiseCommand()); + ProtocolLibrary.getProtocolManager().addPacketListener( + new PacketAdapter(this, ConnectionSide.SERVER_SIDE, ListenerPriority.NORMAL, Packets.Server.NAMED_ENTITY_SPAWN, + Packets.Server.ENTITY_METADATA) { + public void onPacketSending(PacketEvent event) { + StructureModifier mods = event.getPacket().getModifier(); + try { + Player observer = event.getPlayer(); + org.bukkit.entity.Entity entity = event.getPacket().getEntityModifier(observer.getWorld()).read(0); + if (entity instanceof Player) { + Player watched = (Player) entity; + if (DisguiseAPI.isDisguised(watched.getName())) { + Disguise disguise = DisguiseAPI.getDisguise(watched); + if (event.getPacketID() == Packets.Server.NAMED_ENTITY_SPAWN) { + if (disguise.getType().isMob()) { + event.setCancelled(true); + DisguiseAPI.disguiseToPlayer(watched, observer, (MobDisguise) disguise); + } else if (disguise.getType().isMisc()) { + event.setCancelled(true); + DisguiseAPI.disguiseToPlayer(watched, observer, (MiscDisguise) disguise); + } else if (disguise.getType().isPlayer()) { + String name = (String) mods.read(1); + if (!name.equals(((PlayerDisguise) disguise).getName())) { + event.setCancelled(true); + DisguiseAPI.disguiseToPlayer(watched, observer, (PlayerDisguise) disguise); + } + } + } else if (!disguise.getType().isPlayer()) { + mods.write(1, modifyDataWatcher(disguise, watched)); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + + } + + private List modifyDataWatcher(Disguise disguise, Player p) { + Entity e = disguise.getEntity(); + EntityPlayer hE = ((CraftPlayer) p).getHandle(); + e.setAirTicks(hE.getAirTicks()); + e.fireTicks = p.getFireTicks(); + a(e.getDataWatcher(), 0, e.fireTicks > 0); + e.setSprinting(p.isSprinting()); + e.setSneaking(p.isSneaking()); + if (e instanceof EntityLiving) { + EntityLiving lE = (EntityLiving) e; + lE.setInvisible(hE.isInvisible()); + lE.effects = hE.effects; + lE.updateEffects = true; + try { + Method method = EntityLiving.class.getDeclaredMethod("bA"); + method.setAccessible(true); + method.invoke(lE); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + return e.getDataWatcher().b(); + } + + protected void a(DataWatcher datawatcher, int i, boolean flag) { + byte b0 = datawatcher.getByte(0); + if (flag) { + datawatcher.watch(0, Byte.valueOf((byte) (b0 | 1 << i))); + } else { + datawatcher.watch(0, Byte.valueOf((byte) (b0 & ~(1 << i)))); + } + } +} \ No newline at end of file diff --git a/target/LibsDisguises.jar b/target/LibsDisguises.jar new file mode 100644 index 00000000..56fcc2e9 Binary files /dev/null and b/target/LibsDisguises.jar differ diff --git a/target/classes/me/libraryaddict/disguise/DisguiseAPI.class b/target/classes/me/libraryaddict/disguise/DisguiseAPI.class new file mode 100644 index 00000000..1bf79831 Binary files /dev/null and b/target/classes/me/libraryaddict/disguise/DisguiseAPI.class differ diff --git a/target/classes/me/libraryaddict/disguise/DisguiseCommand.class b/target/classes/me/libraryaddict/disguise/DisguiseCommand.class new file mode 100644 index 00000000..451eb96b Binary files /dev/null and b/target/classes/me/libraryaddict/disguise/DisguiseCommand.class differ diff --git a/target/classes/me/libraryaddict/disguise/DisguiseTypes/Disguise.class b/target/classes/me/libraryaddict/disguise/DisguiseTypes/Disguise.class new file mode 100644 index 00000000..c120167b Binary files /dev/null and b/target/classes/me/libraryaddict/disguise/DisguiseTypes/Disguise.class differ diff --git a/target/classes/me/libraryaddict/disguise/DisguiseTypes/DisguiseType$EntityType.class b/target/classes/me/libraryaddict/disguise/DisguiseTypes/DisguiseType$EntityType.class new file mode 100644 index 00000000..24bfd9fe Binary files /dev/null and b/target/classes/me/libraryaddict/disguise/DisguiseTypes/DisguiseType$EntityType.class differ diff --git a/target/classes/me/libraryaddict/disguise/DisguiseTypes/DisguiseType.class b/target/classes/me/libraryaddict/disguise/DisguiseTypes/DisguiseType.class new file mode 100644 index 00000000..e94410f2 Binary files /dev/null and b/target/classes/me/libraryaddict/disguise/DisguiseTypes/DisguiseType.class differ diff --git a/target/classes/me/libraryaddict/disguise/DisguiseTypes/MiscDisguise.class b/target/classes/me/libraryaddict/disguise/DisguiseTypes/MiscDisguise.class new file mode 100644 index 00000000..61e9ce7a Binary files /dev/null and b/target/classes/me/libraryaddict/disguise/DisguiseTypes/MiscDisguise.class differ diff --git a/target/classes/me/libraryaddict/disguise/DisguiseTypes/MobDisguise.class b/target/classes/me/libraryaddict/disguise/DisguiseTypes/MobDisguise.class new file mode 100644 index 00000000..ddc0ce72 Binary files /dev/null and b/target/classes/me/libraryaddict/disguise/DisguiseTypes/MobDisguise.class differ diff --git a/target/classes/me/libraryaddict/disguise/DisguiseTypes/PlayerDisguise.class b/target/classes/me/libraryaddict/disguise/DisguiseTypes/PlayerDisguise.class new file mode 100644 index 00000000..b129fc93 Binary files /dev/null and b/target/classes/me/libraryaddict/disguise/DisguiseTypes/PlayerDisguise.class differ diff --git a/target/classes/me/libraryaddict/disguise/LibsDisguises$1.class b/target/classes/me/libraryaddict/disguise/LibsDisguises$1.class new file mode 100644 index 00000000..e558591d Binary files /dev/null and b/target/classes/me/libraryaddict/disguise/LibsDisguises$1.class differ diff --git a/target/classes/me/libraryaddict/disguise/LibsDisguises.class b/target/classes/me/libraryaddict/disguise/LibsDisguises.class new file mode 100644 index 00000000..24b1a42a Binary files /dev/null and b/target/classes/me/libraryaddict/disguise/LibsDisguises.class differ diff --git a/target/classes/plugin.yml b/target/classes/plugin.yml new file mode 100644 index 00000000..d6c9a054 --- /dev/null +++ b/target/classes/plugin.yml @@ -0,0 +1,8 @@ +name: LibsDisguises +main: me.libraryaddict.disguise.LibsDisguises +version: v1.0 +author: libraryaddict +depend: [ProtocolLib] +commands: + disguise: + aliases: [d, dis] \ No newline at end of file diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 00000000..ea4370c8 --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Sat May 18 09:04:19 NZST 2013 +version=v1.0 +groupId=LibsDisguises +artifactId=LibsDisguises