diff --git a/.classpath b/.classpath
new file mode 100644
index 00000000..149cb3c9
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
new file mode 100644
index 00000000..d9784440
--- /dev/null
+++ b/.project
@@ -0,0 +1,23 @@
+
+
+ LibsDisguises
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000..7a531392
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+encoding/=UTF-8
+encoding/src=UTF-8
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..672496e1
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 00000000..f897a7f1
--- /dev/null
+++ b/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/bin/main/java/me/libraryaddict/disguise/DisguiseAPI.class b/bin/main/java/me/libraryaddict/disguise/DisguiseAPI.class
new file mode 100644
index 00000000..8e626477
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/DisguiseAPI.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/DisguiseConfig.class b/bin/main/java/me/libraryaddict/disguise/DisguiseConfig.class
new file mode 100644
index 00000000..93422639
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/DisguiseConfig.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/DisguiseListener.class b/bin/main/java/me/libraryaddict/disguise/DisguiseListener.class
new file mode 100644
index 00000000..c9e3de03
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/DisguiseListener.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/LibsDisguises.class b/bin/main/java/me/libraryaddict/disguise/LibsDisguises.class
new file mode 100644
index 00000000..823abc02
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/LibsDisguises.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/commands/BaseDisguiseCommand$DisguiseParseException.class b/bin/main/java/me/libraryaddict/disguise/commands/BaseDisguiseCommand$DisguiseParseException.class
new file mode 100644
index 00000000..1029d632
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/commands/BaseDisguiseCommand$DisguiseParseException.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/commands/BaseDisguiseCommand.class b/bin/main/java/me/libraryaddict/disguise/commands/BaseDisguiseCommand.class
new file mode 100644
index 00000000..86745086
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/commands/BaseDisguiseCommand.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/commands/CloneDisguiseCommand.class b/bin/main/java/me/libraryaddict/disguise/commands/CloneDisguiseCommand.class
new file mode 100644
index 00000000..c806016d
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/commands/CloneDisguiseCommand.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/commands/DisguiseCommand.class b/bin/main/java/me/libraryaddict/disguise/commands/DisguiseCommand.class
new file mode 100644
index 00000000..172bcff8
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/commands/DisguiseCommand.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/commands/DisguiseViewSelf.class b/bin/main/java/me/libraryaddict/disguise/commands/DisguiseViewSelf.class
new file mode 100644
index 00000000..f2e59047
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/commands/DisguiseViewSelf.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/commands/EntityDisguiseCommand.class b/bin/main/java/me/libraryaddict/disguise/commands/EntityDisguiseCommand.class
new file mode 100644
index 00000000..fe4c3a42
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/commands/EntityDisguiseCommand.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/commands/HelpDisguiseCommand$EnumHelp.class b/bin/main/java/me/libraryaddict/disguise/commands/HelpDisguiseCommand$EnumHelp.class
new file mode 100644
index 00000000..c73600ee
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/commands/HelpDisguiseCommand$EnumHelp.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/commands/HelpDisguiseCommand.class b/bin/main/java/me/libraryaddict/disguise/commands/HelpDisguiseCommand.class
new file mode 100644
index 00000000..b2bbef17
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/commands/HelpDisguiseCommand.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/commands/LibsDisguisesCommand.class b/bin/main/java/me/libraryaddict/disguise/commands/LibsDisguisesCommand.class
new file mode 100644
index 00000000..940a7015
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/commands/LibsDisguisesCommand.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/commands/PlayerDisguiseCommand.class b/bin/main/java/me/libraryaddict/disguise/commands/PlayerDisguiseCommand.class
new file mode 100644
index 00000000..9a2a36f9
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/commands/PlayerDisguiseCommand.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/commands/RadiusDisguiseCommand.class b/bin/main/java/me/libraryaddict/disguise/commands/RadiusDisguiseCommand.class
new file mode 100644
index 00000000..3e21ccb4
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/commands/RadiusDisguiseCommand.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/commands/UndisguiseCommand.class b/bin/main/java/me/libraryaddict/disguise/commands/UndisguiseCommand.class
new file mode 100644
index 00000000..16bd0f80
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/commands/UndisguiseCommand.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.class b/bin/main/java/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.class
new file mode 100644
index 00000000..a48c6564
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/commands/UndisguisePlayerCommand.class b/bin/main/java/me/libraryaddict/disguise/commands/UndisguisePlayerCommand.class
new file mode 100644
index 00000000..75f7592e
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/commands/UndisguisePlayerCommand.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/commands/UndisguiseRadiusCommand.class b/bin/main/java/me/libraryaddict/disguise/commands/UndisguiseRadiusCommand.class
new file mode 100644
index 00000000..92a18478
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/commands/UndisguiseRadiusCommand.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/AnimalColor.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/AnimalColor.class
new file mode 100644
index 00000000..343e6851
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/AnimalColor.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.class
new file mode 100644
index 00000000..8d061b0f
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.class
new file mode 100644
index 00000000..2b7d5136
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.class
new file mode 100644
index 00000000..71ca1d18
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/MiscDisguise.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/MiscDisguise.class
new file mode 100644
index 00000000..73859d78
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/MiscDisguise.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/MobDisguise.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/MobDisguise.class
new file mode 100644
index 00000000..94404cba
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/MobDisguise.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.class
new file mode 100644
index 00000000..adc5b27e
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/RabbitType.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/RabbitType.class
new file mode 100644
index 00000000..c7a18a8a
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/RabbitType.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/TargetedDisguise$TargetType.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/TargetedDisguise$TargetType.class
new file mode 100644
index 00000000..823ccba3
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/TargetedDisguise$TargetType.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/TargetedDisguise.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/TargetedDisguise.class
new file mode 100644
index 00000000..49dbefdc
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/TargetedDisguise.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/AgeableWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/AgeableWatcher.class
new file mode 100644
index 00000000..fa8c0fe0
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/AgeableWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/AreaEffectCloudWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/AreaEffectCloudWatcher.class
new file mode 100644
index 00000000..32a27b81
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/AreaEffectCloudWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ArmorStandWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ArmorStandWatcher.class
new file mode 100644
index 00000000..0289b7f5
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ArmorStandWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ArrowWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ArrowWatcher.class
new file mode 100644
index 00000000..7372acbe
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ArrowWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/BatWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/BatWatcher.class
new file mode 100644
index 00000000..8cc668fa
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/BatWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/BlazeWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/BlazeWatcher.class
new file mode 100644
index 00000000..20cc552e
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/BlazeWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/BoatWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/BoatWatcher.class
new file mode 100644
index 00000000..6caa59d8
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/BoatWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/CreeperWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/CreeperWatcher.class
new file mode 100644
index 00000000..948dc9ed
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/CreeperWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/DroppedItemWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/DroppedItemWatcher.class
new file mode 100644
index 00000000..dc1dfb44
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/DroppedItemWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/EnderCrystalWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/EnderCrystalWatcher.class
new file mode 100644
index 00000000..dfff2a24
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/EnderCrystalWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/EnderDragonWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/EnderDragonWatcher.class
new file mode 100644
index 00000000..7ca8b1e1
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/EnderDragonWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/EndermanWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/EndermanWatcher.class
new file mode 100644
index 00000000..08c6e588
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/EndermanWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.class
new file mode 100644
index 00000000..9d653f14
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/GhastWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/GhastWatcher.class
new file mode 100644
index 00000000..322981d9
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/GhastWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/GuardianWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/GuardianWatcher.class
new file mode 100644
index 00000000..1e74f646
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/GuardianWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/HorseWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/HorseWatcher.class
new file mode 100644
index 00000000..df794235
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/HorseWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ItemFrameWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ItemFrameWatcher.class
new file mode 100644
index 00000000..43ceab57
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ItemFrameWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.class
new file mode 100644
index 00000000..663cbabd
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/MinecartWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/MinecartWatcher.class
new file mode 100644
index 00000000..f9bc45b9
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/MinecartWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/OcelotWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/OcelotWatcher.class
new file mode 100644
index 00000000..8555d676
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/OcelotWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PaintingWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PaintingWatcher.class
new file mode 100644
index 00000000..d7a6154a
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PaintingWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PigWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PigWatcher.class
new file mode 100644
index 00000000..a25f4543
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PigWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.class
new file mode 100644
index 00000000..526de3f5
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/RabbitWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/RabbitWatcher.class
new file mode 100644
index 00000000..63818b42
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/RabbitWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SheepWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SheepWatcher.class
new file mode 100644
index 00000000..f2a3ce53
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SheepWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ShulkerWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ShulkerWatcher.class
new file mode 100644
index 00000000..50d65544
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ShulkerWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SkeletonWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SkeletonWatcher.class
new file mode 100644
index 00000000..15699834
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SkeletonWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SlimeWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SlimeWatcher.class
new file mode 100644
index 00000000..077aa964
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SlimeWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SplashPotionWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SplashPotionWatcher.class
new file mode 100644
index 00000000..9e2f7d29
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SplashPotionWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/TameableWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/TameableWatcher.class
new file mode 100644
index 00000000..da817276
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/TameableWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/TippedArrowWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/TippedArrowWatcher.class
new file mode 100644
index 00000000..3f72b838
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/TippedArrowWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/VillagerWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/VillagerWatcher.class
new file mode 100644
index 00000000..f919fd13
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/VillagerWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WitchWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WitchWatcher.class
new file mode 100644
index 00000000..96db1e8b
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WitchWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WitherSkullWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WitherSkullWatcher.class
new file mode 100644
index 00000000..2258953d
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WitherSkullWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WitherWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WitherWatcher.class
new file mode 100644
index 00000000..535980d6
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WitherWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WolfWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WolfWatcher.class
new file mode 100644
index 00000000..0735c627
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WolfWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ZombieWatcher.class b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ZombieWatcher.class
new file mode 100644
index 00000000..6a75bb19
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ZombieWatcher.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/events/DisguiseEvent.class b/bin/main/java/me/libraryaddict/disguise/events/DisguiseEvent.class
new file mode 100644
index 00000000..9d520900
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/events/DisguiseEvent.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/events/UndisguiseEvent.class b/bin/main/java/me/libraryaddict/disguise/events/UndisguiseEvent.class
new file mode 100644
index 00000000..433bb78f
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/events/UndisguiseEvent.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/utilities/ClassGetter.class b/bin/main/java/me/libraryaddict/disguise/utilities/ClassGetter.class
new file mode 100644
index 00000000..09adae03
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/utilities/ClassGetter.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/utilities/DisguiseSound$SoundType.class b/bin/main/java/me/libraryaddict/disguise/utilities/DisguiseSound$SoundType.class
new file mode 100644
index 00000000..7c61187c
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/utilities/DisguiseSound$SoundType.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/utilities/DisguiseSound.class b/bin/main/java/me/libraryaddict/disguise/utilities/DisguiseSound.class
new file mode 100644
index 00000000..8e91393a
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/utilities/DisguiseSound.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.class b/bin/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.class
new file mode 100644
index 00000000..8d4d52da
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/utilities/DisguiseValues.class b/bin/main/java/me/libraryaddict/disguise/utilities/DisguiseValues.class
new file mode 100644
index 00000000..d32e04e9
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/utilities/DisguiseValues.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/utilities/FakeBoundingBox.class b/bin/main/java/me/libraryaddict/disguise/utilities/FakeBoundingBox.class
new file mode 100644
index 00000000..1ef02954
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/utilities/FakeBoundingBox.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/utilities/LibsProfileLookup.class b/bin/main/java/me/libraryaddict/disguise/utilities/LibsProfileLookup.class
new file mode 100644
index 00000000..009ca94f
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/utilities/LibsProfileLookup.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/utilities/LibsProfileLookupCaller.class b/bin/main/java/me/libraryaddict/disguise/utilities/LibsProfileLookupCaller.class
new file mode 100644
index 00000000..21ffc755
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/utilities/LibsProfileLookupCaller.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/utilities/Metrics$Graph.class b/bin/main/java/me/libraryaddict/disguise/utilities/Metrics$Graph.class
new file mode 100644
index 00000000..5e6174e0
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/utilities/Metrics$Graph.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/utilities/Metrics$Plotter.class b/bin/main/java/me/libraryaddict/disguise/utilities/Metrics$Plotter.class
new file mode 100644
index 00000000..fdb5e56f
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/utilities/Metrics$Plotter.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/utilities/Metrics.class b/bin/main/java/me/libraryaddict/disguise/utilities/Metrics.class
new file mode 100644
index 00000000..c6ecf4d2
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/utilities/Metrics.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/utilities/PacketsManager.class b/bin/main/java/me/libraryaddict/disguise/utilities/PacketsManager.class
new file mode 100644
index 00000000..7037d2a9
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/utilities/PacketsManager.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/utilities/ReflectionManager.class b/bin/main/java/me/libraryaddict/disguise/utilities/ReflectionManager.class
new file mode 100644
index 00000000..55eac426
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/utilities/ReflectionManager.class differ
diff --git a/bin/main/java/me/libraryaddict/disguise/utilities/UpdateChecker.class b/bin/main/java/me/libraryaddict/disguise/utilities/UpdateChecker.class
new file mode 100644
index 00000000..8cb614ba
Binary files /dev/null and b/bin/main/java/me/libraryaddict/disguise/utilities/UpdateChecker.class differ
diff --git a/src/main/resources/config.yml b/bin/main/resources/config.yml
similarity index 100%
rename from src/main/resources/config.yml
rename to bin/main/resources/config.yml
diff --git a/src/main/resources/plugin.yml b/bin/main/resources/plugin.yml
similarity index 100%
rename from src/main/resources/plugin.yml
rename to bin/main/resources/plugin.yml
diff --git a/build.gradle b/build.gradle
deleted file mode 100644
index dd33abce..00000000
--- a/build.gradle
+++ /dev/null
@@ -1,95 +0,0 @@
-plugins {
- id 'java'
- id 'maven-publish'
-}
-
-println 'Compiling LibsDisguises via Gradle ver. ' + gradle.gradleVersion
-
-sourceCompatibility = '1.7'
-ext.spigotVersion = '1.9-R0.1-SNAPSHOT'
-
-ext.disguisesVersion = '9.0.3'
-
-[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
-
-repositories {
- mavenCentral()
-
- maven {
- name 'Spigot'
- url 'https://hub.spigotmc.org/nexus/content/groups/public/'
- }
-
- maven {
- url 'https://oss.sonatype.org/content/groups/public/'
- }
-
- maven {
- name 'dmulloy2-repo'
- url 'http://repo.dmulloy2.net/content/groups/public/'
- }
-
- flatDir {
- dir 'libs'
- }
-}
-
-task sourceJar(type: Jar, dependsOn: classes) {
- classifier = 'sources'
- from sourceSets.main.allSource
-}
-
-task javadocJar(type: Jar, dependsOn: javadoc) {
- classifier = 'javadoc'
- from javadoc.destinationDir
-}
-
-jar {
- baseName "LibsDisguises"
-}
-
-processResources {
- expand projectVersion: disguisesVersion
-}
-
-artifacts {
- archives sourceJar
- archives javadocJar
- archives jar
-}
-
-publishing {
- publications {
- mavenJava(MavenPublication) {
- groupId 'LibsDisguises'
- artifactId 'LibsDisguises'
- version disguisesVersion + '-SNAPSHOT'
- from components.java
- artifact sourceJar {
- classifier = 'sources'
- }
- artifact javadocJar {
- classifier = 'javadoc'
- }
- }
- }
- repositories {
- maven {
- url "http://repo.md-5.net/content/repositories/releases/"
- }
- maven {
- url "http://repo.md-5.net/content/repositories/snapshots/"
- }
- }
-}
-
-file('libs').mkdirs()
-
-ant.get src: 'http://server.o2gaming.com/downloads/spigot-1.9.jar', dest: file('libs'), verbose: false, skipexisting: true
-
-dependencies {
- compile "org.spigotmc:spigot-api:$project.ext.spigotVersion"
- compile 'com.comphenix.protocol:ProtocolLib:3.7.0-SNAPSHOT'
- compile group: "spigot", name: 'spigot-1.9', version: "1.9"
- testCompile group: 'junit', name: 'junit', version: '4.10'
-}
diff --git a/config.yml b/config.yml
new file mode 100644
index 00000000..282c1e11
--- /dev/null
+++ b/config.yml
@@ -0,0 +1,130 @@
+# Shall I notify people of a LibsDisguises update?
+NotifyUpdate: true
+# Whats the permission to get the notification?
+Permission: 'libsdisguises.update'
+# Whats the max size allowed for command disguiseradius
+DisguiseRadiusMax: 50
+# Whats the max size allowed for command undisguiseradius
+UndisguiseRadiusMax: 50
+# Shall the players view their disguises?
+# Best used when viewing yourself in 3rd person
+ViewSelfDisguises: true
+# Shall I disguise the sounds?
+# This turns your damage sound into a MOOOO
+DisguiseSounds: true
+# Shall the disguised hear their disguise sounds or their damage sounds.
+# I disable this as it can be a little confusing when not used with self disguises
+HearSelfDisguise: true
+# Shall I send the velocity packets? I REALLY recommend you don't disable.
+# This is the only thing allowing the mobs to fly without glitching out.
+SendVelocity: true
+# For self disguises, they need to have the armor and the held item removed
+# Else they see floating armor, floating held items.
+# This turns the items invisible in the disguised players inventory. It does not actually remove them!
+RemoveArmor: true
+RemoveHeldItem: false
+# If you set a disguise to burning, it will no longer be able to be shown as sneaking or invisible.
+# Set this to true if you want the disguise to get the animations of the disguised entity. Such as invisible, on fire, sprinting, sneaking, blocking
+# This is only valid if you set a animation on the disguise itself. Because the entitys animations are applied otherwise.
+AddEntityAnimations: true
+# When a sheep or wolf is right clicked with dye. The client automatically assumes it was successful and displays the sheeps wool or the wolfs collar as dyed.
+# This is a option that either prevents that happening, or it changes their color officially in the plugin so that everyone sees it changed.
+# Its currently set to false which means that the color is not changed and will refresh itself to the player.
+# Please note that this will not remove the dye from their hands. This also does not check if the disguised entity is actually a sheep/wolf and wants a say in its color.
+DyeableSheep: false
+DyeableWolf: false
+# This is only called into action when the disguise is constructed using the commands.
+# And when the disguise supports that. This will not be used at all for plugins constructing the disguises for instance.
+# Such as prophunt. Its also false because its kind of a retarded feature.
+# This is pretty simple. It shows the players displayname (Name as it appears in chat) above their head.
+# This also overrides any custom name they have set in their disguise options.
+ShowNamesAboveDisguises: false
+# This supports the above option.
+# If this is true, then the name shown above the head appears regardless of if you are looking at the disguise directly or not.
+NameAboveHeadAlwaysVisible: true
+# This modifys the bounding box, This is stuff like can a arrow hit them.
+# If you turn this to true, arrows will act like they hit the disguise in the right place!
+# So someone disguised as a enderdragon will easily get shot down by arrows!
+# This WILL conflict with NoCheatPlus. Other plugins may also get problems.
+# This shouldn't really be enabled for players as it also interferes with their movement because the server thinks the player is larger than he really is.
+# That makes the player unable to approach this building because the server thinks he is trying to glitch inside blocks.
+ModifyBoundingBox: false
+# This prevents disguised players from being targeted by monsters.
+# This doesn't prevent their targeting you if already targeting when disguised
+# They will just ignore you unless provoked.
+MonstersIgnoreDisguises: false
+# Sigh. People are going to want this.
+# So lets make your disguise blown if you are attacked..
+# Works only for disguised players when attacked by a entity (arrow, monster. etc)
+# This will blow all disguises he has on him
+BlowDisguises: false
+BlownDisguiseMessage: '&cYour disguise was blown!'
+
+#Stop shulker disguises from moving, they're weird. This option only effects PLAYERS that are disguised, other entities disguised as shulkers will NOT be effected!
+StopShulkerDisguisesFromMoving: true
+
+# A option to choose how many seconds a DisguiseEntity command is valid for people to right click a entity to disguise it before expiring
+DisguiseEntityExpire: 10
+
+# Another option to choose the same thing for DisguiseClone command
+DisguiseCloneExpire: 10
+# Max disguises to store at a time with the DisguiseClone command
+DisguiseCloneSize: 3
+
+# This I don't really recommend turning on as it can make a memory leak..
+# These disguises, as normal will not persist after a server restart.
+# There is also no EntityDeath option as entities do not revive after death.
+KeepDisguises:
+ EntityDespawn: false
+ PlayerDeath: false
+ PlayerLogout: false
+
+# This controls if a entitys max health is determined by the entity, or by the disguise.
+# Wither is 200, a player is 20. With this enabled, a player disguised as a wither will have the boss bar health accurate to the players health.
+# Else it will be 1/20 of the boss bar when he is full health.
+# Setting this in LivingWatcher overrides both values.
+MaxHealthDeterminedByEntity: true
+
+# This here is a option to turn off misc disguises.
+# This means you can not have a living entity disguise as a non-living entity.
+# This disables the Attributes packet, Non-living entities can still disguise as other non-living
+# This means that the above option will not work as it uses the attribute packet.
+MiscDisguisesForLiving: true
+
+# Turn this to true to have players undisguised when switching worlds
+UndisguiseOnWorldChange: false
+
+# Contact Mojang's servers? Disabling this option will disable player skin disguises!
+ContactMojangServers: true
+
+# This will help performance, especially with CPU
+# Due to safety reasons, self disguises can never have their packets disabled.
+PacketsEnabled:
+ # This disables the animation packet. If a disguised entity sends a animation packet and they are using a non-living disguise. People will crash.
+ # Disabling this also means that if a player disguised as a non-player leaves a bug. People will crash
+ Animation: true
+ # Disabling this means that you can't use the setSleeping option on a player disguise. Also you will crash anyone watching when you try to sleep in a bed if disguised as a non-player
+ # This also sends a chunk packet at key positions else it doesn't work for 1.8. Lazyness means it does it for older versions too currently.
+ Bed: true
+ # This disguises the collect packet. If a living entity disguised as a non-living entity picks up a item. People will crash. This fixes it
+ # This also fixes people crashing if a item disguised as a sleeping player is picked up - Only true if Bed is enabled as well
+ Collect: true
+ # This disables a fix for when a disguised entity wearing armor dies, if the disguise can wear armor. It drops unpickupable items to anyone watching.
+ EntityStatus: true
+ # Entity equipment is the packets that are sent to ensure that a disguise has or doesn't have armor, and their held item.
+ # Disabling this means that any disguises which can wear armor or hold items will show the armor/held item that the disguised is wearing.
+ Equipment: true
+ # This doesn't actually disable the packet. It would introduce problems. Instead it does the next best thing and caches the data.
+ # This means that entity metadata will not change, and will only be sent in the spawn packet.
+ # This is good if performance is extremely in need.
+ # This is bad to disable unless you are ONLY going to use the disguises for decorations.
+ # To be honest. This is basically "Disable entity animations". That option is called 'AddEntityAnimations' in the config but unlike that, this is always in effect.
+ # Animations set by use of the api or through the disguise command are still in effect.
+ Metadata: true
+ # Movement packets are the biggest cpu hit. These are majorly used to ensure that the disguises facing direction isn't bugged up.
+ # If you are using the Item_Frame disguise, when a packet is sent (Roughly every 2min) the disguise will bug up until they move.
+ Movement: true
+ # Disable this if you don't mind crashing everytime you see someone riding something disguised as a non-living entity
+ Riding: true
+ # When disguised as a wither skull, it sends a look packet every tick so that the wither skull is facing the right way.
+ WitherSkull: true
diff --git a/plugin.yml b/plugin.yml
new file mode 100644
index 00000000..bb923226
--- /dev/null
+++ b/plugin.yml
@@ -0,0 +1,103 @@
+name: LibsDisguises
+main: me.libraryaddict.disguise.LibsDisguises
+description: A disguise plugin with various disguises.
+version: ${project.version}
+author: libraryaddict
+authors: [Byteflux, Navid K.]
+softdepend: [ProtocolLib]
+commands:
+ libsdisguises:
+ permission: libsdisguises.seecmd.libsdisguises
+ description: Main command for libsdisguises.
+ disguise:
+ aliases: [d, dis]
+ permission: libsdisguises.seecmd.disguise
+ description: Disguise yourself as an entity.
+ disguiseentity:
+ aliases: [dentity, disentity]
+ permission: libsdisguises.seecmd.disguiseentity
+ description: Disguise an entity as another entity.
+ disguisehelp:
+ aliases: [dhelp, dishelp]
+ permission: libsdisguises.seecmd.disguisehelp
+ description: Help command for LibsDisguises.
+ disguiseplayer:
+ aliases: [dplayer, displayer]
+ permission: libsdisguises.seecmd.disguiseplayer
+ description: Disguise another player as an entity.
+ disguiseradius:
+ aliases: [disradius, dradius]
+ permission: libsdisguises.seecmd.disguiseradius
+ description: Disguise all entities within a radius as an entity.
+ undisguise:
+ aliases: [u, und, undis]
+ permission: libsdisguises.seecmd.undisguise
+ description: Undisguise yourself.
+ undisguiseentity:
+ aliases: [undisentity, undentity]
+ permission: libsdisguises.seecmd.undisguiseentity
+ description: Undisguise an entity.
+ undisguiseplayer:
+ aliases: [undisplayer, undplayer]
+ permission: libsdisguises.seecmd.undisguiseplayer
+ description: Undisguise a player.
+ undisguiseradius:
+ aliases: [undisradius, undradius]
+ permission: libsdisguises.seecmd.undisguiseradius
+ description: Undisguise all entities within a radius.
+ disguiseclone:
+ aliases: [disguisec, disc, disclone, dclone, clonedisguise, clonedis, cdisguise, cdis]
+ permission: libsdisguises.seecmd.disguiseclone
+ description: Copy a disguise (or entity) and use it later.
+ disguiseviewself:
+ aliases: [dviewself, dvs, disguisevs, disvs, vsd, viewselfdisguise, viewselfd]
+ permission: libsdisguises.seecmd.viewself
+ description: Toggle seeing your own disguise on or off.
+
+permissions:
+ libsdisguises.reload:
+ description: Allows the user to reload LibsDisguises.
+ default: op
+ libsdisguises.seethrough:
+ description: Allows player to see through disguises.
+ default: false
+ libsdisguises.seecmd:
+ description: See all commands in tab-completion
+ default: true
+ children:
+ libsdisguises.seecmd.libsdisguises: true
+ libsdisguises.seecmd.disguise: true
+ libsdisguises.seecmd.disguiseentity: true
+ libsdisguises.seecmd.disguisehelp: true
+ libsdisguises.seecmd.disguiseplayer: true
+ libsdisguises.seecmd.disguiseradius: true
+ libsdisguises.seecmd.undisguise: true
+ libsdisguises.seecmd.undisguiseentity: true
+ libsdisguises.seecmd.undisguiseplayer: true
+ libsdisguises.seecmd.undisguiseradius: true
+ libsdisguises.seecmd.disguiseclone: true
+ libsdisguises.seecmd.disguiseviewself: true
+ libsdisguises.seecmd.libsdisguises:
+ description: See the /libsdisguises command in tab-completion
+ libsdisguises.seecmd.disguiseviewself:
+ description: See the /disguiseviewself command in tab-completion
+ libsdisguises.seecmd.disguise:
+ description: See the /disguise command in tab-completion
+ libsdisguises.seecmd.disguiseentity:
+ description: See the /disguiseentity command in tab-completion
+ libsdisguises.seecmd.disguisehelp:
+ description: See the /disguisehelp command in tab-completion
+ libsdisguises.seecmd.disguiseplayer:
+ description: See the /disguiseplayer command in tab-completion
+ libsdisguises.seecmd.disguiseradius:
+ description: See the /disguiseradius command in tab-completion
+ libsdisguises.seecmd.undisguise:
+ description: See the /undisguise command in tab-completion
+ libsdisguises.seecmd.undisguiseentity:
+ description: See the /undisguiseentity command in tab-completion
+ libsdisguises.seecmd.undisguiseplayer:
+ description: See the /undisguiseplayer command in tab-completion
+ libsdisguises.seecmd.undisguiseradius:
+ description: See the /undisguiseradius command in tab-completion
+ libsdisguises.seecmd.disguiseclone:
+ description: See the /disguiseclone command in tab-completion
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 00000000..dea38eac
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,74 @@
+
+ 4.0.0
+ LibsDisguises
+ LibsDisguises
+ 0.0.1-SNAPSHOT
+
+
+ src
+ clean install
+ target
+ LibsDisguises
+
+
+
+ .
+ true
+ ${project.basedir}
+
+ plugin.yml
+ config.yml
+ README.md
+
+
+
+
+
+
+
+ 1.8
+ 1.8
+ UTF-8
+
+
+
+
+ dmulloy2-repo
+ http://repo.dmulloy2.net/content/groups/public/
+
+
+ spigot-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
+
+
+
+
+ com.comphenix.protocol
+ ProtocolLib
+ 4.0.0-SNAPSHOT
+
+
+ org.spigotmc
+ spigot-api
+ 1.9.2-R0.1-SNAPSHOT
+
+
+ org.spigotmc
+ spigot
+ 1.9.2-R0.1-SNAPSHOT
+
+
+
+
+
+ md_5-releases
+ http://repo.md-5.net/content/repositories/releases/
+
+
+ md_5-snapshots
+ http://repo.md-5.net/content/repositories/snapshots/
+
+
+
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
deleted file mode 100644
index f0b731cb..00000000
--- a/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-rootProject.name = 'LibsDisguises'
diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.java
deleted file mode 100644
index 16659ad3..00000000
--- a/src/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.java
+++ /dev/null
@@ -1,290 +0,0 @@
-package me.libraryaddict.disguise.disguisetypes;
-
-import org.apache.commons.lang.StringUtils;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Guardian;
-import org.bukkit.entity.Horse;
-import org.bukkit.entity.Skeleton;
-import org.bukkit.entity.Zombie;
-
-import java.lang.reflect.Method;
-
-public enum DisguiseType {
-
- AREA_EFFECT_CLOUD(3, 0),
- ARMOR_STAND(78),
- ARROW(60, 0),
- BAT,
- BLAZE,
- BOAT(1),
- CAVE_SPIDER,
- CHICKEN,
- COW,
- CREEPER,
- DONKEY,
- DRAGON_FIREBALL(93),
- DROPPED_ITEM(2, 1),
- EGG(62),
- ELDER_GUARDIAN,
- ENDER_CRYSTAL(51),
- ENDER_DRAGON,
- ENDER_PEARL(65),
- ENDER_SIGNAL(72),
- ENDERMAN,
- ENDERMITE,
- EXPERIENCE_ORB,
- FALLING_BLOCK(70, 1),
- FIREBALL(63),
- FIREWORK(76),
- FISHING_HOOK(90),
- GHAST,
- GIANT,
- GUARDIAN,
- HORSE,
- IRON_GOLEM,
- ITEM_FRAME(71),
- LEASH_HITCH(77),
- MAGMA_CUBE,
- MINECART(10),
- MINECART_CHEST(10, 1),
- MINECART_COMMAND(10, 6),
- MINECART_FURNACE(10, 2),
- MINECART_HOPPER(10, 5),
- MINECART_MOB_SPAWNER(10, 4),
- MINECART_TNT(10, 3),
- MULE,
- MUSHROOM_COW,
- OCELOT,
- PAINTING,
- PIG,
- PIG_ZOMBIE,
- PLAYER,
- PRIMED_TNT(50),
- RABBIT,
- SHEEP,
- SHULKER,
- SHULKER_BULLET(67),
- SILVERFISH,
- SKELETON,
- SKELETON_HORSE,
- SLIME,
- SMALL_FIREBALL(63),
- SNOWBALL(61),
- SNOWMAN,
- SPECTRAL_ARROW(91),
- SPIDER,
- SPLASH_POTION(73, 0),
- SQUID,
- TIPPED_ARROW(92),
- THROWN_EXP_BOTTLE(75),
- UNDEAD_HORSE,
- VILLAGER,
- WITCH,
- WITHER,
- WITHER_SKELETON,
- WITHER_SKULL(66),
- WOLF,
- ZOMBIE,
- ZOMBIE_VILLAGER,
- UNKNOWN;
-
- private static Method isVillager, getVariant, getSkeletonType, isElder;
-
- static {
- // We set the entity type in this so that we can safely ignore disguisetypes which don't exist in older versions of MC.
- // Without erroring up everything.
- for (DisguiseType type : values()) {
- try {
- DisguiseType toUse = type;
- String name;
- switch (type) {
- // Disguise item frame isn't supported. So we don't give it a entity type which should prevent it from being..
- // Usable.
- case ITEM_FRAME:
- break;
- case DONKEY:
- case MULE:
- case UNDEAD_HORSE:
- case SKELETON_HORSE:
- toUse = DisguiseType.HORSE;
- break;
- case ZOMBIE_VILLAGER:
- toUse = DisguiseType.ZOMBIE;
- break;
- case WITHER_SKELETON:
- toUse = DisguiseType.SKELETON;
- break;
- case ELDER_GUARDIAN:
- toUse = DisguiseType.GUARDIAN;
- break;
- default:
- break;
- }
- name = toUse.name();
- type.setEntityType(EntityType.valueOf(name));
- } catch (Throwable ex) {
- // This version of Spigot doesn't have the disguise.
- }
- }
- try {
- isVillager = Zombie.class.getMethod("isVillager");
- } catch (Throwable ignored) {
- }
- try {
- getVariant = Horse.class.getMethod("getVariant");
- } catch (Throwable ignored) {
- // Pre-1.6, but that isn't even supported
- }
- try {
- getSkeletonType = Skeleton.class.getMethod("getSkeletonType");
- } catch (Throwable ignored) {
- }
- try {
- isElder = Guardian.class.getMethod("isElder");
- } catch (Throwable ignored) {
- }
- }
-
- public static DisguiseType getType(Entity entity) {
- DisguiseType disguiseType = getType(entity.getType());
- switch (disguiseType) {
- case ZOMBIE:
- try {
- if ((Boolean) isVillager.invoke(entity)) {
- disguiseType = DisguiseType.ZOMBIE_VILLAGER;
- }
- } catch (Exception ex) {
- ex.printStackTrace(System.out);
- }
- break;
- case HORSE:
- try {
- Object variant = getVariant.invoke(entity);
- disguiseType = DisguiseType.valueOf(((Enum) variant).name());
- } catch (Exception ex) {
- ex.printStackTrace(System.out);
- }
- break;
- case SKELETON:
- try {
- Object type = getSkeletonType.invoke(entity);
- if (type == Skeleton.SkeletonType.WITHER) {
- disguiseType = DisguiseType.WITHER_SKELETON;
- }
- } catch (Exception ex) {
- ex.printStackTrace(System.out);
- }
- break;
- case GUARDIAN:
- try {
- if ((Boolean) isElder.invoke(entity)) {
- disguiseType = DisguiseType.ELDER_GUARDIAN;
- }
- } catch (Exception ex) {
- ex.printStackTrace(System.out);
- }
- break;
- default:
- break;
- }
- return disguiseType;
- }
-
- public static DisguiseType getType(EntityType entityType) {
- try {
- return valueOf(entityType.name().toUpperCase());
- } catch (Throwable ex) {
- return DisguiseType.UNKNOWN;
- }
- }
-
- private int objectId = -1, defaultData = 0;
- private EntityType entityType;
- private Class extends FlagWatcher> watcherClass;
-
- DisguiseType(int... ints) {
- for (int i = 0; i < ints.length; i++) {
- int value = ints[i];
- switch (i) {
- case 0:
- objectId = value;
- break;
- case 1:
- defaultData = value;
- break;
- default:
- break;
- }
- }
- }
-
- public int getDefaultData() {
- return defaultData;
- }
-
- public Class extends Entity> getEntityClass() {
- if (entityType != null) {
- return getEntityType().getEntityClass();
- }
- return Entity.class;
- }
-
- public EntityType getEntityType() {
- return entityType;
- }
-
- /**
- * The TYPE id of this entity. Different from the Object Id
- * send in spawn packets when spawning miscs.
- * @return
- */
- public int getTypeId() {
- return (int) getEntityType().getTypeId();
- }
-
- /**
- * The object type send in packets when spawning a misc entity.
- * Otherwise, -1.
- * @return
- */
- public int getObjectId() {
- return objectId;
- }
-
- public Class getWatcherClass() {
- return watcherClass;
- }
-
- public boolean isMisc() {
- return getEntityType() != null && !getEntityType().isAlive();
- }
-
- public boolean isMob() {
- return getEntityType() != null && getEntityType().isAlive() && !isPlayer();
- }
-
- public boolean isPlayer() {
- return this == DisguiseType.PLAYER;
- }
-
- public boolean isUnknown() {
- return this == DisguiseType.UNKNOWN;
- }
-
- private void setEntityType(EntityType entityType) {
- this.entityType = entityType;
- }
-
- public void setWatcherClass(Class extends FlagWatcher> c) {
- watcherClass = c;
- }
-
- public String toReadable() {
- String[] split = name().split("_");
- for (int i = 0; i < split.length; i++) {
- split[i] = split[i].substring(0, 1) + split[i].substring(1).toLowerCase();
- }
- return StringUtils.join(split, " ");
- }
-}
diff --git a/src/main/java/me/libraryaddict/disguise/DisguiseAPI.java b/src/me/libraryaddict/disguise/DisguiseAPI.java
similarity index 69%
rename from src/main/java/me/libraryaddict/disguise/DisguiseAPI.java
rename to src/me/libraryaddict/disguise/DisguiseAPI.java
index 34802a75..2d73871c 100644
--- a/src/main/java/me/libraryaddict/disguise/DisguiseAPI.java
+++ b/src/me/libraryaddict/disguise/DisguiseAPI.java
@@ -1,5 +1,24 @@
package me.libraryaddict.disguise;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+
+import org.bukkit.DyeColor;
+import org.bukkit.Material;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Horse;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.EntityEquipment;
+import org.bukkit.inventory.HorseInventory;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+
import me.libraryaddict.disguise.disguisetypes.AnimalColor;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
@@ -13,120 +32,158 @@ import me.libraryaddict.disguise.disguisetypes.watchers.HorseWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.ReflectionManager;
-import org.bukkit.DyeColor;
-import org.bukkit.Material;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Horse;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.EntityEquipment;
-import org.bukkit.inventory.HorseInventory;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
-
-public class DisguiseAPI {
-
- public static Disguise constructDisguise(Entity entity) {
+public class DisguiseAPI
+{
+ public static Disguise constructDisguise(Entity entity)
+ {
return constructDisguise(entity, true, true, true);
}
- public static Disguise constructDisguise(Entity entity, boolean doEquipment, boolean doSneak, boolean doSprint) {
+ public static Disguise constructDisguise(Entity entity, boolean doEquipment, boolean doSneak, boolean doSprint)
+ {
DisguiseType disguiseType = DisguiseType.getType(entity);
Disguise disguise;
- if (disguiseType.isMisc()) {
+
+ if (disguiseType.isMisc())
+ {
disguise = new MiscDisguise(disguiseType);
- } else if (disguiseType.isMob()) {
+ }
+ else if (disguiseType.isMob())
+ {
disguise = new MobDisguise(disguiseType);
- } else {
+ }
+ else
+ {
disguise = new PlayerDisguise(entity.getName());
}
+
FlagWatcher watcher = disguise.getWatcher();
- if (entity instanceof LivingEntity) {
- for (PotionEffect effect : ((LivingEntity) entity).getActivePotionEffects()) {
+
+ if (entity instanceof LivingEntity)
+ {
+ for (PotionEffect effect : ((LivingEntity) entity).getActivePotionEffects())
+ {
((LivingWatcher) watcher).addPotionEffect(effect.getType());
- if (effect.getType() == PotionEffectType.INVISIBILITY) {
+
+ if (effect.getType() == PotionEffectType.INVISIBILITY)
+ {
watcher.setInvisible(true);
- } else if (effect.getType() == PotionEffectType.GLOWING) {
+ }
+ else if (effect.getType() == PotionEffectType.GLOWING)
+ {
watcher.setGlowing(true);
}
}
}
- if (entity.getFireTicks() > 0) {
+
+ if (entity.getFireTicks() > 0)
+ {
watcher.setBurning(true);
}
- if (doEquipment && entity instanceof LivingEntity) {
+
+ if (doEquipment && entity instanceof LivingEntity)
+ {
EntityEquipment equip = ((LivingEntity) entity).getEquipment();
+
watcher.setArmor(equip.getArmorContents());
watcher.setItemInMainHand(equip.getItemInMainHand());
- if (disguiseType.getEntityType() == EntityType.HORSE) {
+
+ if (disguiseType.getEntityType() == EntityType.HORSE)
+ {
Horse horse = (Horse) entity;
HorseInventory horseInventory = horse.getInventory();
ItemStack saddle = horseInventory.getSaddle();
- if (saddle != null && saddle.getType() == Material.SADDLE) {
+
+ if (saddle != null && saddle.getType() == Material.SADDLE)
+ {
((HorseWatcher) watcher).setSaddled(true);
}
+
((HorseWatcher) watcher).setHorseArmor(horseInventory.getArmor());
}
}
- for (Method method : entity.getClass().getMethods()) {
+ for (Method method : entity.getClass().getMethods())
+ {
if ((doSneak || !method.getName().equals("setSneaking")) && (doSprint || !method.getName().equals("setSprinting"))
- && method.getParameterTypes().length == 0 && method.getReturnType() != void.class) {
+ && method.getParameterTypes().length == 0 && method.getReturnType() != void.class)
+ {
Class methodReturn = method.getReturnType();
- if (methodReturn == float.class || methodReturn == Float.class || methodReturn == Double.class) {
+
+ if (methodReturn == float.class || methodReturn == Float.class || methodReturn == Double.class)
+ {
methodReturn = double.class;
}
+
int firstCapitalMethod = firstCapital(method.getName());
- if (firstCapitalMethod > 0) {
- for (Method watcherMethod : watcher.getClass().getMethods()) {
+
+ if (firstCapitalMethod > 0)
+ {
+ for (Method watcherMethod : watcher.getClass().getMethods())
+ {
if (!watcherMethod.getName().startsWith("get") && watcherMethod.getReturnType() == void.class
- && watcherMethod.getParameterTypes().length == 1) {
+ && watcherMethod.getParameterTypes().length == 1)
+ {
int firstCapitalWatcher = firstCapital(watcherMethod.getName());
- if (firstCapitalWatcher > 0
- && method.getName().substring(firstCapitalMethod)
- .equalsIgnoreCase(watcherMethod.getName().substring(firstCapitalWatcher))) {
+
+ if (firstCapitalWatcher > 0 && method.getName().substring(firstCapitalMethod)
+ .equalsIgnoreCase(watcherMethod.getName().substring(firstCapitalWatcher)))
+ {
Class methodParam = watcherMethod.getParameterTypes()[0];
- if (methodParam == float.class || methodParam == Float.class || methodParam == Double.class) {
+
+ if (methodParam == float.class || methodParam == Float.class || methodParam == Double.class)
+ {
methodParam = double.class;
- } else if (methodParam == AnimalColor.class) {
+ }
+ else if (methodParam == AnimalColor.class)
+ {
methodParam = DyeColor.class;
}
- if (methodReturn == methodParam) {
- try {
+ if (methodReturn == methodParam)
+ {
+ try
+ {
Object value = method.invoke(entity);
- if (value != null) {
+ if (value != null)
+ {
Class toCast = watcherMethod.getParameterTypes()[0];
- if (!(toCast.isInstance(value))) {
- if (toCast == float.class) {
- if (value instanceof Float) {
+ if (!(toCast.isInstance(value)))
+ {
+ if (toCast == float.class)
+ {
+ if (value instanceof Float)
+ {
value = value;
- } else {
+ }
+ else
+ {
double d = (Double) value;
value = (float) d;
}
- } else if (toCast == double.class) {
- if (!(value instanceof Double)) {
+ }
+ else if (toCast == double.class)
+ {
+ if (!(value instanceof Double))
+ {
float d = (Float) value;
value = (double) d;
}
- } else if (toCast == AnimalColor.class) {
+ }
+ else if (toCast == AnimalColor.class)
+ {
value = AnimalColor.valueOf(((DyeColor) value).name());
}
}
if (value instanceof Boolean && !(Boolean) value
- && watcherMethod.getDeclaringClass() == FlagWatcher.class) {
+ && watcherMethod.getDeclaringClass() == FlagWatcher.class)
+ {
continue;
}
}
watcherMethod.invoke(watcher, value);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace(System.out);
}
}
@@ -139,54 +196,73 @@ public class DisguiseAPI {
return disguise;
}
- public static void disguiseEntity(Entity entity, Disguise disguise) {
+ public static void disguiseEntity(Entity entity, Disguise disguise)
+ {
// If they are trying to disguise a null entity or use a null disguise
// Just return.
- if (entity == null || disguise == null) {
+ if (entity == null || disguise == null)
+ {
return;
}
// The event wasn't cancelled.
// If the disguise entity isn't the same as the one we are disguising
- if (disguise.getEntity() != entity) {
+ if (disguise.getEntity() != entity)
+ {
// If the disguise entity actually exists
- if (disguise.getEntity() != null) {
+ if (disguise.getEntity() != null)
+ {
// Clone the disguise
disguise = disguise.clone();
}
// Set the disguise's entity
disguise.setEntity(entity);
}
- if (Disguise.getViewSelf().contains(disguise.getEntity().getUniqueId())) {
+
+ if (Disguise.getViewSelf().contains(disguise.getEntity().getUniqueId()))
+ {
disguise.setViewSelfDisguise(true);
}
+
disguise.startDisguise();
}
- public static void disguiseIgnorePlayers(Entity entity, Disguise disguise, Collection playersToNotSeeDisguise) {
- if (disguise.getEntity() != null) {
+ public static void disguiseIgnorePlayers(Entity entity, Disguise disguise, Collection playersToNotSeeDisguise)
+ {
+ if (disguise.getEntity() != null)
+ {
disguise = disguise.clone();
}
+
((TargetedDisguise) disguise).setDisguiseTarget(TargetType.SHOW_TO_EVERYONE_BUT_THESE_PLAYERS);
- for (Object obj : playersToNotSeeDisguise) {
- if (obj instanceof String) {
+
+ for (Object obj : playersToNotSeeDisguise)
+ {
+ if (obj instanceof String)
+ {
((TargetedDisguise) disguise).addPlayer((String) obj);
- } else if (obj instanceof Player) {
+ }
+ else if (obj instanceof Player)
+ {
((TargetedDisguise) disguise).addPlayer(((Player) obj).getName());
}
}
+
disguiseEntity(entity, disguise);
}
@Deprecated
- public static void disguiseIgnorePlayers(Entity entity, Disguise disguise, List playersToNotSeeDisguise) {
+ public static void disguiseIgnorePlayers(Entity entity, Disguise disguise, List playersToNotSeeDisguise)
+ {
disguiseIgnorePlayers(entity, disguise, (Collection) playersToNotSeeDisguise);
}
- public static void disguiseIgnorePlayers(Entity entity, Disguise disguise, Player... playersToNotSeeDisguise) {
+ public static void disguiseIgnorePlayers(Entity entity, Disguise disguise, Player... playersToNotSeeDisguise)
+ {
disguiseIgnorePlayers(entity, disguise, (Collection) Arrays.asList(playersToNotSeeDisguise));
}
- public static void disguiseIgnorePlayers(Entity entity, Disguise disguise, String... playersToNotSeeDisguise) {
+ public static void disguiseIgnorePlayers(Entity entity, Disguise disguise, String... playersToNotSeeDisguise)
+ {
disguiseIgnorePlayers(entity, disguise, (Collection) Arrays.asList(playersToNotSeeDisguise));
}
@@ -196,20 +272,29 @@ public class DisguiseAPI {
* @param disguise
* @return
*/
- public static int disguiseNextEntity(Disguise disguise) {
- if (disguise == null) {
+ public static int disguiseNextEntity(Disguise disguise)
+ {
+ if (disguise == null)
+ {
return -1;
}
- if (disguise.getEntity() != null || DisguiseUtilities.getDisguises().containsValue(disguise)) {
+
+ if (disguise.getEntity() != null || DisguiseUtilities.getDisguises().containsValue(disguise))
+ {
disguise = disguise.clone();
}
- try {
+
+ try
+ {
int id = ReflectionManager.getNmsField("Entity", "entityCount").getInt(null);
DisguiseUtilities.addFutureDisguise(id, (TargetedDisguise) disguise);
return id;
- } catch (IllegalAccessException e) {
+ }
+ catch (IllegalAccessException e)
+ {
e.printStackTrace();
}
+
return -1;
}
@@ -219,52 +304,73 @@ public class DisguiseAPI {
* @param entity
* @param disguise
*/
- public static void disguiseToAll(Entity entity, Disguise disguise) {
- if (disguise.getEntity() != null) {
+ public static void disguiseToAll(Entity entity, Disguise disguise)
+ {
+ if (disguise.getEntity() != null)
+ {
disguise = disguise.clone();
}
+
// You called the disguiseToAll method foolish mortal! Prepare to have your custom settings wiped!!!
((TargetedDisguise) disguise).setDisguiseTarget(TargetType.SHOW_TO_EVERYONE_BUT_THESE_PLAYERS);
- for (String observer : ((TargetedDisguise) disguise).getObservers()) {
+
+ for (String observer : ((TargetedDisguise) disguise).getObservers())
+ {
((TargetedDisguise) disguise).removePlayer(observer);
}
disguiseEntity(entity, disguise);
}
- public static void disguiseToPlayers(Entity entity, Disguise disguise, Collection playersToViewDisguise) {
- if (disguise.getEntity() != null) {
+ public static void disguiseToPlayers(Entity entity, Disguise disguise, Collection playersToViewDisguise)
+ {
+ if (disguise.getEntity() != null)
+ {
disguise = disguise.clone();
}
+
((TargetedDisguise) disguise).setDisguiseTarget(TargetType.HIDE_DISGUISE_TO_EVERYONE_BUT_THESE_PLAYERS);
- for (Object obj : playersToViewDisguise) {
- if (obj instanceof String) {
+
+ for (Object obj : playersToViewDisguise)
+ {
+ if (obj instanceof String)
+ {
((TargetedDisguise) disguise).addPlayer((String) obj);
- } else if (obj instanceof Player) {
+ }
+ else if (obj instanceof Player)
+ {
((TargetedDisguise) disguise).addPlayer(((Player) obj).getName());
}
}
+
disguiseEntity(entity, disguise);
}
@Deprecated
- public static void disguiseToPlayers(Entity entity, Disguise disguise, List playersToViewDisguise) {
+ public static void disguiseToPlayers(Entity entity, Disguise disguise, List playersToViewDisguise)
+ {
disguiseToPlayers(entity, disguise, (Collection) playersToViewDisguise);
}
- public static void disguiseToPlayers(Entity entity, Disguise disguise, Player... playersToViewDisguise) {
+ public static void disguiseToPlayers(Entity entity, Disguise disguise, Player... playersToViewDisguise)
+ {
disguiseToPlayers(entity, disguise, (Collection) Arrays.asList(playersToViewDisguise));
}
- public static void disguiseToPlayers(Entity entity, Disguise disguise, String... playersToViewDisguise) {
+ public static void disguiseToPlayers(Entity entity, Disguise disguise, String... playersToViewDisguise)
+ {
disguiseToPlayers(entity, disguise, (Collection) Arrays.asList(playersToViewDisguise));
}
- private static int firstCapital(String str) {
- for (int i = 0; i < str.length(); i++) {
- if (Character.isUpperCase(str.charAt(i))) {
+ private static int firstCapital(String str)
+ {
+ for (int i = 0; i < str.length(); i++)
+ {
+ if (Character.isUpperCase(str.charAt(i)))
+ {
return i;
}
}
+
return -1;
}
@@ -274,10 +380,13 @@ public class DisguiseAPI {
* @param disguised
* @return
*/
- public static Disguise getDisguise(Entity disguised) {
- if (disguised == null) {
+ public static Disguise getDisguise(Entity disguised)
+ {
+ if (disguised == null)
+ {
return null;
}
+
return DisguiseUtilities.getMainDisguise(disguised.getUniqueId());
}
@@ -288,10 +397,13 @@ public class DisguiseAPI {
* @param disguised
* @return
*/
- public static Disguise getDisguise(Player observer, Entity disguised) {
- if (disguised == null || observer == null) {
+ public static Disguise getDisguise(Player observer, Entity disguised)
+ {
+ if (disguised == null || observer == null)
+ {
return null;
}
+
return DisguiseUtilities.getDisguise(observer, disguised);
}
@@ -301,10 +413,13 @@ public class DisguiseAPI {
* @param disguised
* @return
*/
- public static Disguise[] getDisguises(Entity disguised) {
- if (disguised == null) {
+ public static Disguise[] getDisguises(Entity disguised)
+ {
+ if (disguised == null)
+ {
return null;
}
+
return DisguiseUtilities.getDisguises(disguised.getUniqueId());
}
@@ -315,11 +430,13 @@ public class DisguiseAPI {
* @return
*/
@Deprecated
- public static int getFakeDisguise(UUID entityId) {
+ public static int getFakeDisguise(UUID entityId)
+ {
return -10;
}
- public static int getSelfDisguiseId() {
+ public static int getSelfDisguiseId()
+ {
return -10;
}
@@ -329,7 +446,8 @@ public class DisguiseAPI {
* @param disguised
* @return
*/
- public static boolean isDisguised(Entity disguised) {
+ public static boolean isDisguised(Entity disguised)
+ {
return getDisguise(disguised) != null;
}
@@ -340,15 +458,18 @@ public class DisguiseAPI {
* @param disguised
* @return
*/
- public static boolean isDisguised(Player observer, Entity disguised) {
+ public static boolean isDisguised(Player observer, Entity disguised)
+ {
return getDisguise(observer, disguised) != null;
}
- public static boolean isDisguiseInUse(Disguise disguise) {
+ public static boolean isDisguiseInUse(Disguise disguise)
+ {
return disguise.isDisguiseInUse();
}
- public static boolean isSelfDisguised(Player player) {
+ public static boolean isSelfDisguised(Player player)
+ {
return DisguiseUtilities.getSelfDisguised().contains(player.getUniqueId());
}
@@ -358,18 +479,24 @@ public class DisguiseAPI {
* @param entity
* @return
*/
- public static boolean isViewSelfToggled(Entity entity) {
- return isDisguised(entity) ? getDisguise(entity).isSelfDisguiseVisible() : Disguise.getViewSelf().contains(entity.getUniqueId());
+ public static boolean isViewSelfToggled(Entity entity)
+ {
+ return isDisguised(entity) ? getDisguise(entity).isSelfDisguiseVisible()
+ : Disguise.getViewSelf().contains(entity.getUniqueId());
}
/**
- * Undisguise the entity. This doesn't let you cancel the UndisguiseEvent if the entity is no longer valid. Aka removed from the world.
+ * Undisguise the entity. This doesn't let you cancel the UndisguiseEvent if the entity is no longer valid. Aka removed from
+ * the world.
*
* @param entity
*/
- public static void undisguiseToAll(Entity entity) {
+ public static void undisguiseToAll(Entity entity)
+ {
Disguise[] disguises = getDisguises(entity);
- for (Disguise disguise : disguises) {
+
+ for (Disguise disguise : disguises)
+ {
disguise.removeDisguise();
}
}
@@ -380,20 +507,28 @@ public class DisguiseAPI {
* @param entity
* @param toggled
*/
- public static void setViewDisguiseToggled(Entity entity, boolean toggled) {
- if (isDisguised(entity)) {
+ public static void setViewDisguiseToggled(Entity entity, boolean toggled)
+ {
+ if (isDisguised(entity))
+ {
Disguise disguise = getDisguise(entity);
disguise.setViewSelfDisguise(toggled);
}
- if (toggled) {
- if (!Disguise.getViewSelf().contains(entity.getUniqueId())) {
+
+ if (toggled)
+ {
+ if (!Disguise.getViewSelf().contains(entity.getUniqueId()))
+ {
Disguise.getViewSelf().add(entity.getUniqueId());
}
- } else {
+ }
+ else
+ {
Disguise.getViewSelf().remove(entity.getUniqueId());
}
}
- private DisguiseAPI() {
+ private DisguiseAPI()
+ {
}
}
diff --git a/src/main/java/me/libraryaddict/disguise/DisguiseConfig.java b/src/me/libraryaddict/disguise/DisguiseConfig.java
similarity index 75%
rename from src/main/java/me/libraryaddict/disguise/DisguiseConfig.java
rename to src/me/libraryaddict/disguise/DisguiseConfig.java
index e34afe6c..47f733a3 100644
--- a/src/main/java/me/libraryaddict/disguise/DisguiseConfig.java
+++ b/src/me/libraryaddict/disguise/DisguiseConfig.java
@@ -1,10 +1,12 @@
package me.libraryaddict.disguise;
-import me.libraryaddict.disguise.utilities.PacketsManager;
import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection;
-public class DisguiseConfig {
+import me.libraryaddict.disguise.utilities.PacketsManager;
+
+public class DisguiseConfig
+{
private static boolean animationEnabled;
private static boolean bedEnabled;
@@ -43,34 +45,43 @@ public class DisguiseConfig {
private static String updateNotificationPermission;
private static boolean witherSkullEnabled;
- public static String getDisguiseBlownMessage() {
+ public static String getDisguiseBlownMessage()
+ {
return disguiseBlownMessage;
}
- public static int getDisguiseCloneExpire() {
+ public static int getDisguiseCloneExpire()
+ {
return disguiseCloneExpire;
}
- public static int getDisguiseEntityExpire() {
+ public static int getDisguiseEntityExpire()
+ {
return disguiseEntityExpire;
}
- public static int getMaxClonedDisguises() {
+ public static int getMaxClonedDisguises()
+ {
return maxClonedDisguises;
}
- public static String getUpdateMessage() {
+ public static String getUpdateMessage()
+ {
return updateMessage;
}
- public static String getUpdateNotificationPermission() {
+ public static String getUpdateNotificationPermission()
+ {
return updateNotificationPermission;
}
- public static void initConfig(ConfigurationSection config) {
+ public static void initConfig(ConfigurationSection config)
+ {
+
setSoundsEnabled(config.getBoolean("DisguiseSounds"));
setVelocitySent(config.getBoolean("SendVelocity"));
- setViewDisguises(config.getBoolean("ViewSelfDisguises")); //Since we can now toggle, the view disguises listener must always be on
+ setViewDisguises(config.getBoolean("ViewSelfDisguises")); // Since we can now toggle, the view disguises listener must
+ // always be on
PacketsManager.setViewDisguisesListener(true);
setHearSelfDisguise(config.getBoolean("HearSelfDisguise"));
setHideArmorFromSelf(config.getBoolean("RemoveArmor"));
@@ -105,19 +116,23 @@ public class DisguiseConfig {
setStopShulkerDisguisesFromMoving(config.getBoolean("StopShulkerDisguisesFromMoving", true));
}
- public static boolean isAnimationPacketsEnabled() {
+ public static boolean isAnimationPacketsEnabled()
+ {
return animationEnabled;
}
- public static boolean isBedPacketsEnabled() {
+ public static boolean isBedPacketsEnabled()
+ {
return bedEnabled;
}
- public static boolean isCollectPacketsEnabled() {
+ public static boolean isCollectPacketsEnabled()
+ {
return collectEnabled;
}
- public static boolean isDisguiseBlownOnAttack() {
+ public static boolean isDisguiseBlownOnAttack()
+ {
return blowDisguisesOnAttack;
}
@@ -125,96 +140,117 @@ public class DisguiseConfig {
* @deprecated Spelling mistake.
*/
@Deprecated
- public static boolean isEnquipmentPacketsEnabled() {
+ public static boolean isEnquipmentPacketsEnabled()
+ {
return equipmentEnabled;
}
- public static boolean isEntityAnimationsAdded() {
+ public static boolean isEntityAnimationsAdded()
+ {
return entityAnimationsAdded;
}
- public static boolean isEntityStatusPacketsEnabled() {
+ public static boolean isEntityStatusPacketsEnabled()
+ {
return entityStatusEnabled;
}
- public static boolean isEquipmentPacketsEnabled() {
+ public static boolean isEquipmentPacketsEnabled()
+ {
return equipmentEnabled;
}
/**
* Is the plugin modifying the inventory packets so that players when self disguised, do not see their armor floating around
*/
- public static boolean isHidingArmorFromSelf() {
+ public static boolean isHidingArmorFromSelf()
+ {
return hidingArmor;
}
/**
* Does the plugin appear to remove the item they are holding, to prevent a floating sword when they are viewing self disguise
*/
- public static boolean isHidingHeldItemFromSelf() {
+ public static boolean isHidingHeldItemFromSelf()
+ {
return hidingHeldItem;
}
- public static boolean isKeepDisguiseOnEntityDespawn() {
+ public static boolean isKeepDisguiseOnEntityDespawn()
+ {
return keepDisguiseEntityDespawn;
}
- public static boolean isKeepDisguiseOnPlayerDeath() {
+ public static boolean isKeepDisguiseOnPlayerDeath()
+ {
return keepDisguisePlayerDeath;
}
- public static boolean isKeepDisguiseOnPlayerLogout() {
+ public static boolean isKeepDisguiseOnPlayerLogout()
+ {
return keepDisguisePlayerLogout;
}
- public static boolean isMaxHealthDeterminedByDisguisedEntity() {
+ public static boolean isMaxHealthDeterminedByDisguisedEntity()
+ {
return maxHealthIsDisguisedEntity;
}
- public static boolean isMetadataPacketsEnabled() {
+ public static boolean isMetadataPacketsEnabled()
+ {
return sendsEntityMetadata;
}
- public static boolean isMiscDisguisesForLivingEnabled() {
+ public static boolean isMiscDisguisesForLivingEnabled()
+ {
return miscDisguisesForLivingEnabled;
}
- public static boolean isModifyBoundingBox() {
+ public static boolean isModifyBoundingBox()
+ {
return modifyBoundingBox;
}
- public static boolean isMonstersIgnoreDisguises() {
+ public static boolean isMonstersIgnoreDisguises()
+ {
return targetDisguises;
}
- public static boolean isMovementPacketsEnabled() {
+ public static boolean isMovementPacketsEnabled()
+ {
return movementEnabled;
}
- public static boolean isNameAboveHeadAlwaysVisible() {
+ public static boolean isNameAboveHeadAlwaysVisible()
+ {
return showNameAboveHeadAlwaysVisible;
}
- public static boolean isNameOfPlayerShownAboveDisguise() {
+ public static boolean isNameOfPlayerShownAboveDisguise()
+ {
return showNameAboveHead;
}
- public static boolean isSelfDisguisesSoundsReplaced() {
+ public static boolean isSelfDisguisesSoundsReplaced()
+ {
return hearSelfDisguise;
}
- public static boolean isSheepDyeable() {
+ public static boolean isSheepDyeable()
+ {
return colorizeSheep;
}
/**
* Is the sound packets caught and modified
*/
- public static boolean isSoundEnabled() {
+ public static boolean isSoundEnabled()
+ {
return PacketsManager.isHearDisguisesEnabled();
}
- public static boolean isUndisguiseOnWorldChange() {
+ public static boolean isUndisguiseOnWorldChange()
+ {
return undisguiseSwitchWorlds;
}
@@ -223,7 +259,8 @@ public class DisguiseConfig {
*
* @return
*/
- public static boolean isVelocitySent() {
+ public static boolean isVelocitySent()
+ {
return sendVelocity;
}
@@ -232,74 +269,98 @@ public class DisguiseConfig {
*
* @return
*/
- public static boolean isViewDisguises() {
+ public static boolean isViewDisguises()
+ {
return viewSelfDisguise;
}
- public static boolean isWitherSkullPacketsEnabled() {
+ public static boolean isWitherSkullPacketsEnabled()
+ {
return witherSkullEnabled;
}
- public static boolean isWolfDyeable() {
+ public static boolean isWolfDyeable()
+ {
return colorizeWolf;
}
- public static void setAddEntityAnimations(boolean isEntityAnimationsAdded) {
+ public static void setAddEntityAnimations(boolean isEntityAnimationsAdded)
+ {
entityAnimationsAdded = isEntityAnimationsAdded;
}
- public static void setAnimationPacketsEnabled(boolean enabled) {
- if (enabled != isAnimationPacketsEnabled()) {
+ public static void setAnimationPacketsEnabled(boolean enabled)
+ {
+ if (enabled != isAnimationPacketsEnabled())
+ {
animationEnabled = enabled;
+
PacketsManager.setupMainPacketsListener();
}
}
- public static void setBedPacketsEnabled(boolean enabled) {
- if (enabled != isBedPacketsEnabled()) {
+ public static void setBedPacketsEnabled(boolean enabled)
+ {
+ if (enabled != isBedPacketsEnabled())
+ {
bedEnabled = enabled;
+
PacketsManager.setupMainPacketsListener();
}
}
- public static void setCollectPacketsEnabled(boolean enabled) {
- if (enabled != isCollectPacketsEnabled()) {
+ public static void setCollectPacketsEnabled(boolean enabled)
+ {
+ if (enabled != isCollectPacketsEnabled())
+ {
collectEnabled = enabled;
+
PacketsManager.setupMainPacketsListener();
}
}
- public static void setDisguiseBlownMessage(String newMessage) {
+ public static void setDisguiseBlownMessage(String newMessage)
+ {
disguiseBlownMessage = newMessage;
}
- public static void setDisguiseBlownOnAttack(boolean blowDisguise) {
+ public static void setDisguiseBlownOnAttack(boolean blowDisguise)
+ {
blowDisguisesOnAttack = blowDisguise;
}
- public static void setDisguiseCloneExpire(int newExpires) {
+ public static void setDisguiseCloneExpire(int newExpires)
+ {
disguiseCloneExpire = newExpires;
}
- public static void setDisguiseEntityExpire(int newExpires) {
+ public static void setDisguiseEntityExpire(int newExpires)
+ {
disguiseEntityExpire = newExpires;
}
@Deprecated
- public static void setEnquipmentPacketsEnabled(boolean enabled) {
+ public static void setEnquipmentPacketsEnabled(boolean enabled)
+ {
setEquipmentPacketsEnabled(enabled);
}
- public static void setEntityStatusPacketsEnabled(boolean enabled) {
- if (enabled != isEntityStatusPacketsEnabled()) {
+ public static void setEntityStatusPacketsEnabled(boolean enabled)
+ {
+ if (enabled != isEntityStatusPacketsEnabled())
+ {
entityStatusEnabled = enabled;
+
PacketsManager.setupMainPacketsListener();
}
}
- public static void setEquipmentPacketsEnabled(boolean enabled) {
- if (enabled != isEquipmentPacketsEnabled()) {
+ public static void setEquipmentPacketsEnabled(boolean enabled)
+ {
+ if (enabled != isEquipmentPacketsEnabled())
+ {
equipmentEnabled = enabled;
+
PacketsManager.setupMainPacketsListener();
}
}
@@ -307,8 +368,10 @@ public class DisguiseConfig {
/**
* Can players hear their own disguises
*/
- public static void setHearSelfDisguise(boolean replaceSound) {
- if (hearSelfDisguise != replaceSound) {
+ public static void setHearSelfDisguise(boolean replaceSound)
+ {
+ if (hearSelfDisguise != replaceSound)
+ {
hearSelfDisguise = replaceSound;
}
}
@@ -316,9 +379,12 @@ public class DisguiseConfig {
/**
* Set the plugin to hide self disguises armor from theirselves
*/
- public static void setHideArmorFromSelf(boolean hideArmor) {
- if (hidingArmor != hideArmor) {
+ public static void setHideArmorFromSelf(boolean hideArmor)
+ {
+ if (hidingArmor != hideArmor)
+ {
hidingArmor = hideArmor;
+
PacketsManager.setInventoryListenerEnabled(isHidingHeldItemFromSelf() || isHidingArmorFromSelf());
}
}
@@ -326,95 +392,121 @@ public class DisguiseConfig {
/**
* Does the plugin appear to remove the item they are holding, to prevent a floating sword when they are viewing self disguise
*/
- public static void setHideHeldItemFromSelf(boolean hideHelditem) {
- if (hidingHeldItem != hideHelditem) {
+ public static void setHideHeldItemFromSelf(boolean hideHelditem)
+ {
+ if (hidingHeldItem != hideHelditem)
+ {
hidingHeldItem = hideHelditem;
+
PacketsManager.setInventoryListenerEnabled(isHidingHeldItemFromSelf() || isHidingArmorFromSelf());
}
}
- public static void setKeepDisguiseOnEntityDespawn(boolean keepDisguise) {
+ public static void setKeepDisguiseOnEntityDespawn(boolean keepDisguise)
+ {
keepDisguiseEntityDespawn = keepDisguise;
}
- public static void setKeepDisguiseOnPlayerDeath(boolean keepDisguise) {
+ public static void setKeepDisguiseOnPlayerDeath(boolean keepDisguise)
+ {
keepDisguisePlayerDeath = keepDisguise;
}
- public static void setKeepDisguiseOnPlayerLogout(boolean keepDisguise) {
+ public static void setKeepDisguiseOnPlayerLogout(boolean keepDisguise)
+ {
keepDisguisePlayerLogout = keepDisguise;
}
- public static void setMaxClonedDisguises(int newMax) {
+ public static void setMaxClonedDisguises(int newMax)
+ {
maxClonedDisguises = newMax;
}
- public static void setMaxHealthDeterminedByDisguisedEntity(boolean isDetermined) {
+ public static void setMaxHealthDeterminedByDisguisedEntity(boolean isDetermined)
+ {
maxHealthIsDisguisedEntity = isDetermined;
}
- public static void setMetadataPacketsEnabled(boolean enabled) {
+ public static void setMetadataPacketsEnabled(boolean enabled)
+ {
sendsEntityMetadata = enabled;
}
- public static void setMiscDisguisesForLivingEnabled(boolean enabled) {
- if (enabled != isMiscDisguisesForLivingEnabled()) {
+ public static void setMiscDisguisesForLivingEnabled(boolean enabled)
+ {
+ if (enabled != isMiscDisguisesForLivingEnabled())
+ {
miscDisguisesForLivingEnabled = enabled;
+
PacketsManager.setupMainPacketsListener();
}
}
- public static void setModifyBoundingBox(boolean modifyBounding) {
+ public static void setModifyBoundingBox(boolean modifyBounding)
+ {
modifyBoundingBox = modifyBounding;
}
- public static void setMonstersIgnoreDisguises(boolean ignore) {
+ public static void setMonstersIgnoreDisguises(boolean ignore)
+ {
targetDisguises = ignore;
}
- public static void setMovementPacketsEnabled(boolean enabled) {
- if (enabled != isMovementPacketsEnabled()) {
+ public static void setMovementPacketsEnabled(boolean enabled)
+ {
+ if (enabled != isMovementPacketsEnabled())
+ {
movementEnabled = enabled;
+
PacketsManager.setupMainPacketsListener();
}
}
- public static void setNameAboveHeadAlwaysVisible(boolean alwaysVisible) {
+ public static void setNameAboveHeadAlwaysVisible(boolean alwaysVisible)
+ {
showNameAboveHeadAlwaysVisible = alwaysVisible;
}
- public static void setNameOfPlayerShownAboveDisguise(boolean showNames) {
+ public static void setNameOfPlayerShownAboveDisguise(boolean showNames)
+ {
showNameAboveHead = showNames;
}
- public static void setSheepDyeable(boolean color) {
+ public static void setSheepDyeable(boolean color)
+ {
colorizeSheep = color;
}
/**
* Set if the disguises play sounds when hurt
*/
- public static void setSoundsEnabled(boolean isSoundsEnabled) {
+ public static void setSoundsEnabled(boolean isSoundsEnabled)
+ {
PacketsManager.setHearDisguisesListener(isSoundsEnabled);
}
- public static void setUndisguiseOnWorldChange(boolean isUndisguise) {
+ public static void setUndisguiseOnWorldChange(boolean isUndisguise)
+ {
undisguiseSwitchWorlds = isUndisguise;
}
- public static void setUpdateMessage(String newMessage) {
+ public static void setUpdateMessage(String newMessage)
+ {
updateMessage = newMessage;
}
- public static void setUpdateNotificationPermission(String newPermission) {
+ public static void setUpdateNotificationPermission(String newPermission)
+ {
updateNotificationPermission = newPermission;
}
- public static void setStopShulkerDisguisesFromMoving(boolean stopShulkerDisguisesFromMoving) {
+ public static void setStopShulkerDisguisesFromMoving(boolean stopShulkerDisguisesFromMoving)
+ {
DisguiseConfig.stopShulkerDisguisesFromMoving = stopShulkerDisguisesFromMoving;
}
- public static boolean isStopShulkerDisguisesFromMoving() {
+ public static boolean isStopShulkerDisguisesFromMoving()
+ {
return stopShulkerDisguisesFromMoving;
}
@@ -423,22 +515,27 @@ public class DisguiseConfig {
*
* @param sendVelocityPackets
*/
- public static void setVelocitySent(boolean sendVelocityPackets) {
+ public static void setVelocitySent(boolean sendVelocityPackets)
+ {
sendVelocity = sendVelocityPackets;
}
- public static void setViewDisguises(boolean seeOwnDisguise) {
+ public static void setViewDisguises(boolean seeOwnDisguise)
+ {
viewSelfDisguise = seeOwnDisguise;
}
- public static void setWitherSkullPacketsEnabled(boolean enabled) {
+ public static void setWitherSkullPacketsEnabled(boolean enabled)
+ {
witherSkullEnabled = enabled;
}
- public static void setWolfDyeable(boolean color) {
+ public static void setWolfDyeable(boolean color)
+ {
colorizeWolf = color;
}
- private DisguiseConfig() {
+ private DisguiseConfig()
+ {
}
}
diff --git a/src/main/java/me/libraryaddict/disguise/DisguiseListener.java b/src/me/libraryaddict/disguise/DisguiseListener.java
similarity index 99%
rename from src/main/java/me/libraryaddict/disguise/DisguiseListener.java
rename to src/me/libraryaddict/disguise/DisguiseListener.java
index f50b7b8a..75713120 100644
--- a/src/main/java/me/libraryaddict/disguise/DisguiseListener.java
+++ b/src/me/libraryaddict/disguise/DisguiseListener.java
@@ -1,15 +1,9 @@
package me.libraryaddict.disguise;
-import com.comphenix.protocol.ProtocolLibrary;
-import com.comphenix.protocol.events.PacketContainer;
-import me.libraryaddict.disguise.disguisetypes.Disguise;
-import me.libraryaddict.disguise.disguisetypes.DisguiseType;
-import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
-import me.libraryaddict.disguise.disguisetypes.TargetedDisguise;
-import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
-import me.libraryaddict.disguise.utilities.DisguiseUtilities;
-import me.libraryaddict.disguise.utilities.ReflectionManager;
-import me.libraryaddict.disguise.utilities.UpdateChecker;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.HashSet;
+
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@@ -33,9 +27,17 @@ import org.bukkit.event.vehicle.VehicleExitEvent;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.HashSet;
+import com.comphenix.protocol.ProtocolLibrary;
+import com.comphenix.protocol.events.PacketContainer;
+
+import me.libraryaddict.disguise.disguisetypes.Disguise;
+import me.libraryaddict.disguise.disguisetypes.DisguiseType;
+import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
+import me.libraryaddict.disguise.disguisetypes.TargetedDisguise;
+import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
+import me.libraryaddict.disguise.utilities.DisguiseUtilities;
+import me.libraryaddict.disguise.utilities.ReflectionManager;
+import me.libraryaddict.disguise.utilities.UpdateChecker;
public class DisguiseListener implements Listener {
diff --git a/src/main/java/me/libraryaddict/disguise/LibsDisguises.java b/src/me/libraryaddict/disguise/LibsDisguises.java
similarity index 61%
rename from src/main/java/me/libraryaddict/disguise/LibsDisguises.java
rename to src/me/libraryaddict/disguise/LibsDisguises.java
index 8158e9b4..32dd54dc 100644
--- a/src/main/java/me/libraryaddict/disguise/LibsDisguises.java
+++ b/src/me/libraryaddict/disguise/LibsDisguises.java
@@ -1,8 +1,22 @@
package me.libraryaddict.disguise;
+import java.io.IOException;
+import java.lang.reflect.Field;
+
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Ageable;
+import org.bukkit.entity.Damageable;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Tameable;
+import org.bukkit.entity.Zombie;
+import org.bukkit.event.HandlerList;
+import org.bukkit.plugin.java.JavaPlugin;
+
import com.comphenix.protocol.reflect.FieldAccessException;
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
+
import me.libraryaddict.disguise.commands.CloneDisguiseCommand;
import me.libraryaddict.disguise.commands.DisguiseCommand;
import me.libraryaddict.disguise.commands.DisguiseViewSelf;
@@ -33,37 +47,30 @@ import me.libraryaddict.disguise.utilities.FakeBoundingBox;
import me.libraryaddict.disguise.utilities.Metrics;
import me.libraryaddict.disguise.utilities.PacketsManager;
import me.libraryaddict.disguise.utilities.ReflectionManager;
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Ageable;
-import org.bukkit.entity.Damageable;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Tameable;
-import org.bukkit.entity.Zombie;
-import org.bukkit.event.HandlerList;
-import org.bukkit.plugin.java.JavaPlugin;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-
-
-public class LibsDisguises extends JavaPlugin {
+public class LibsDisguises extends JavaPlugin
+{
private static LibsDisguises instance;
private DisguiseListener listener;
@Override
- public void onEnable() {
+ public void onEnable()
+ {
getLogger().info("Discovered MC version: " + ReflectionManager.getBukkitVersion());
+
saveDefaultConfig();
PacketsManager.init(this);
DisguiseUtilities.init(this);
+
DisguiseConfig.initConfig(getConfig());
PacketsManager.addPacketListeners();
+
listener = new DisguiseListener(this);
+
Bukkit.getPluginManager().registerEvents(listener, this);
+
getCommand("disguise").setExecutor(new DisguiseCommand());
getCommand("undisguise").setExecutor(new UndisguiseCommand());
getCommand("disguiseplayer").setExecutor(new PlayerDisguiseCommand());
@@ -76,228 +83,304 @@ public class LibsDisguises extends JavaPlugin {
getCommand("disguiseclone").setExecutor(new CloneDisguiseCommand());
getCommand("libsdisguises").setExecutor(new LibsDisguisesCommand());
getCommand("disguiseviewself").setExecutor(new DisguiseViewSelf());
+
registerValues();
+
instance = this;
- try {
+
+ try
+ {
Metrics metrics = new Metrics(this);
metrics.start();
- } catch (IOException e) {
+ }
+ catch (IOException e)
+ {
}
}
/**
* Reloads the config with new config options.
*/
- public void reload() {
+ public void reload()
+ {
HandlerList.unregisterAll(listener);
+
reloadConfig();
DisguiseConfig.initConfig(getConfig());
}
/**
- * Here we create a nms entity for each disguise. Then grab their default values in their datawatcher. Then their sound volume for mob noises. As well as setting their watcher class and entity size.
+ * Here we create a nms entity for each disguise. Then grab their default values in their datawatcher. Then their sound volume
+ * for mob noises. As well as setting their watcher class and entity size.
*/
- private void registerValues() {
- for (DisguiseType disguiseType : DisguiseType.values()) {
- if (disguiseType.getEntityType() == null) {
+ private void registerValues()
+ {
+ for (DisguiseType disguiseType : DisguiseType.values())
+ {
+ if (disguiseType.getEntityType() == null)
+ {
continue;
}
+
Class watcherClass = null;
- try {
- switch (disguiseType) {
- case ITEM_FRAME: //Not really supported...
- break;
- case MINECART_CHEST:
- case MINECART_COMMAND:
- case MINECART_FURNACE:
- case MINECART_HOPPER:
- case MINECART_MOB_SPAWNER:
- case MINECART_TNT:
- watcherClass = MinecartWatcher.class;
- break;
- case DONKEY:
- case MULE:
- case UNDEAD_HORSE:
- case SKELETON_HORSE:
- watcherClass = HorseWatcher.class;
- break;
- case ZOMBIE_VILLAGER:
- case PIG_ZOMBIE:
- watcherClass = ZombieWatcher.class;
- break;
- case MAGMA_CUBE:
- watcherClass = SlimeWatcher.class;
- break;
- case ELDER_GUARDIAN:
- watcherClass = GuardianWatcher.class;
- break;
- case ENDERMITE:
- watcherClass = LivingWatcher.class;
- break;
- case WITHER_SKELETON:
- watcherClass = SkeletonWatcher.class;
- break;
- default:
- watcherClass = Class.forName("me.libraryaddict.disguise.disguisetypes.watchers."
- + toReadable(disguiseType.name()) + "Watcher");
- break;
- }
- } catch (ClassNotFoundException ex) {
- // There is no explicit watcher for this entity.
- Class entityClass = disguiseType.getEntityType().getEntityClass();
- if (entityClass != null) {
- if (Tameable.class.isAssignableFrom(entityClass)) {
- watcherClass = TameableWatcher.class;
- } else if (Ageable.class.isAssignableFrom(entityClass)) {
- watcherClass = AgeableWatcher.class;
- } else if (LivingEntity.class.isAssignableFrom(entityClass)) {
- watcherClass = LivingWatcher.class;
- } else {
- watcherClass = FlagWatcher.class;
- }
- } else {
- watcherClass = FlagWatcher.class; //Disguise is unknown type
- }
- }
- disguiseType.setWatcherClass(watcherClass);
- if (DisguiseValues.getDisguiseValues(disguiseType) != null) {
- continue;
- }
- String nmsEntityName = toReadable(disguiseType.name());
- switch (disguiseType) {
- case WITHER_SKELETON:
- case ZOMBIE_VILLAGER:
+
+ try
+ {
+ switch (disguiseType)
+ {
+ case ITEM_FRAME: // Not really supported...
+ break;
+ case MINECART_CHEST:
+ case MINECART_COMMAND:
+ case MINECART_FURNACE:
+ case MINECART_HOPPER:
+ case MINECART_MOB_SPAWNER:
+ case MINECART_TNT:
+ watcherClass = MinecartWatcher.class;
+ break;
case DONKEY:
case MULE:
case UNDEAD_HORSE:
case SKELETON_HORSE:
- continue;
- case PRIMED_TNT:
- nmsEntityName = "TNTPrimed";
+ watcherClass = HorseWatcher.class;
break;
- case MINECART_TNT:
- nmsEntityName = "MinecartTNT";
+ case ZOMBIE_VILLAGER:
+ case PIG_ZOMBIE:
+ watcherClass = ZombieWatcher.class;
break;
- case MINECART:
- nmsEntityName = "MinecartRideable";
- break;
- case FIREWORK:
- nmsEntityName = "Fireworks";
- break;
- case SPLASH_POTION:
- nmsEntityName = "Potion";
- break;
- case GIANT:
- nmsEntityName = "GiantZombie";
- break;
- case DROPPED_ITEM:
- nmsEntityName = "Item";
- break;
- case FIREBALL:
- nmsEntityName = "LargeFireball";
- break;
- case LEASH_HITCH:
- nmsEntityName = "Leash";
+ case MAGMA_CUBE:
+ watcherClass = SlimeWatcher.class;
break;
case ELDER_GUARDIAN:
- nmsEntityName = "Guardian";
+ watcherClass = GuardianWatcher.class;
+ break;
+ case ENDERMITE:
+ watcherClass = LivingWatcher.class;
+ break;
+ case WITHER_SKELETON:
+ watcherClass = SkeletonWatcher.class;
break;
- case ARROW:
- nmsEntityName = "TippedArrow";
default:
+ watcherClass = Class.forName(
+ "me.libraryaddict.disguise.disguisetypes.watchers." + toReadable(disguiseType.name()) + "Watcher");
break;
+ }
}
- try {
- if (nmsEntityName.equalsIgnoreCase("Unknown")) {
+ catch (ClassNotFoundException ex)
+ {
+ // There is no explicit watcher for this entity.
+ Class entityClass = disguiseType.getEntityType().getEntityClass();
+
+ if (entityClass != null)
+ {
+ if (Tameable.class.isAssignableFrom(entityClass))
+ {
+ watcherClass = TameableWatcher.class;
+ }
+ else if (Ageable.class.isAssignableFrom(entityClass))
+ {
+ watcherClass = AgeableWatcher.class;
+ }
+ else if (LivingEntity.class.isAssignableFrom(entityClass))
+ {
+ watcherClass = LivingWatcher.class;
+ }
+ else
+ {
+ watcherClass = FlagWatcher.class;
+ }
+ }
+ else
+ {
+ watcherClass = FlagWatcher.class; // Disguise is unknown type
+ }
+ }
+
+ disguiseType.setWatcherClass(watcherClass);
+
+ if (DisguiseValues.getDisguiseValues(disguiseType) != null)
+ {
+ continue;
+ }
+
+ String nmsEntityName = toReadable(disguiseType.name());
+
+ switch (disguiseType)
+ {
+ case WITHER_SKELETON:
+ case ZOMBIE_VILLAGER:
+ case DONKEY:
+ case MULE:
+ case UNDEAD_HORSE:
+ case SKELETON_HORSE:
+ continue;
+ case PRIMED_TNT:
+ nmsEntityName = "TNTPrimed";
+ break;
+ case MINECART_TNT:
+ nmsEntityName = "MinecartTNT";
+ break;
+ case MINECART:
+ nmsEntityName = "MinecartRideable";
+ break;
+ case FIREWORK:
+ nmsEntityName = "Fireworks";
+ break;
+ case SPLASH_POTION:
+ nmsEntityName = "Potion";
+ break;
+ case GIANT:
+ nmsEntityName = "GiantZombie";
+ break;
+ case DROPPED_ITEM:
+ nmsEntityName = "Item";
+ break;
+ case FIREBALL:
+ nmsEntityName = "LargeFireball";
+ break;
+ case LEASH_HITCH:
+ nmsEntityName = "Leash";
+ break;
+ case ELDER_GUARDIAN:
+ nmsEntityName = "Guardian";
+ break;
+ case ARROW:
+ nmsEntityName = "TippedArrow";
+ default:
+ break;
+ }
+
+ try
+ {
+ if (nmsEntityName.equalsIgnoreCase("Unknown"))
+ {
DisguiseValues disguiseValues = new DisguiseValues(disguiseType, null, 0, 0);
+
disguiseValues.setAdultBox(new FakeBoundingBox(0, 0, 0));
+
DisguiseSound sound = DisguiseSound.getType(disguiseType.name());
- if (sound != null) {
+
+ if (sound != null)
+ {
sound.setDamageAndIdleSoundVolume(1f);
}
+
continue;
}
+
Object nmsEntity = ReflectionManager.createEntityInstance(nmsEntityName);
- if (nmsEntity == null) {
+
+ if (nmsEntity == null)
+ {
getLogger().warning("Entity not found! (" + nmsEntityName + ")");
+
continue;
}
+
Entity bukkitEntity = ReflectionManager.getBukkitEntity(nmsEntity);
int entitySize = 0;
- for (Field field : ReflectionManager.getNmsClass("Entity").getFields()) {
- if (field.getType().getName().equals("EnumEntitySize")) {
+
+ for (Field field : ReflectionManager.getNmsClass("Entity").getFields())
+ {
+ if (field.getType().getName().equals("EnumEntitySize"))
+ {
Enum enumEntitySize = (Enum) field.get(nmsEntity);
+
entitySize = enumEntitySize.ordinal();
+
break;
}
}
+
DisguiseValues disguiseValues = new DisguiseValues(disguiseType, nmsEntity.getClass(), entitySize,
bukkitEntity instanceof Damageable ? ((Damageable) bukkitEntity).getMaxHealth() : 0);
+
WrappedDataWatcher watcher = WrappedDataWatcher.getEntityWatcher(bukkitEntity);
- for (WrappedWatchableObject watch : watcher.getWatchableObjects()) {
+
+ for (WrappedWatchableObject watch : watcher.getWatchableObjects())
+ {
disguiseValues.setMetaValue(watch.getIndex(), watch.getValue());
// Uncomment when I need to find the new datawatcher values for a class..
-// int id = watch.getIndex();
-// Object val = watch.getValue();
-// Class> valClazz = val != null ? watch.getValue().getClass() : null;
-// try {
-// val = val.toString();
-// } catch (Exception e) {
-// val = val != null ? val.getClass() : "null";
-// }
-// System.out.println("Disguise: " + disguiseType + ", ID: " + id + ", Class: " + (val == null ? "null" : valClazz) + ", Value: " + val);
+ // int id = watch.getIndex();
+ // Object val = watch.getValue();
+ // Class> valClazz = val != null ? watch.getValue().getClass() : null;
+ // try {
+ // val = val.toString();
+ // } catch (Exception e) {
+ // val = val != null ? val.getClass() : "null";
+ // }
+ // System.out.println("Disguise: " + disguiseType + ", ID: " + id + ", Class: " + (val == null ? "null" :
+ // valClazz) + ", Value: " + val);
}
+
DisguiseSound sound = DisguiseSound.getType(disguiseType.name());
- if (sound != null) {
+
+ if (sound != null)
+ {
Float soundStrength = ReflectionManager.getSoundModifier(nmsEntity);
- if (soundStrength != null) {
+
+ if (soundStrength != null)
+ {
sound.setDamageAndIdleSoundVolume(soundStrength);
}
}
// Get the bounding box
disguiseValues.setAdultBox(ReflectionManager.getBoundingBox(bukkitEntity));
- if (bukkitEntity instanceof Ageable) {
+
+ if (bukkitEntity instanceof Ageable)
+ {
((Ageable) bukkitEntity).setBaby();
- disguiseValues.setBabyBox(ReflectionManager.getBoundingBox(bukkitEntity));
- } else if (bukkitEntity instanceof Zombie) {
- ((Zombie) bukkitEntity).setBaby(true);
+
disguiseValues.setBabyBox(ReflectionManager.getBoundingBox(bukkitEntity));
}
+ else if (bukkitEntity instanceof Zombie)
+ {
+ ((Zombie) bukkitEntity).setBaby(true);
+
+ disguiseValues.setBabyBox(ReflectionManager.getBoundingBox(bukkitEntity));
+ }
+
disguiseValues.setEntitySize(ReflectionManager.getSize(bukkitEntity));
- } catch (SecurityException | IllegalArgumentException | IllegalAccessException | FieldAccessException ex) {
- System.out.print("[LibsDisguises] Uh oh! Trouble while making values for the disguise " + disguiseType.name()
- + "!");
+ }
+ catch (SecurityException | IllegalArgumentException | IllegalAccessException | FieldAccessException ex)
+ {
+ System.out.print(
+ "[LibsDisguises] Uh oh! Trouble while making values for the disguise " + disguiseType.name() + "!");
System.out.print("[LibsDisguises] Before reporting this error, "
+ "please make sure you are using the latest version of LibsDisguises and ProtocolLib.");
- System.out
- .print("[LibsDisguises] Development builds are available at (ProtocolLib) "
- + "http://ci.dmulloy2.net/job/ProtocolLib/ and (LibsDisguises) http://server.o2gaming.com:8080/job/LibsDisguises%201.9+/");
+ System.out.print("[LibsDisguises] Development builds are available at (ProtocolLib) "
+ + "http://ci.dmulloy2.net/job/ProtocolLib/ and (LibsDisguises) http://server.o2gaming.com:8080/job/LibsDisguises%201.9+/");
ex.printStackTrace(System.out);
}
}
}
- private String toReadable(String string) {
+ private String toReadable(String string)
+ {
StringBuilder builder = new StringBuilder();
- for (String s : string.split("_")) {
+
+ for (String s : string.split("_"))
+ {
builder.append(s.substring(0, 1)).append(s.substring(1).toLowerCase());
}
+
return builder.toString();
}
- public DisguiseListener getListener() {
+ public DisguiseListener getListener()
+ {
return listener;
}
/**
- * External APIs shouldn't actually need this instance.
- * DisguiseAPI should be enough to handle most cases.
+ * External APIs shouldn't actually need this instance. DisguiseAPI should be enough to handle most cases.
*
* @return The instance of this plugin
*/
- public static LibsDisguises getInstance() {
+ public static LibsDisguises getInstance()
+ {
return instance;
}
}
diff --git a/src/main/java/me/libraryaddict/disguise/commands/BaseDisguiseCommand.java b/src/me/libraryaddict/disguise/commands/BaseDisguiseCommand.java
similarity index 99%
rename from src/main/java/me/libraryaddict/disguise/commands/BaseDisguiseCommand.java
rename to src/me/libraryaddict/disguise/commands/BaseDisguiseCommand.java
index ff883be6..9e9c500a 100644
--- a/src/main/java/me/libraryaddict/disguise/commands/BaseDisguiseCommand.java
+++ b/src/me/libraryaddict/disguise/commands/BaseDisguiseCommand.java
@@ -1,14 +1,13 @@
package me.libraryaddict.disguise.commands;
-import me.libraryaddict.disguise.disguisetypes.AnimalColor;
-import me.libraryaddict.disguise.disguisetypes.Disguise;
-import me.libraryaddict.disguise.disguisetypes.DisguiseType;
-import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
-import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
-import me.libraryaddict.disguise.disguisetypes.MobDisguise;
-import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
-import me.libraryaddict.disguise.disguisetypes.RabbitType;
-import me.libraryaddict.disguise.utilities.DisguiseUtilities;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map.Entry;
+
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
@@ -21,13 +20,15 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.potion.PotionEffectType;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map.Entry;
+import me.libraryaddict.disguise.disguisetypes.AnimalColor;
+import me.libraryaddict.disguise.disguisetypes.Disguise;
+import me.libraryaddict.disguise.disguisetypes.DisguiseType;
+import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
+import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
+import me.libraryaddict.disguise.disguisetypes.MobDisguise;
+import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
+import me.libraryaddict.disguise.disguisetypes.RabbitType;
+import me.libraryaddict.disguise.utilities.DisguiseUtilities;
/**
diff --git a/src/main/java/me/libraryaddict/disguise/commands/CloneDisguiseCommand.java b/src/me/libraryaddict/disguise/commands/CloneDisguiseCommand.java
similarity index 99%
rename from src/main/java/me/libraryaddict/disguise/commands/CloneDisguiseCommand.java
rename to src/me/libraryaddict/disguise/commands/CloneDisguiseCommand.java
index fd77c87e..8d570966 100644
--- a/src/main/java/me/libraryaddict/disguise/commands/CloneDisguiseCommand.java
+++ b/src/me/libraryaddict/disguise/commands/CloneDisguiseCommand.java
@@ -1,15 +1,16 @@
package me.libraryaddict.disguise.commands;
-import me.libraryaddict.disguise.DisguiseConfig;
-import me.libraryaddict.disguise.LibsDisguises;
-import me.libraryaddict.disguise.disguisetypes.DisguiseType;
+import java.util.ArrayList;
+import java.util.HashMap;
+
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
-import java.util.ArrayList;
-import java.util.HashMap;
+import me.libraryaddict.disguise.DisguiseConfig;
+import me.libraryaddict.disguise.LibsDisguises;
+import me.libraryaddict.disguise.disguisetypes.DisguiseType;
public class CloneDisguiseCommand extends BaseDisguiseCommand {
diff --git a/src/main/java/me/libraryaddict/disguise/commands/DisguiseCommand.java b/src/me/libraryaddict/disguise/commands/DisguiseCommand.java
similarity index 99%
rename from src/main/java/me/libraryaddict/disguise/commands/DisguiseCommand.java
rename to src/me/libraryaddict/disguise/commands/DisguiseCommand.java
index 5b94874b..1cdba6a9 100644
--- a/src/main/java/me/libraryaddict/disguise/commands/DisguiseCommand.java
+++ b/src/me/libraryaddict/disguise/commands/DisguiseCommand.java
@@ -1,18 +1,19 @@
package me.libraryaddict.disguise.commands;
-import me.libraryaddict.disguise.DisguiseAPI;
-import me.libraryaddict.disguise.DisguiseConfig;
-import me.libraryaddict.disguise.disguisetypes.Disguise;
-import me.libraryaddict.disguise.disguisetypes.DisguiseType;
-import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
+import java.util.ArrayList;
+import java.util.HashMap;
+
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import java.util.ArrayList;
-import java.util.HashMap;
+import me.libraryaddict.disguise.DisguiseAPI;
+import me.libraryaddict.disguise.DisguiseConfig;
+import me.libraryaddict.disguise.disguisetypes.Disguise;
+import me.libraryaddict.disguise.disguisetypes.DisguiseType;
+import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
public class DisguiseCommand extends BaseDisguiseCommand {
diff --git a/src/main/java/me/libraryaddict/disguise/commands/DisguiseViewSelf.java b/src/me/libraryaddict/disguise/commands/DisguiseViewSelf.java
similarity index 99%
rename from src/main/java/me/libraryaddict/disguise/commands/DisguiseViewSelf.java
rename to src/me/libraryaddict/disguise/commands/DisguiseViewSelf.java
index b735645c..a1098f22 100644
--- a/src/main/java/me/libraryaddict/disguise/commands/DisguiseViewSelf.java
+++ b/src/me/libraryaddict/disguise/commands/DisguiseViewSelf.java
@@ -1,12 +1,13 @@
package me.libraryaddict.disguise.commands;
-import me.libraryaddict.disguise.DisguiseAPI;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
+import me.libraryaddict.disguise.DisguiseAPI;
+
/**
*
* @author Navid
diff --git a/src/main/java/me/libraryaddict/disguise/commands/EntityDisguiseCommand.java b/src/me/libraryaddict/disguise/commands/EntityDisguiseCommand.java
similarity index 99%
rename from src/main/java/me/libraryaddict/disguise/commands/EntityDisguiseCommand.java
rename to src/me/libraryaddict/disguise/commands/EntityDisguiseCommand.java
index 7a7d64a6..6ce182dc 100644
--- a/src/main/java/me/libraryaddict/disguise/commands/EntityDisguiseCommand.java
+++ b/src/me/libraryaddict/disguise/commands/EntityDisguiseCommand.java
@@ -1,17 +1,18 @@
package me.libraryaddict.disguise.commands;
-import me.libraryaddict.disguise.DisguiseConfig;
-import me.libraryaddict.disguise.LibsDisguises;
-import me.libraryaddict.disguise.disguisetypes.Disguise;
-import me.libraryaddict.disguise.disguisetypes.DisguiseType;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
+import me.libraryaddict.disguise.DisguiseConfig;
+import me.libraryaddict.disguise.LibsDisguises;
+import me.libraryaddict.disguise.disguisetypes.Disguise;
+import me.libraryaddict.disguise.disguisetypes.DisguiseType;
public class EntityDisguiseCommand extends BaseDisguiseCommand {
diff --git a/src/main/java/me/libraryaddict/disguise/commands/HelpDisguiseCommand.java b/src/me/libraryaddict/disguise/commands/HelpDisguiseCommand.java
similarity index 99%
rename from src/main/java/me/libraryaddict/disguise/commands/HelpDisguiseCommand.java
rename to src/me/libraryaddict/disguise/commands/HelpDisguiseCommand.java
index 2656a21f..c6b78d7f 100644
--- a/src/main/java/me/libraryaddict/disguise/commands/HelpDisguiseCommand.java
+++ b/src/me/libraryaddict/disguise/commands/HelpDisguiseCommand.java
@@ -1,10 +1,11 @@
package me.libraryaddict.disguise.commands;
-import me.libraryaddict.disguise.disguisetypes.AnimalColor;
-import me.libraryaddict.disguise.disguisetypes.DisguiseType;
-import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
-import me.libraryaddict.disguise.disguisetypes.RabbitType;
-import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.block.BlockFace;
@@ -13,11 +14,11 @@ import org.bukkit.command.CommandSender;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
+import me.libraryaddict.disguise.disguisetypes.AnimalColor;
+import me.libraryaddict.disguise.disguisetypes.DisguiseType;
+import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
+import me.libraryaddict.disguise.disguisetypes.RabbitType;
+import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
public class HelpDisguiseCommand extends BaseDisguiseCommand {
diff --git a/src/main/java/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java b/src/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java
similarity index 99%
rename from src/main/java/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java
rename to src/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java
index 8b79763f..840bd78b 100644
--- a/src/main/java/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java
+++ b/src/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java
@@ -1,12 +1,13 @@
package me.libraryaddict.disguise.commands;
-import me.libraryaddict.disguise.LibsDisguises;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
+import me.libraryaddict.disguise.LibsDisguises;
+
public class LibsDisguisesCommand implements CommandExecutor {
@Override
diff --git a/src/main/java/me/libraryaddict/disguise/commands/PlayerDisguiseCommand.java b/src/me/libraryaddict/disguise/commands/PlayerDisguiseCommand.java
similarity index 99%
rename from src/main/java/me/libraryaddict/disguise/commands/PlayerDisguiseCommand.java
rename to src/me/libraryaddict/disguise/commands/PlayerDisguiseCommand.java
index e373cde5..d986af6b 100644
--- a/src/main/java/me/libraryaddict/disguise/commands/PlayerDisguiseCommand.java
+++ b/src/me/libraryaddict/disguise/commands/PlayerDisguiseCommand.java
@@ -1,10 +1,8 @@
package me.libraryaddict.disguise.commands;
-import me.libraryaddict.disguise.DisguiseAPI;
-import me.libraryaddict.disguise.DisguiseConfig;
-import me.libraryaddict.disguise.disguisetypes.Disguise;
-import me.libraryaddict.disguise.disguisetypes.DisguiseType;
-import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
+import java.util.ArrayList;
+import java.util.HashMap;
+
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -12,8 +10,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import java.util.ArrayList;
-import java.util.HashMap;
+import me.libraryaddict.disguise.DisguiseAPI;
+import me.libraryaddict.disguise.DisguiseConfig;
+import me.libraryaddict.disguise.disguisetypes.Disguise;
+import me.libraryaddict.disguise.disguisetypes.DisguiseType;
+import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
public class PlayerDisguiseCommand extends BaseDisguiseCommand {
diff --git a/src/main/java/me/libraryaddict/disguise/commands/RadiusDisguiseCommand.java b/src/me/libraryaddict/disguise/commands/RadiusDisguiseCommand.java
similarity index 74%
rename from src/main/java/me/libraryaddict/disguise/commands/RadiusDisguiseCommand.java
rename to src/me/libraryaddict/disguise/commands/RadiusDisguiseCommand.java
index 92feb477..d80a7337 100644
--- a/src/main/java/me/libraryaddict/disguise/commands/RadiusDisguiseCommand.java
+++ b/src/me/libraryaddict/disguise/commands/RadiusDisguiseCommand.java
@@ -1,11 +1,9 @@
package me.libraryaddict.disguise.commands;
-import me.libraryaddict.disguise.DisguiseAPI;
-import me.libraryaddict.disguise.DisguiseConfig;
-import me.libraryaddict.disguise.disguisetypes.Disguise;
-import me.libraryaddict.disguise.disguisetypes.DisguiseType;
-import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
-import me.libraryaddict.disguise.utilities.ClassGetter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@@ -15,135 +13,207 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
+import me.libraryaddict.disguise.DisguiseAPI;
+import me.libraryaddict.disguise.DisguiseConfig;
+import me.libraryaddict.disguise.disguisetypes.Disguise;
+import me.libraryaddict.disguise.disguisetypes.DisguiseType;
+import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
+import me.libraryaddict.disguise.utilities.ClassGetter;
-public class RadiusDisguiseCommand extends BaseDisguiseCommand {
+public class RadiusDisguiseCommand extends BaseDisguiseCommand
+{
private int maxRadius = 30;
private ArrayList validClasses = new ArrayList<>();
- public RadiusDisguiseCommand(int maxRadius) {
+ public RadiusDisguiseCommand(int maxRadius)
+ {
this.maxRadius = maxRadius;
- for (Class c : ClassGetter.getClassesForPackage("org.bukkit.entity")) {
- if (c != Entity.class && Entity.class.isAssignableFrom(c) && c.getAnnotation(Deprecated.class) == null) {
+
+ for (Class c : ClassGetter.getClassesForPackage("org.bukkit.entity"))
+ {
+ if (c != Entity.class && Entity.class.isAssignableFrom(c) && c.getAnnotation(Deprecated.class) == null)
+ {
validClasses.add(c);
}
}
}
@Override
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- if (sender.getName().equals("CONSOLE")) {
+ public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
+ {
+ if (sender.getName().equals("CONSOLE"))
+ {
sender.sendMessage(ChatColor.RED + "You may not use this command from the console!");
return true;
}
+
HashMap, Boolean>> map = getPermissions(sender);
- if (map.isEmpty()) {
+
+ if (map.isEmpty())
+ {
sender.sendMessage(ChatColor.RED + "You are forbidden to use this command.");
return true;
}
- if (args.length == 0) {
+
+ if (args.length == 0)
+ {
sendCommandUsage(sender, map);
return true;
}
- if (args[0].equalsIgnoreCase("entitytype") || args[0].equalsIgnoreCase("entitytypes")) {
+
+ if (args[0].equalsIgnoreCase("entitytype") || args[0].equalsIgnoreCase("entitytypes"))
+ {
ArrayList classes = new ArrayList<>();
- for (Class c : validClasses) {
+
+ for (Class c : validClasses)
+ {
classes.add(c.getSimpleName());
}
+
Collections.sort(classes);
+
sender.sendMessage(ChatColor.DARK_GREEN + "EntityTypes usable are: " + ChatColor.GREEN
+ StringUtils.join(classes, ChatColor.DARK_GREEN + ", " + ChatColor.GREEN) + ChatColor.DARK_GREEN + ".");
return true;
}
+
Class entityClass = Entity.class;
EntityType type = null;
int starting = 0;
- if (!isNumeric(args[0])) {
- for (Class c : validClasses) {
- if (c.getSimpleName().equalsIgnoreCase(args[0])) {
+
+ if (!isNumeric(args[0]))
+ {
+ for (Class c : validClasses)
+ {
+ if (c.getSimpleName().equalsIgnoreCase(args[0]))
+ {
entityClass = c;
starting = 1;
break;
}
}
- if (starting == 0) {
- try {
+
+ if (starting == 0)
+ {
+ try
+ {
type = EntityType.valueOf(args[0].toUpperCase());
- } catch (Exception ex) {
}
- if (type == null) {
+ catch (Exception ex)
+ {
+ }
+
+ if (type == null)
+ {
sender.sendMessage(ChatColor.RED + "Unrecognised EntityType " + args[0]);
return true;
}
}
}
- if (args.length == starting + 1) {
+
+ if (args.length == starting + 1)
+ {
sender.sendMessage(ChatColor.RED + "You need to supply a disguise as well as the radius"
+ (starting != 0 ? " and EntityType" : ""));
return true;
}
- if (!isNumeric(args[starting])) {
+
+ if (!isNumeric(args[starting]))
+ {
sender.sendMessage(ChatColor.RED + args[starting] + " is not a number");
return true;
}
+
int radius = Integer.parseInt(args[starting]);
- if (radius > maxRadius) {
+
+ if (radius > maxRadius)
+ {
sender.sendMessage(ChatColor.RED + "Limited radius to " + maxRadius + "! Don't want to make too much lag right?");
radius = maxRadius;
}
+
String[] newArgs = new String[args.length - (starting + 1)];
System.arraycopy(args, starting + 1, newArgs, 0, newArgs.length);
Disguise disguise;
- try {
+
+ try
+ {
disguise = parseDisguise(sender, newArgs, map);
- } catch (DisguiseParseException ex) {
- if (ex.getMessage() != null) {
+ }
+ catch (DisguiseParseException ex)
+ {
+ if (ex.getMessage() != null)
+ {
sender.sendMessage(ex.getMessage());
}
+
return true;
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace(System.out);
return true;
- } // Time to use it!
+ }
+
+ // Time to use it!
int disguisedEntitys = 0;
int miscDisguises = 0;
- for (Entity entity : ((Player) sender).getNearbyEntities(radius, radius, radius)) {
- if (entity == sender) {
+
+ for (Entity entity : ((Player) sender).getNearbyEntities(radius, radius, radius))
+ {
+ if (entity == sender)
+ {
continue;
}
- if (type != null ? entity.getType() == type : entityClass.isAssignableFrom(entity.getClass())) {
+
+ if (type != null ? entity.getType() == type : entityClass.isAssignableFrom(entity.getClass()))
+ {
if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled()
- && entity instanceof LivingEntity) {
+ && entity instanceof LivingEntity)
+ {
miscDisguises++;
continue;
}
+
disguise = disguise.clone();
- if (entity instanceof Player && DisguiseConfig.isNameOfPlayerShownAboveDisguise()) {
- if (disguise.getWatcher() instanceof LivingWatcher) {
+
+ if (entity instanceof Player && DisguiseConfig.isNameOfPlayerShownAboveDisguise())
+ {
+ if (disguise.getWatcher() instanceof LivingWatcher)
+ {
disguise.getWatcher().setCustomName(((Player) entity).getDisplayName());
- if (DisguiseConfig.isNameAboveHeadAlwaysVisible()) {
+ if (DisguiseConfig.isNameAboveHeadAlwaysVisible())
+ {
disguise.getWatcher().setCustomNameVisible(true);
}
}
}
+
DisguiseAPI.disguiseToAll(entity, disguise);
- if (disguise.isDisguiseInUse()) {
+
+ if (disguise.isDisguiseInUse())
+ {
disguisedEntitys++;
}
}
}
- if (disguisedEntitys > 0) {
+
+ if (disguisedEntitys > 0)
+ {
sender.sendMessage(ChatColor.RED + "Successfully disguised " + disguisedEntitys + " entities!");
- } else {
+ }
+ else
+ {
sender.sendMessage(ChatColor.RED + "Couldn't find any entities to disguise!");
}
- if (miscDisguises > 0) {
+
+ if (miscDisguises > 0)
+ {
sender.sendMessage(ChatColor.RED + "Failed to disguise " + miscDisguises
+ " entities because the option to disguise a living entity as a non-living has been disabled in the config");
}
+
return true;
}
@@ -151,25 +221,34 @@ public class RadiusDisguiseCommand extends BaseDisguiseCommand {
* Send the player the information
*/
@Override
- protected void sendCommandUsage(CommandSender sender, HashMap, Boolean>> map) {
+ protected void sendCommandUsage(CommandSender sender, HashMap, Boolean>> map)
+ {
ArrayList allowedDisguises = getAllowedDisguises(map);
+
sender.sendMessage(ChatColor.DARK_GREEN + "Disguise all entities in a radius! Caps at 30 blocks!");
sender.sendMessage(ChatColor.DARK_GREEN + "You can use the disguises: " + ChatColor.GREEN
+ StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN));
+
String optional = ChatColor.DARK_GREEN + "(" + ChatColor.GREEN + "Optional" + ChatColor.DARK_GREEN + ")";
- if (allowedDisguises.contains("player")) {
+
+ if (allowedDisguises.contains("player"))
+ {
sender.sendMessage((ChatColor.DARK_GREEN + "/disguiseradius player ")
.replace("<", "<" + ChatColor.GREEN).replace(">", ChatColor.DARK_GREEN + ">"));
}
+
sender.sendMessage((ChatColor.DARK_GREEN + "/disguiseradius ").replace("<", "<" + ChatColor.GREEN).replace(">", ChatColor.DARK_GREEN + ">"));
- if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) {
+
+ if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block"))
+ {
sender.sendMessage((ChatColor.DARK_GREEN + "/disguiseradius ").replace("<",
- "<" + ChatColor.GREEN).replace(">", ChatColor.DARK_GREEN + ">"));
+ + "> ")
+ .replace("<", "<" + ChatColor.GREEN).replace(">", ChatColor.DARK_GREEN + ">"));
}
- sender.sendMessage(ChatColor.DARK_GREEN + "See the EntityType's usable by " + ChatColor.GREEN
- + "/disguiseradius EntityTypes");
+
+ sender.sendMessage(
+ ChatColor.DARK_GREEN + "See the EntityType's usable by " + ChatColor.GREEN + "/disguiseradius EntityTypes");
}
}
diff --git a/src/main/java/me/libraryaddict/disguise/commands/UndisguiseCommand.java b/src/me/libraryaddict/disguise/commands/UndisguiseCommand.java
similarity index 100%
rename from src/main/java/me/libraryaddict/disguise/commands/UndisguiseCommand.java
rename to src/me/libraryaddict/disguise/commands/UndisguiseCommand.java
index 25fe14c4..f2be148b 100644
--- a/src/main/java/me/libraryaddict/disguise/commands/UndisguiseCommand.java
+++ b/src/me/libraryaddict/disguise/commands/UndisguiseCommand.java
@@ -1,7 +1,5 @@
package me.libraryaddict.disguise.commands;
-import me.libraryaddict.disguise.DisguiseAPI;
-
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -9,6 +7,8 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
+import me.libraryaddict.disguise.DisguiseAPI;
+
public class UndisguiseCommand implements CommandExecutor {
@Override
diff --git a/src/main/java/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.java b/src/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.java
similarity index 99%
rename from src/main/java/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.java
rename to src/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.java
index 98ad3190..1f42f994 100644
--- a/src/main/java/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.java
+++ b/src/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.java
@@ -1,11 +1,12 @@
package me.libraryaddict.disguise.commands;
-import me.libraryaddict.disguise.LibsDisguises;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
+import me.libraryaddict.disguise.LibsDisguises;
+
public class UndisguiseEntityCommand implements CommandExecutor {
@Override
diff --git a/src/main/java/me/libraryaddict/disguise/commands/UndisguisePlayerCommand.java b/src/me/libraryaddict/disguise/commands/UndisguisePlayerCommand.java
similarity index 100%
rename from src/main/java/me/libraryaddict/disguise/commands/UndisguisePlayerCommand.java
rename to src/me/libraryaddict/disguise/commands/UndisguisePlayerCommand.java
index 82b9a6b0..22844f41 100644
--- a/src/main/java/me/libraryaddict/disguise/commands/UndisguisePlayerCommand.java
+++ b/src/me/libraryaddict/disguise/commands/UndisguisePlayerCommand.java
@@ -1,7 +1,5 @@
package me.libraryaddict.disguise.commands;
-import me.libraryaddict.disguise.DisguiseAPI;
-
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@@ -9,6 +7,8 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
+import me.libraryaddict.disguise.DisguiseAPI;
+
public class UndisguisePlayerCommand implements CommandExecutor {
@Override
diff --git a/src/main/java/me/libraryaddict/disguise/commands/UndisguiseRadiusCommand.java b/src/me/libraryaddict/disguise/commands/UndisguiseRadiusCommand.java
similarity index 100%
rename from src/main/java/me/libraryaddict/disguise/commands/UndisguiseRadiusCommand.java
rename to src/me/libraryaddict/disguise/commands/UndisguiseRadiusCommand.java
index a22269c6..37580860 100644
--- a/src/main/java/me/libraryaddict/disguise/commands/UndisguiseRadiusCommand.java
+++ b/src/me/libraryaddict/disguise/commands/UndisguiseRadiusCommand.java
@@ -1,7 +1,5 @@
package me.libraryaddict.disguise.commands;
-import me.libraryaddict.disguise.DisguiseAPI;
-
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -9,6 +7,8 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
+import me.libraryaddict.disguise.DisguiseAPI;
+
public class UndisguiseRadiusCommand implements CommandExecutor {
private int maxRadius = 30;
diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/AnimalColor.java b/src/me/libraryaddict/disguise/disguisetypes/AnimalColor.java
similarity index 65%
rename from src/main/java/me/libraryaddict/disguise/disguisetypes/AnimalColor.java
rename to src/me/libraryaddict/disguise/disguisetypes/AnimalColor.java
index 20ad534d..7382c816 100644
--- a/src/main/java/me/libraryaddict/disguise/disguisetypes/AnimalColor.java
+++ b/src/me/libraryaddict/disguise/disguisetypes/AnimalColor.java
@@ -1,29 +1,35 @@
package me.libraryaddict.disguise.disguisetypes;
-public enum AnimalColor {
-
+public enum AnimalColor
+{
BLACK(15), BLUE(11), BROWN(12), CYAN(9), GRAY(7), GREEN(13), LIGHT_BLUE(3), LIME(5), MAGENTA(2), ORANGE(1), PINK(6), PURPLE(
10), RED(14), SILVER(8), WHITE(0), YELLOW(4);
- public static AnimalColor getColor(int nmsId) {
- for (AnimalColor color : values()) {
- if (color.getId() == nmsId) {
+ public static AnimalColor getColor(int nmsId)
+ {
+ for (AnimalColor color : values())
+ {
+ if (color.getId() == nmsId)
+ {
return color;
}
}
+
return null;
}
private int value;
- AnimalColor(int newValue) {
+ AnimalColor(int newValue)
+ {
value = newValue;
}
/**
* The color ID as defined by nms internals.
*/
- public int getId() {
+ public int getId()
+ {
return value;
}
}
diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java b/src/me/libraryaddict/disguise/disguisetypes/Disguise.java
similarity index 67%
rename from src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java
rename to src/me/libraryaddict/disguise/disguisetypes/Disguise.java
index 18baec28..0cfb3003 100644
--- a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java
+++ b/src/me/libraryaddict/disguise/disguisetypes/Disguise.java
@@ -1,9 +1,29 @@
package me.libraryaddict.disguise.disguisetypes;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.UUID;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Horse.Variant;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Skeleton.SkeletonType;
+import org.bukkit.entity.Villager.Profession;
+import org.bukkit.scheduler.BukkitTask;
+import org.bukkit.util.Vector;
+
import com.comphenix.protocol.PacketType.Play.Server;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.reflect.StructureModifier;
+
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.DisguiseConfig;
import me.libraryaddict.disguise.LibsDisguises;
@@ -20,27 +40,9 @@ import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.DisguiseValues;
import me.libraryaddict.disguise.utilities.PacketsManager;
import me.libraryaddict.disguise.utilities.ReflectionManager;
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Horse.Variant;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Skeleton.SkeletonType;
-import org.bukkit.entity.Villager.Profession;
-import org.bukkit.scheduler.BukkitTask;
-import org.bukkit.util.Vector;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.UUID;
-
-public abstract class Disguise {
+public abstract class Disguise
+{
private boolean disguiseInUse;
private DisguiseType disguiseType;
private Entity entity;
@@ -67,252 +69,363 @@ public abstract class Disguise {
/**
* Seems I do this method so I can make cleaner constructors on disguises..
*
- * @param newType The disguise
+ * @param newType
+ * The disguise
*/
- protected void createDisguise(DisguiseType newType) {
- if (getWatcher() != null) {
+ protected void createDisguise(DisguiseType newType)
+ {
+ if (getWatcher() != null)
+ {
return;
}
- if (newType.getEntityType() == null) {
- throw new RuntimeException(
- "DisguiseType "
- + newType
+
+ if (newType.getEntityType() == null)
+ {
+ throw new RuntimeException("DisguiseType " + newType
+ " was used in a futile attempt to construct a disguise, but this version of Spigot does not have that entity");
}
+
// Set the disguise type
disguiseType = newType;
// Get if they are a adult now..
+
boolean isAdult = true;
- if (isMobDisguise()) {
+
+ if (isMobDisguise())
+ {
isAdult = ((MobDisguise) this).isAdult();
}
- try {
+
+ try
+ {
// Construct the FlagWatcher from the stored class
setWatcher((FlagWatcher) getType().getWatcherClass().getConstructor(Disguise.class).newInstance(this));
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
+
// Set the disguise if its a baby or not
- if (!isAdult) {
- if (getWatcher() instanceof AgeableWatcher) {
+ if (!isAdult)
+ {
+ if (getWatcher() instanceof AgeableWatcher)
+ {
((AgeableWatcher) getWatcher()).setBaby(true);
- } else if (getWatcher() instanceof ZombieWatcher) {
+ }
+ else if (getWatcher() instanceof ZombieWatcher)
+ {
((ZombieWatcher) getWatcher()).setBaby(true);
}
}
+
// If the disguise type is a wither, set the flagwatcher value for the skeleton to a wither skeleton
- if (getType() == DisguiseType.WITHER_SKELETON) {
- ((SkeletonWatcher)getWatcher()).setType(SkeletonType.WITHER);
+ if (getType() == DisguiseType.WITHER_SKELETON)
+ {
+ ((SkeletonWatcher) getWatcher()).setType(SkeletonType.WITHER);
} // Else if its a zombie, but the disguise type is a zombie villager. Set the value.
- else if (getType() == DisguiseType.ZOMBIE_VILLAGER) {
- ((ZombieWatcher)getWatcher()).setProfession(Profession.values()[DisguiseUtilities.random.nextInt(Profession.values().length)]);
- } else if (getType() == DisguiseType.ELDER_GUARDIAN) {
- ((GuardianWatcher)getWatcher()).setElder(true);
+ else if (getType() == DisguiseType.ZOMBIE_VILLAGER)
+ {
+ ((ZombieWatcher) getWatcher())
+ .setProfession(Profession.values()[DisguiseUtilities.random.nextInt(Profession.values().length)]);
+ }
+ else if (getType() == DisguiseType.ELDER_GUARDIAN)
+ {
+ ((GuardianWatcher) getWatcher()).setElder(true);
} // Else if its a horse. Set the horse watcher type
- else if (getWatcher() instanceof HorseWatcher) {
- try {
+ else if (getWatcher() instanceof HorseWatcher)
+ {
+ try
+ {
Variant horseType = Variant.valueOf(getType().name());
- ((HorseWatcher)getWatcher()).setVariant(horseType);
- } catch (Exception ex) {
+ ((HorseWatcher) getWatcher()).setVariant(horseType);
+ }
+ catch (Exception ex)
+ {
// Ok.. So it aint a horse
}
}
+
final boolean alwaysSendVelocity;
- switch (getType()) {
- case EGG:
- case ENDER_PEARL:
- case BAT:
- case EXPERIENCE_ORB:
- case FIREBALL:
- case SMALL_FIREBALL:
- case SNOWBALL:
- case SPLASH_POTION:
- case THROWN_EXP_BOTTLE:
- case WITHER_SKULL:
- case FIREWORK:
- alwaysSendVelocity = true;
- break;
- default:
- alwaysSendVelocity = false;
- break;
+
+ switch (getType())
+ {
+ case EGG:
+ case ENDER_PEARL:
+ case BAT:
+ case EXPERIENCE_ORB:
+ case FIREBALL:
+ case SMALL_FIREBALL:
+ case SNOWBALL:
+ case SPLASH_POTION:
+ case THROWN_EXP_BOTTLE:
+ case WITHER_SKULL:
+ case FIREWORK:
+ alwaysSendVelocity = true;
+ break;
+ default:
+ alwaysSendVelocity = false;
+ break;
}
+
double velocitySpeed = 0.0005;
- switch (getType()) {
- case FIREWORK:
- velocitySpeed = -0.040;
- break;
- case WITHER_SKULL:
- velocitySpeed = 0.000001D;
- break;
- case ARROW:
- case TIPPED_ARROW:
- case SPECTRAL_ARROW:
- case BOAT:
- case ENDER_CRYSTAL:
- case ENDER_DRAGON:
- case GHAST:
- case ITEM_FRAME:
- case MINECART:
- case MINECART_CHEST:
- case MINECART_COMMAND:
- case MINECART_FURNACE:
- case MINECART_HOPPER:
- case MINECART_MOB_SPAWNER:
- case MINECART_TNT:
- case PAINTING:
- case PLAYER:
- case SQUID:
- velocitySpeed = 0;
- break;
- case DROPPED_ITEM:
- case PRIMED_TNT:
- case WITHER:
- case FALLING_BLOCK:
- velocitySpeed = 0.04;
- break;
- case EXPERIENCE_ORB:
- velocitySpeed = 0.0221;
- break;
- case SPIDER:
- case BAT:
- case CAVE_SPIDER:
- velocitySpeed = 0.004;
- break;
- default:
- break;
+
+ switch (getType())
+ {
+ case FIREWORK:
+ velocitySpeed = -0.040;
+ break;
+ case WITHER_SKULL:
+ velocitySpeed = 0.000001D;
+ break;
+ case ARROW:
+ case TIPPED_ARROW:
+ case SPECTRAL_ARROW:
+ case BOAT:
+ case ENDER_CRYSTAL:
+ case ENDER_DRAGON:
+ case GHAST:
+ case ITEM_FRAME:
+ case MINECART:
+ case MINECART_CHEST:
+ case MINECART_COMMAND:
+ case MINECART_FURNACE:
+ case MINECART_HOPPER:
+ case MINECART_MOB_SPAWNER:
+ case MINECART_TNT:
+ case PAINTING:
+ case PLAYER:
+ case SQUID:
+ velocitySpeed = 0;
+ break;
+ case DROPPED_ITEM:
+ case PRIMED_TNT:
+ case WITHER:
+ case FALLING_BLOCK:
+ velocitySpeed = 0.04;
+ break;
+ case EXPERIENCE_ORB:
+ velocitySpeed = 0.0221;
+ break;
+ case SPIDER:
+ case BAT:
+ case CAVE_SPIDER:
+ velocitySpeed = 0.004;
+ break;
+ default:
+ break;
}
+
final double vectorY = velocitySpeed;
+
final TargetedDisguise disguise = (TargetedDisguise) this;
+
// A scheduler to clean up any unused disguises.
- velocityRunnable = new Runnable() {
+ velocityRunnable = new Runnable()
+ {
private int blockX, blockY, blockZ, facing;
private int deadTicks = 0;
private int refreshDisguise = 0;
@Override
- public void run() {
+ public void run()
+ {
// If entity is no longer valid. Remove it.
- if (!getEntity().isValid()) {
+ if (!getEntity().isValid())
+ {
// If it has been dead for 30+ ticks
// This is to ensure that this disguise isn't removed while clients think its the real entity
// The delay is because if it sends the destroy entity packets straight away, then it means no death animation
// This is probably still a problem for wither and enderdragon deaths.
- if (deadTicks++ > (getType() == DisguiseType.ENDER_DRAGON ? 200 : 20)) {
+ if (deadTicks++ > (getType() == DisguiseType.ENDER_DRAGON ? 200 : 20))
+ {
deadTicks = 0;
- if (isRemoveDisguiseOnDeath()) {
+
+ if (isRemoveDisguiseOnDeath())
+ {
removeDisguise();
- } else {
+ }
+ else
+ {
entity = null;
watcher = getWatcher().clone(disguise);
task.cancel();
task = null;
}
}
- } else {
+ }
+ else
+ {
deadTicks = 0;
+
// If the disguise type is tnt, we need to resend the entity packet else it will turn invisible
- if (getType() == DisguiseType.PRIMED_TNT || getType() == DisguiseType.FIREWORK) {
+ if (getType() == DisguiseType.PRIMED_TNT || getType() == DisguiseType.FIREWORK)
+ {
refreshDisguise++;
- if (refreshDisguise % 40 == 0) {
+
+ if (refreshDisguise % 40 == 0)
+ {
refreshDisguise = 0;
+
DisguiseUtilities.refreshTrackers(disguise);
}
}
- if (getType() == DisguiseType.ITEM_FRAME) {
+
+ if (getType() == DisguiseType.ITEM_FRAME)
+ {
Location loc = getEntity().getLocation();
+
int newFacing = (((int) loc.getYaw() + 720 + 45) / 90) % 4;
+
if (loc.getBlockX() != blockX || loc.getBlockY() != blockY || loc.getBlockZ() != blockZ
- || newFacing != facing) {
+ || newFacing != facing)
+ {
blockX = loc.getBlockX();
blockY = loc.getBlockY();
blockZ = loc.getBlockZ();
facing = newFacing;
+
DisguiseUtilities.refreshTrackers(disguise);
}
}
- if (isModifyBoundingBox()) {
+
+ if (isModifyBoundingBox())
+ {
DisguiseUtilities.doBoundingBox(disguise);
}
- if (getType() == DisguiseType.BAT && !((BatWatcher) getWatcher()).isHanging()) {
+
+ if (getType() == DisguiseType.BAT && !((BatWatcher) getWatcher()).isHanging())
+ {
return;
}
+
// If the vectorY isn't 0. Cos if it is. Then it doesn't want to send any vectors.
// If this disguise has velocity sending enabled and the entity is flying.
- if (isVelocitySent() && vectorY != 0 && (alwaysSendVelocity || !getEntity().isOnGround())) {
+ if (isVelocitySent() && vectorY != 0 && (alwaysSendVelocity || !getEntity().isOnGround()))
+ {
Vector vector = getEntity().getVelocity();
+
// If the entity doesn't have velocity changes already - You know. I really can't wrap my head about the
// if statement.
// But it doesn't seem to do anything wrong..
- if (vector.getY() != 0 && !(vector.getY() < 0 && alwaysSendVelocity && getEntity().isOnGround())) {
+ if (vector.getY() != 0 && !(vector.getY() < 0 && alwaysSendVelocity && getEntity().isOnGround()))
+ {
return;
}
+
// If disguise isn't a experience orb, or the entity isn't standing on the ground
- if (getType() != DisguiseType.EXPERIENCE_ORB || !getEntity().isOnGround()) {
+ if (getType() != DisguiseType.EXPERIENCE_ORB || !getEntity().isOnGround())
+ {
PacketContainer lookPacket = null;
- if (getType() == DisguiseType.WITHER_SKULL && DisguiseConfig.isWitherSkullPacketsEnabled()) {
+
+ if (getType() == DisguiseType.WITHER_SKULL && DisguiseConfig.isWitherSkullPacketsEnabled())
+ {
lookPacket = new PacketContainer(Server.ENTITY_LOOK);
+
StructureModifier