diff --git a/.gitignore b/.gitignore
index 5ac01408..e07b945b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,6 +16,10 @@ local.properties
.settings/
.loadpath
target/
+build
+lib
+dist
+
# External tool builders
.externalToolBuilders/
@@ -214,3 +218,4 @@ pip-log.txt
#Mr Developer
.mr.developer.cfg
+/.nb-gradle/private/
\ No newline at end of file
diff --git a/.gradle/2.2.1/taskArtifacts/cache.properties b/.gradle/2.2.1/taskArtifacts/cache.properties
new file mode 100644
index 00000000..6dc41ef8
--- /dev/null
+++ b/.gradle/2.2.1/taskArtifacts/cache.properties
@@ -0,0 +1 @@
+#Thu Feb 26 11:28:25 EST 2015
diff --git a/.gradle/2.2.1/taskArtifacts/cache.properties.lock b/.gradle/2.2.1/taskArtifacts/cache.properties.lock
new file mode 100644
index 00000000..9a517eb0
Binary files /dev/null and b/.gradle/2.2.1/taskArtifacts/cache.properties.lock differ
diff --git a/.gradle/2.2.1/taskArtifacts/fileHashes.bin b/.gradle/2.2.1/taskArtifacts/fileHashes.bin
new file mode 100644
index 00000000..7be4435d
Binary files /dev/null and b/.gradle/2.2.1/taskArtifacts/fileHashes.bin differ
diff --git a/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin b/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin
new file mode 100644
index 00000000..6ec0eca1
Binary files /dev/null and b/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin differ
diff --git a/.gradle/2.2.1/taskArtifacts/outputFileStates.bin b/.gradle/2.2.1/taskArtifacts/outputFileStates.bin
new file mode 100644
index 00000000..fd04df11
Binary files /dev/null and b/.gradle/2.2.1/taskArtifacts/outputFileStates.bin differ
diff --git a/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin b/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin
new file mode 100644
index 00000000..96726ea8
Binary files /dev/null and b/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin differ
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 00000000..0caa3150
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,57 @@
+apply plugin: 'java'
+
+sourceCompatibility = '1.8'
+ext.spigotVersion = '1.8.3-R0.1-SNAPSHOT'
+
+[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
+
+repositories {
+
+ mavenCentral()
+
+ maven {
+ name 'Spigot'
+ url 'https://hub.spigotmc.org/nexus/content/groups/public/'
+ }
+
+ maven {
+ name 'Vault-Repo'
+ url 'http://nexus.theyeticave.net/content/repositories/pub_releases'
+ }
+
+ maven {
+ name 'shadowvolt-repo'
+ url 'http://ci.shadowvolt.com/plugin/repository/everything'
+ }
+}
+
+tasks.build.doLast {
+ File export = file('build/libs/LibsDisguises.jar')
+ File dest = file('dist')
+ dest.mkdir()
+ dest.listFiles().each {
+ it.delete()
+ }
+ export.renameTo(new File(dest, "LibsDisguises.jar"))
+ file('build').delete()
+ println "Copied LibsDisguises.jar into /dist"
+ println "LibsDisguises is finished compiling, have a nice day!"
+}
+
+file('libs').mkdirs()
+
+//Retrieves spigot-1.8.jar server file from link
+ant.get src: 'https://www.dropbox.com/s/k7simfgpdun3f8q/spigot-1.8.jar?dl=1', dest: file('libs'), verbose: false, skipexisting: true
+
+jar {
+ baseName "LibsDisguises"
+}
+
+dependencies {
+ compile files(
+ 'libs/spigot-1.8.jar'
+ )
+ compile 'org.bukkit:bukkit:' + project.ext.spigotVersion
+ compile 'com.comphenix.protocol:ProtocolLib:3.6.3-SNAPSHOT'
+ testCompile group: 'junit', name: 'junit', version: '4.10'
+}
diff --git a/libs/spigot-1.8.jar b/libs/spigot-1.8.jar
new file mode 100644
index 00000000..e80458bb
Binary files /dev/null and b/libs/spigot-1.8.jar differ
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 4c7131ab..00000000
--- a/pom.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-
- 4.0.0
- LibsDisguises
- LibsDisguises
- 8.2.6-SNAPSHOT
-
-
- src
- test
- clean package
- target
- LibsDisguises
-
-
- maven-compiler-plugin
- 2.3.2
-
-
- 1.6
-
-
-
- org.apache.maven.plugins
- maven-shade-plugin
- 1.5
-
-
- package
-
- shade
-
-
-
-
- com.fasterxml.uuid:java-uuid-generator
-
-
-
-
-
-
-
-
-
- .
- true
- ${project.basedir}
-
- plugin.yml
- config.yml
- README.md
-
-
-
-
-
- UTF-8
-
-
-
-
- md_5-repo
- http://repo.md-5.net/content/groups/public/
-
-
- shadowvolt-repo
- Shadowvolt Maven Repository
- http://ci.shadowvolt.com/plugin/repository/everything/
-
-
-
-
-
- com.comphenix.protocol
- ProtocolLib
- 3.6.3-SNAPSHOT
-
-
- org.spigotmc
- spigot-api
- 1.7.8-R0.1-SNAPSHOT
-
-
- junit
- junit
- 4.11
- test
-
-
- org.spigotmc
- spigot
- 1.7.10-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
new file mode 100644
index 00000000..f0b731cb
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'LibsDisguises'
diff --git a/src/me/libraryaddict/disguise/DisguiseAPI.java b/src/main/java/me/libraryaddict/disguise/DisguiseAPI.java
similarity index 100%
rename from src/me/libraryaddict/disguise/DisguiseAPI.java
rename to src/main/java/me/libraryaddict/disguise/DisguiseAPI.java
diff --git a/src/me/libraryaddict/disguise/DisguiseConfig.java b/src/main/java/me/libraryaddict/disguise/DisguiseConfig.java
similarity index 100%
rename from src/me/libraryaddict/disguise/DisguiseConfig.java
rename to src/main/java/me/libraryaddict/disguise/DisguiseConfig.java
diff --git a/src/me/libraryaddict/disguise/DisguiseListener.java b/src/main/java/me/libraryaddict/disguise/DisguiseListener.java
similarity index 100%
rename from src/me/libraryaddict/disguise/DisguiseListener.java
rename to src/main/java/me/libraryaddict/disguise/DisguiseListener.java
diff --git a/src/me/libraryaddict/disguise/LibsDisguises.java b/src/main/java/me/libraryaddict/disguise/LibsDisguises.java
similarity index 90%
rename from src/me/libraryaddict/disguise/LibsDisguises.java
rename to src/main/java/me/libraryaddict/disguise/LibsDisguises.java
index b349c27b..35adfd10 100644
--- a/src/me/libraryaddict/disguise/LibsDisguises.java
+++ b/src/main/java/me/libraryaddict/disguise/LibsDisguises.java
@@ -15,7 +15,6 @@ import me.libraryaddict.disguise.commands.*;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
-import me.libraryaddict.disguise.disguisetypes.FutureDisguiseType;
import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.GuardianWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.HorseWatcher;
@@ -26,11 +25,9 @@ import me.libraryaddict.disguise.disguisetypes.watchers.TameableWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher;
import me.libraryaddict.disguise.utilities.DisguiseSound;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
-import me.libraryaddict.disguise.utilities.FakeBoundingBox;
import me.libraryaddict.disguise.utilities.PacketsManager;
import me.libraryaddict.disguise.utilities.ReflectionManager;
import me.libraryaddict.disguise.utilities.DisguiseValues;
-import me.libraryaddict.disguise.utilities.ReflectionManager.LibVersion;
import org.bukkit.Bukkit;
import org.bukkit.entity.Ageable;
@@ -154,7 +151,7 @@ public class LibsDisguises extends JavaPlugin {
*/
private void registerValues() {
for (DisguiseType disguiseType : DisguiseType.values()) {
- if (disguiseType.getEntityType() == null && !(disguiseType.is1_8() && LibVersion.is1_8())) {
+ if (disguiseType.getEntityType() == null) {
continue;
}
Class watcherClass = null;
@@ -209,25 +206,6 @@ public class LibsDisguises extends JavaPlugin {
if (DisguiseValues.getDisguiseValues(disguiseType) != null) {
continue;
}
- if (disguiseType.is1_8()) {
- int entitySize = 0;
- FutureDisguiseType futureType = disguiseType.getFutureType();
- DisguiseValues disguiseValues = new DisguiseValues(disguiseType, null, entitySize, futureType.getMaxHealth());
- Object[] objs = disguiseType.getFutureType().getDataWatcher();
- for (int i = 0; i < objs.length; i += 2) {
- disguiseValues.setMetaValue((Integer) objs[i], objs[i + 1]);
- }
-
- // Get the bounding box
- float[] box = futureType.getBoundingBox();
- disguiseValues.setAdultBox(new FakeBoundingBox(box[0], box[1], box[2]));
- /* if (disguiseType == DisguiseType.RABBIT) {
- ((Ageable) bukkitEntity).setBaby();
- disguiseValues.setBabyBox(ReflectionManager.getBoundingBox(bukkitEntity));
- }
- disguiseValues.setEntitySize(ReflectionManager.getSize(bukkitEntity));*/
- continue;
- }
String nmsEntityName = toReadable(disguiseType.name());
switch (disguiseType) {
case WITHER_SKELETON:
@@ -264,6 +242,9 @@ public class LibsDisguises extends JavaPlugin {
case LEASH_HITCH:
nmsEntityName = "Leash";
break;
+ case ELDER_GUARDIAN:
+ nmsEntityName = "Guardian";
+ break;
default:
break;
}
diff --git a/src/me/libraryaddict/disguise/commands/DisguiseCloneCommand.java b/src/main/java/me/libraryaddict/disguise/commands/DisguiseCloneCommand.java
similarity index 100%
rename from src/me/libraryaddict/disguise/commands/DisguiseCloneCommand.java
rename to src/main/java/me/libraryaddict/disguise/commands/DisguiseCloneCommand.java
diff --git a/src/me/libraryaddict/disguise/commands/DisguiseCommand.java b/src/main/java/me/libraryaddict/disguise/commands/DisguiseCommand.java
similarity index 100%
rename from src/me/libraryaddict/disguise/commands/DisguiseCommand.java
rename to src/main/java/me/libraryaddict/disguise/commands/DisguiseCommand.java
diff --git a/src/me/libraryaddict/disguise/commands/DisguiseEntityCommand.java b/src/main/java/me/libraryaddict/disguise/commands/DisguiseEntityCommand.java
similarity index 100%
rename from src/me/libraryaddict/disguise/commands/DisguiseEntityCommand.java
rename to src/main/java/me/libraryaddict/disguise/commands/DisguiseEntityCommand.java
diff --git a/src/me/libraryaddict/disguise/commands/DisguiseHelpCommand.java b/src/main/java/me/libraryaddict/disguise/commands/DisguiseHelpCommand.java
similarity index 100%
rename from src/me/libraryaddict/disguise/commands/DisguiseHelpCommand.java
rename to src/main/java/me/libraryaddict/disguise/commands/DisguiseHelpCommand.java
diff --git a/src/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java b/src/main/java/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java
similarity index 100%
rename from src/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java
rename to src/main/java/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java
diff --git a/src/me/libraryaddict/disguise/commands/DisguiseRadiusCommand.java b/src/main/java/me/libraryaddict/disguise/commands/DisguiseRadiusCommand.java
similarity index 100%
rename from src/me/libraryaddict/disguise/commands/DisguiseRadiusCommand.java
rename to src/main/java/me/libraryaddict/disguise/commands/DisguiseRadiusCommand.java
diff --git a/src/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java b/src/main/java/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java
similarity index 100%
rename from src/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java
rename to src/main/java/me/libraryaddict/disguise/commands/LibsDisguisesCommand.java
diff --git a/src/me/libraryaddict/disguise/commands/UndisguiseCommand.java b/src/main/java/me/libraryaddict/disguise/commands/UndisguiseCommand.java
similarity index 100%
rename from src/me/libraryaddict/disguise/commands/UndisguiseCommand.java
rename to src/main/java/me/libraryaddict/disguise/commands/UndisguiseCommand.java
diff --git a/src/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.java b/src/main/java/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.java
similarity index 100%
rename from src/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.java
rename to src/main/java/me/libraryaddict/disguise/commands/UndisguiseEntityCommand.java
diff --git a/src/me/libraryaddict/disguise/commands/UndisguisePlayerCommand.java b/src/main/java/me/libraryaddict/disguise/commands/UndisguisePlayerCommand.java
similarity index 100%
rename from src/me/libraryaddict/disguise/commands/UndisguisePlayerCommand.java
rename to src/main/java/me/libraryaddict/disguise/commands/UndisguisePlayerCommand.java
diff --git a/src/me/libraryaddict/disguise/commands/UndisguiseRadiusCommand.java b/src/main/java/me/libraryaddict/disguise/commands/UndisguiseRadiusCommand.java
similarity index 100%
rename from src/me/libraryaddict/disguise/commands/UndisguiseRadiusCommand.java
rename to src/main/java/me/libraryaddict/disguise/commands/UndisguiseRadiusCommand.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/AnimalColor.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/AnimalColor.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/AnimalColor.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/AnimalColor.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/Disguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java
similarity index 99%
rename from src/me/libraryaddict/disguise/disguisetypes/Disguise.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java
index 290811bb..6a492c6e 100644
--- a/src/me/libraryaddict/disguise/disguisetypes/Disguise.java
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java
@@ -64,7 +64,7 @@ public abstract class Disguise {
protected void createDisguise(DisguiseType newType) {
if (getWatcher() != null)
return;
- if (!(LibVersion.is1_8() && newType.is1_8()) && newType.getEntityType() == null) {
+ if (newType.getEntityType() == null) {
throw new RuntimeException(
"DisguiseType "
+ newType
@@ -101,7 +101,7 @@ public abstract class Disguise {
}
else if (getType() == DisguiseType.ELDER_GUARDIAN) {
- getWatcher().setValue(14, 0 | 4);
+ getWatcher().setValue(16, 0 | 4);
}
// Else if its a horse. Set the horse watcher type
else if (getWatcher() instanceof HorseWatcher) {
diff --git a/src/me/libraryaddict/disguise/disguisetypes/DisguiseType.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.java
similarity index 85%
rename from src/me/libraryaddict/disguise/disguisetypes/DisguiseType.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.java
index 664792bd..b811f723 100644
--- a/src/me/libraryaddict/disguise/disguisetypes/DisguiseType.java
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/DisguiseType.java
@@ -2,17 +2,16 @@ package me.libraryaddict.disguise.disguisetypes;
import java.lang.reflect.Method;
-import me.libraryaddict.disguise.utilities.ReflectionManager.LibVersion;
-
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;
public enum DisguiseType {
- ARMOR_STAND(FutureDisguiseType.ARMOR_STAND),
+ ARMOR_STAND(78),
ARROW(60),
@@ -36,7 +35,7 @@ public enum DisguiseType {
EGG(62),
- ELDER_GUARDIAN(FutureDisguiseType.ELDER_GUARDIAN),
+ ELDER_GUARDIAN,
ENDER_CRYSTAL(51),
@@ -48,7 +47,7 @@ public enum DisguiseType {
ENDERMAN,
- ENDERMITE(FutureDisguiseType.ENDERMITE),
+ ENDERMITE,
EXPERIENCE_ORB,
@@ -64,7 +63,7 @@ public enum DisguiseType {
GIANT,
- GUARDIAN(FutureDisguiseType.GUARDIAN),
+ GUARDIAN,
HORSE,
@@ -106,7 +105,7 @@ public enum DisguiseType {
PRIMED_TNT(50),
- RABBIT(FutureDisguiseType.RABBIT),
+ RABBIT,
SHEEP,
@@ -150,7 +149,7 @@ public enum DisguiseType {
ZOMBIE_VILLAGER;
- private static Method isVillager, getVariant, getSkeletonType;
+ 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.
@@ -175,6 +174,9 @@ public enum DisguiseType {
case WITHER_SKELETON:
toUse = DisguiseType.SKELETON;
break;
+ case ELDER_GUARDIAN:
+ toUse = DisguiseType.GUARDIAN;
+ break;
default:
break;
}
@@ -196,6 +198,10 @@ public enum DisguiseType {
getSkeletonType = Skeleton.class.getMethod("getSkeletonType");
} catch (Throwable ignored) {
}
+ try {
+ isElder = Guardian.class.getMethod("isElder");
+ } catch (Throwable ignored) {
+ }
}
public static DisguiseType getType(Entity entity) {
@@ -228,6 +234,15 @@ public enum DisguiseType {
ex.printStackTrace();
}
break;
+ case GUARDIAN:
+ try {
+ if ((Boolean) isElder.invoke(entity)) {
+ disguiseType = DisguiseType.ELDER_GUARDIAN;
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ break;
default:
break;
}
@@ -244,10 +259,9 @@ public enum DisguiseType {
private int defaultId, entityId;
private EntityType entityType;
- private FutureDisguiseType futureType;
private Class extends FlagWatcher> watcherClass;
- private DisguiseType(FutureDisguiseType disguiseType, int... ints) {
+ private DisguiseType(int... ints) {
for (int i = 0; i < ints.length; i++) {
int value = ints[i];
switch (i) {
@@ -261,13 +275,6 @@ public enum DisguiseType {
break;
}
}
- if (LibVersion.is1_8()) {
- futureType = disguiseType;
- }
- }
-
- private DisguiseType(int... ints) {
- this(null, ints);
}
public int getDefaultId() {
@@ -275,9 +282,6 @@ public enum DisguiseType {
}
public Class extends Entity> getEntityClass() {
- if (futureType != null) {
- return futureType.getEntityClass();
- }
if (entityType != null) {
return getEntityType().getEntityClass();
}
@@ -292,28 +296,20 @@ public enum DisguiseType {
return entityType;
}
- public FutureDisguiseType getFutureType() {
- return futureType;
- }
-
public int getTypeId() {
- return is1_8() ? futureType.getEntityId() : (int) getEntityType().getTypeId();
+ return (int) getEntityType().getTypeId();
}
public Class getWatcherClass() {
return watcherClass;
}
- public boolean is1_8() {
- return futureType != null;
- }
-
public boolean isMisc() {
- return is1_8() ? !futureType.isAlive() : getEntityType() != null && !getEntityType().isAlive();
+ return getEntityType() != null && !getEntityType().isAlive();
}
public boolean isMob() {
- return is1_8() ? futureType.isAlive() : getEntityType() != null && getEntityType().isAlive() && !isPlayer();
+ return getEntityType() != null && getEntityType().isAlive() && !isPlayer();
}
public boolean isPlayer() {
diff --git a/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java
similarity index 98%
rename from src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java
index 2d542a20..a16a4348 100644
--- a/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java
@@ -158,7 +158,7 @@ public class FlagWatcher {
}
public String getCustomName() {
- return (String) getValue(10, null);
+ return (String) getValue(2, null);
}
protected TargetedDisguise getDisguise() {
@@ -207,7 +207,7 @@ public class FlagWatcher {
}
public boolean isCustomNameVisible() {
- return (Byte) getValue(11, (byte) 0) == 1;
+ return (Byte) getValue(3, (byte) 0) == 1;
}
public boolean isEntityAnimationsAdded() {
@@ -296,13 +296,13 @@ public class FlagWatcher {
if (name != null && name.length() > 64) {
name = name.substring(0, 64);
}
- setValue(10, name);
- sendData(10);
+ setValue(2, name);
+ sendData(2);
}
public void setCustomNameVisible(boolean display) {
- setValue(11, (byte) (display ? 1 : 0));
- sendData(11);
+ setValue(3, (byte) (display ? 1 : 0));
+ sendData(3);
}
private void setFlag(int byteValue, boolean flag) {
diff --git a/src/me/libraryaddict/disguise/disguisetypes/MiscDisguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/MiscDisguise.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/MiscDisguise.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/MiscDisguise.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/MobDisguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/MobDisguise.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/MobDisguise.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/MobDisguise.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java
similarity index 85%
rename from src/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java
index 0746a3bb..08dd21a0 100644
--- a/src/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java
@@ -153,32 +153,30 @@ public class PlayerDisguise extends TargetedDisguise {
}
public PlayerDisguise setSkin(String skinToUse) {
- if (LibVersion.is1_7_6()) {
- this.skinToUse = skinToUse;
- if (skinToUse == null) {
- this.currentLookup = null;
- this.gameProfile = null;
- } else {
- if (skinToUse.length() > 16) {
- this.skinToUse = skinToUse.substring(0, 16);
- }
- currentLookup = new LibsProfileLookup() {
+ this.skinToUse = skinToUse;
+ if (skinToUse == null) {
+ this.currentLookup = null;
+ this.gameProfile = null;
+ } else {
+ if (skinToUse.length() > 16) {
+ this.skinToUse = skinToUse.substring(0, 16);
+ }
+ currentLookup = new LibsProfileLookup() {
- @Override
- public void onLookup(WrappedGameProfile gameProfile) {
- if (currentLookup == this && gameProfile != null) {
- setSkin(gameProfile);
- if (!gameProfile.getProperties().isEmpty() && DisguiseUtilities.isDisguiseInUse(PlayerDisguise.this)) {
- DisguiseUtilities.refreshTrackers(PlayerDisguise.this);
- }
- currentLookup = null;
+ @Override
+ public void onLookup(WrappedGameProfile gameProfile) {
+ if (currentLookup == this && gameProfile != null) {
+ setSkin(gameProfile);
+ if (!gameProfile.getProperties().isEmpty() && DisguiseUtilities.isDisguiseInUse(PlayerDisguise.this)) {
+ DisguiseUtilities.refreshTrackers(PlayerDisguise.this);
}
+ currentLookup = null;
}
- };
- WrappedGameProfile gameProfile = DisguiseUtilities.getProfileFromMojang(this.skinToUse, currentLookup);
- if (gameProfile != null) {
- setSkin(gameProfile);
}
+ };
+ WrappedGameProfile gameProfile = DisguiseUtilities.getProfileFromMojang(this.skinToUse, currentLookup);
+ if (gameProfile != null) {
+ setSkin(gameProfile);
}
}
return this;
diff --git a/src/me/libraryaddict/disguise/disguisetypes/RabbitType.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/RabbitType.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/RabbitType.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/RabbitType.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/TargetedDisguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/TargetedDisguise.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/TargetedDisguise.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/TargetedDisguise.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/AgeableWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/AgeableWatcher.java
similarity index 82%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/AgeableWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/AgeableWatcher.java
index fcc24855..b164717e 100644
--- a/src/me/libraryaddict/disguise/disguisetypes/watchers/AgeableWatcher.java
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/AgeableWatcher.java
@@ -17,7 +17,7 @@ public class AgeableWatcher extends LivingWatcher {
}
public boolean isBaby() {
- return (Integer) getValue(12, 0) < 0;
+ return ((Byte) getValue(12, (byte) 0)).intValue() < 0;
}
public void setAdult() {
@@ -25,7 +25,7 @@ public class AgeableWatcher extends LivingWatcher {
}
public void setAge(int newAge) {
- setValue(12, newAge);
+ setValue(12, (byte) newAge);
sendData(12);
}
@@ -34,7 +34,7 @@ public class AgeableWatcher extends LivingWatcher {
}
public void setBaby(boolean isBaby) {
- setValue(12, isBaby ? -24000 : 0);
+ setValue(12, (byte) (isBaby ? -1 : 0));
sendData(12);
}
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/ArmorStandWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ArmorStandWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/ArmorStandWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ArmorStandWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/ArrowWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ArrowWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/ArrowWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ArrowWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/BatWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/BatWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/BatWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/BatWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/BlazeWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/BlazeWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/BlazeWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/BlazeWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/BoatWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/BoatWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/BoatWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/BoatWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/CreeperWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/CreeperWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/CreeperWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/CreeperWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/DroppedItemWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/DroppedItemWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/DroppedItemWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/DroppedItemWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/EndermanWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/EndermanWatcher.java
similarity index 94%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/EndermanWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/EndermanWatcher.java
index 14323bb1..23912f5a 100644
--- a/src/me/libraryaddict/disguise/disguisetypes/watchers/EndermanWatcher.java
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/EndermanWatcher.java
@@ -36,7 +36,7 @@ public class EndermanWatcher extends LivingWatcher {
@Override
public void setItemInHand(ItemStack itemstack) {
- setValue(16, (byte) (itemstack.getTypeId() & 255));
+ setValue(16, (short) (itemstack.getTypeId() & 255));
setValue(17, (byte) (itemstack.getDurability() & 255));
}
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/GhastWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/GhastWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/GhastWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/GhastWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/GuardianWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/GuardianWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/GuardianWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/GuardianWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/HorseWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/HorseWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/HorseWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/HorseWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/ItemFrameWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ItemFrameWatcher.java
similarity index 78%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/ItemFrameWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ItemFrameWatcher.java
index 5893f269..e50d6cb4 100644
--- a/src/me/libraryaddict/disguise/disguisetypes/watchers/ItemFrameWatcher.java
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ItemFrameWatcher.java
@@ -13,11 +13,11 @@ public class ItemFrameWatcher extends FlagWatcher {
public ItemStack getItem() {
if (getValue(2, null) == null)
return new ItemStack(0);
- return (ItemStack) getValue(2, null);
+ return (ItemStack) getValue(8, null);
}
public int getRotation() {
- return (Integer) getValue(3, 0);
+ return (Integer) getValue(9, 0);
}
public void setItem(ItemStack newItem) {
@@ -25,13 +25,13 @@ public class ItemFrameWatcher extends FlagWatcher {
newItem = new ItemStack(0);
newItem = newItem.clone();
newItem.setAmount(1);
- setValue(2, newItem);
- sendData(2);
+ setValue(8, newItem);
+ sendData(8);
}
public void setRotation(int rotation) {
- setValue(3, (byte) (rotation % 4));
- sendData(3);
+ setValue(9, (byte) (rotation % 4));
+ sendData(9);
}
}
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/MinecartWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/MinecartWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/MinecartWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/MinecartWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/OcelotWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/OcelotWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/OcelotWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/OcelotWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/PaintingWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PaintingWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/PaintingWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PaintingWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/PigWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PigWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/PigWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PigWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java
similarity index 98%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java
index c17adb50..6cd3206e 100644
--- a/src/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java
+++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java
@@ -110,7 +110,7 @@ public class PlayerWatcher extends LivingWatcher {
PacketContainer packet = new PacketContainer(PacketType.Play.Server.ANIMATION);
StructureModifier mods = packet.getIntegers();
mods.write(0, getDisguise().getEntity().getEntityId());
- mods.write(1, LibVersion.is1_7() ? 3 : 2);
+ mods.write(1, 3);
for (Player player : DisguiseUtilities.getPerverts(getDisguise())) {
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/RabbitWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/RabbitWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/RabbitWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/RabbitWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/SheepWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SheepWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/SheepWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SheepWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/SlimeWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SlimeWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/SlimeWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SlimeWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/SplashPotionWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SplashPotionWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/SplashPotionWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/SplashPotionWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/TameableWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/TameableWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/TameableWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/TameableWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/VillagerWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/VillagerWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/VillagerWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/VillagerWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/WitherSkullWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WitherSkullWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/WitherSkullWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WitherSkullWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/WitherWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WitherWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/WitherWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WitherWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/WolfWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WolfWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/WolfWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/WolfWatcher.java
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/ZombieWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ZombieWatcher.java
similarity index 100%
rename from src/me/libraryaddict/disguise/disguisetypes/watchers/ZombieWatcher.java
rename to src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ZombieWatcher.java
diff --git a/src/me/libraryaddict/disguise/events/DisguiseEvent.java b/src/main/java/me/libraryaddict/disguise/events/DisguiseEvent.java
similarity index 100%
rename from src/me/libraryaddict/disguise/events/DisguiseEvent.java
rename to src/main/java/me/libraryaddict/disguise/events/DisguiseEvent.java
diff --git a/src/me/libraryaddict/disguise/events/UndisguiseEvent.java b/src/main/java/me/libraryaddict/disguise/events/UndisguiseEvent.java
similarity index 100%
rename from src/me/libraryaddict/disguise/events/UndisguiseEvent.java
rename to src/main/java/me/libraryaddict/disguise/events/UndisguiseEvent.java
diff --git a/src/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java b/src/main/java/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java
similarity index 99%
rename from src/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java
rename to src/main/java/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java
index 9bd47717..0b65d65b 100644
--- a/src/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java
+++ b/src/main/java/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java
@@ -339,7 +339,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
throw new DisguiseParseException(ChatColor.RED + "Error! The disguise " + ChatColor.GREEN + args[0]
+ ChatColor.RED + " doesn't exist!");
}
- if (!(LibVersion.is1_8() && disguiseType.is1_8()) && disguiseType.getEntityType() == null) {
+ if (disguiseType.getEntityType() == null) {
throw new DisguiseParseException(ChatColor.RED + "Error! This version of minecraft does not have that disguise!");
}
if (!map.containsKey(disguiseType)) {
diff --git a/src/me/libraryaddict/disguise/utilities/ClassGetter.java b/src/main/java/me/libraryaddict/disguise/utilities/ClassGetter.java
similarity index 100%
rename from src/me/libraryaddict/disguise/utilities/ClassGetter.java
rename to src/main/java/me/libraryaddict/disguise/utilities/ClassGetter.java
diff --git a/src/me/libraryaddict/disguise/utilities/DisguiseSound.java b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseSound.java
similarity index 98%
rename from src/me/libraryaddict/disguise/utilities/DisguiseSound.java
rename to src/main/java/me/libraryaddict/disguise/utilities/DisguiseSound.java
index 801cbd82..58441500 100644
--- a/src/me/libraryaddict/disguise/utilities/DisguiseSound.java
+++ b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseSound.java
@@ -66,8 +66,7 @@ public enum DisguiseSound {
PIG_ZOMBIE("mob.zombiepig.zpighurt", null, "mob.zombiepig.zpigdeath", "mob.zombiepig.zpig", "mob.zombiepig.zpigangry"),
- PLAYER(LibVersion.is1_7() ? "game.player.hurt" : "damage.hit", "step.grass", LibVersion.is1_7() ? "game.player.hurt"
- : "damage.hit", null),
+ PLAYER("game.player.hurt", "step.grass", "game.player.hurt", null),
RABBIT("mob.rabbit.hurt", "mob.rabbit.hop", "mob.rabbit.death", "mob.rabbit.idle"),
diff --git a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java
similarity index 88%
rename from src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java
rename to src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java
index df8eb691..e9982bc3 100644
--- a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java
+++ b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java
@@ -23,13 +23,9 @@ import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
import me.libraryaddict.disguise.disguisetypes.TargetedDisguise;
import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
-import me.libraryaddict.disguise.disguisetypes.watchers.EndermanWatcher;
-import me.libraryaddict.disguise.disguisetypes.watchers.ItemFrameWatcher;
-import me.libraryaddict.disguise.disguisetypes.watchers.MinecartWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.PlayerWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher;
import me.libraryaddict.disguise.disguisetypes.TargetedDisguise.TargetType;
-import me.libraryaddict.disguise.utilities.ReflectionManager.LibVersion;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@@ -41,6 +37,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Zombie;
import org.bukkit.inventory.ItemStack;
+import org.bukkit.potion.PotionEffect;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
@@ -97,30 +94,15 @@ public class DisguiseUtilities {
block = ((Object[]) ReflectionManager.getNmsField(ReflectionManager.getNmsClass("Block"), "byId").get(null))[Material.BED_BLOCK
.getId()];
}
-
- if (LibVersion.is1_8()) {
- Method fromLegacyData = block.getClass().getMethod("fromLegacyData", int.class);
- Method setType = chunkSection.getClass().getMethod("setType", int.class, int.class, int.class,
- ReflectionManager.getNmsClass("IBlockData"));
- Method setSky = chunkSection.getClass().getMethod("a", int.class, int.class, int.class, int.class);
- Method setEmitted = chunkSection.getClass().getMethod("b", int.class, int.class, int.class, int.class);
- for (BlockFace face : new BlockFace[] { BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH, BlockFace.SOUTH }) {
- setType.invoke(chunkSection, 1 + face.getModX(), 0, 1 + face.getModZ(), fromLegacyData.invoke(block, face.ordinal()));
- setSky.invoke(chunkSection, 1 + face.getModX(), 0, 1 + face.getModZ(), 0);
- setEmitted.invoke(chunkSection, 1 + face.getModX(), 0, 1 + face.getModZ(), 0);
- }
- } else {
- Method setId = chunkSection.getClass().getMethod("setTypeId", int.class, int.class, int.class,
- ReflectionManager.getNmsClass("Block"));
- Method setData = chunkSection.getClass().getMethod("setData", int.class, int.class, int.class, int.class);
- Method setSky = chunkSection.getClass().getMethod("setSkyLight", int.class, int.class, int.class, int.class);
- Method setEmitted = chunkSection.getClass().getMethod("setEmittedLight", int.class, int.class, int.class, int.class);
- for (BlockFace face : new BlockFace[] { BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH, BlockFace.SOUTH }) {
- setId.invoke(chunkSection, 1 + face.getModX(), 0, 1 + face.getModZ(), block);
- setData.invoke(chunkSection, 1 + face.getModX(), 0, 1 + face.getModZ(), face.ordinal());
- setSky.invoke(chunkSection, 1 + face.getModX(), 0, 1 + face.getModZ(), 0);
- setEmitted.invoke(chunkSection, 1 + face.getModX(), 0, 1 + face.getModZ(), 0);
- }
+ Method fromLegacyData = block.getClass().getMethod("fromLegacyData", int.class);
+ Method setType = chunkSection.getClass().getMethod("setType", int.class, int.class, int.class,
+ ReflectionManager.getNmsClass("IBlockData"));
+ Method setSky = chunkSection.getClass().getMethod("a", int.class, int.class, int.class, int.class);
+ Method setEmitted = chunkSection.getClass().getMethod("b", int.class, int.class, int.class, int.class);
+ for (BlockFace face : new BlockFace[] { BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH, BlockFace.SOUTH }) {
+ setType.invoke(chunkSection, 1 + face.getModX(), 0, 1 + face.getModZ(), fromLegacyData.invoke(block, face.ordinal()));
+ setSky.invoke(chunkSection, 1 + face.getModX(), 0, 1 + face.getModZ(), 0);
+ setEmitted.invoke(chunkSection, 1 + face.getModX(), 0, 1 + face.getModZ(), 0);
}
Object[] array = (Object[]) Array.newInstance(chunkSection.getClass(), 16);
@@ -341,7 +323,7 @@ public class DisguiseUtilities {
try {
packets[i] = ProtocolLibrary.getProtocolManager()
.createPacketConstructor(PacketType.Play.Server.MAP_CHUNK, bedChunk, true, 0, 40)
- .createPacket(bedChunk, true, 0, LibVersion.is1_8() ? 48 : 0);
+ .createPacket(bedChunk, true, 0, 48);
} catch (IllegalArgumentException ex) {
packets[i] = ProtocolLibrary.getProtocolManager()
.createPacketConstructor(PacketType.Play.Server.MAP_CHUNK, bedChunk, true, 0)
@@ -350,15 +332,9 @@ public class DisguiseUtilities {
i++;
// Make load packets
if (oldLoc == null || i > 1) {
- try {
- packets[i] = ProtocolLibrary.getProtocolManager()
- .createPacketConstructor(PacketType.Play.Server.MAP_CHUNK_BULK, Arrays.asList(bedChunk), 40)
- .createPacket(Arrays.asList(bedChunk), LibVersion.is1_8() ? 48 : 0);
- } catch (IllegalArgumentException ex) {
- packets[i] = ProtocolLibrary.getProtocolManager()
- .createPacketConstructor(PacketType.Play.Server.MAP_CHUNK_BULK, List.class)
- .createPacket(Arrays.asList(bedChunk));
- }
+ packets[i] = ProtocolLibrary.getProtocolManager()
+ .createPacketConstructor(PacketType.Play.Server.MAP_CHUNK_BULK, Arrays.asList(bedChunk))
+ .createPacket(Arrays.asList(bedChunk));
i++;
}
}
@@ -370,19 +346,13 @@ public class DisguiseUtilities {
PacketContainer setBed = new PacketContainer(PacketType.Play.Server.BED);
StructureModifier bedInts = setBed.getIntegers();
bedInts.write(0, entity.getEntityId());
- if (LibVersion.is1_8()) {
- PlayerWatcher watcher = disguise.getWatcher();
- int chunkX = (int) Math.floor(playerLocation.getX() / 16D) - 17, chunkZ = (int) Math
- .floor(playerLocation.getZ() / 16D) - 17;
- chunkX -= chunkX % 8;
- chunkZ -= chunkZ % 8;
- bedInts.write(1, (chunkX * 16) + 1 + watcher.getSleepingDirection().getModX());
- bedInts.write(3, (chunkZ * 16) + 1 + watcher.getSleepingDirection().getModZ());
- } else {
- bedInts.write(1, loc.getBlockX());
- bedInts.write(2, loc.getBlockY());
- bedInts.write(3, loc.getBlockZ());
- }
+ PlayerWatcher watcher = disguise.getWatcher();
+ int chunkX = (int) Math.floor(playerLocation.getX() / 16D) - 17, chunkZ = (int) Math
+ .floor(playerLocation.getZ() / 16D) - 17;
+ chunkX -= chunkX % 8;
+ chunkZ -= chunkZ % 8;
+ bedInts.write(1, (chunkX * 16) + 1 + watcher.getSleepingDirection().getModX());
+ bedInts.write(3, (chunkZ * 16) + 1 + watcher.getSleepingDirection().getModZ());
PacketContainer teleport = new PacketContainer(PacketType.Play.Server.ENTITY_TELEPORT);
StructureModifier ints = teleport.getIntegers();
ints.write(0, entity.getEntityId());
@@ -495,8 +465,8 @@ public class DisguiseUtilities {
}
if (DisguiseAPI.isDisguiseInUse(disguise)
&& (!gameProfile.getName().equals(
- disguise.getSkin() != null && LibVersion.is1_7_6() ? disguise.getSkin() : disguise.getName()) || (LibVersion
- .is1_7_6() && !gameProfile.getProperties().isEmpty()))) {
+ disguise.getSkin() != null ? disguise.getSkin() : disguise.getName())
+ || !gameProfile.getProperties().isEmpty())) {
disguise.setGameProfile(gameProfile);
DisguiseUtilities.refreshTrackers(disguise);
}
@@ -523,7 +493,7 @@ public class DisguiseUtilities {
Player player = Bukkit.getPlayerExact(playerName);
if (player != null) {
WrappedGameProfile gameProfile = ReflectionManager.getGameProfile(player);
- if (!LibVersion.is1_7_6() || !gameProfile.getProperties().isEmpty()) {
+ if (!gameProfile.getProperties().isEmpty()) {
gameProfiles.put(playerName, gameProfile);
return gameProfile;
}
@@ -536,7 +506,7 @@ public class DisguiseUtilities {
final WrappedGameProfile gameProfile = lookupGameProfile(origName);
Bukkit.getScheduler().runTask(libsDisguises, new Runnable() {
public void run() {
- if (!LibVersion.is1_7_6() || !gameProfile.getProperties().isEmpty()) {
+ if (!gameProfile.getProperties().isEmpty()) {
if (gameProfiles.containsKey(playerName) && gameProfiles.get(playerName) == null) {
gameProfiles.put(playerName, gameProfile);
}
@@ -613,54 +583,17 @@ public class DisguiseUtilities {
*/
public static List rebuildForVersion(Player player, FlagWatcher watcher,
List list) {
- if (!LibVersion.is1_8())
+ if (true) // Use for future protocol compatibility
return list;
ArrayList rebuiltList = new ArrayList();
ArrayList backups = new ArrayList();
- // TODO Player and Minecart
for (WrappedWatchableObject obj : list) {
if (obj.getValue().getClass().getName().startsWith("org.")) {
backups.add(obj);
continue;
}
switch (obj.getIndex()) {
- case 2:
- case 3:
- if (watcher instanceof ItemFrameWatcher) {
- rebuiltList.add(new WrappedWatchableObject(obj.getIndex() + 6, obj.getValue()));
- } else {
- backups.add(obj);
- }
- break;
- case 10:
- case 11:
- rebuiltList.add(new WrappedWatchableObject(obj.getIndex() - 8, obj.getValue()));
- break;
- case 12:
- if (watcher instanceof AgeableWatcher) {
- int i = (Integer) obj.getValue();
- rebuiltList.add(new WrappedWatchableObject(obj.getIndex(), (byte) (i < 0 ? -1 : (i >= 6000 ? 1 : 0))));
- } else {
- backups.add(obj);
- }
- break;
- case 16:
- if (watcher instanceof EndermanWatcher) {
- rebuiltList.add(new WrappedWatchableObject(obj.getIndex(), ((Byte) obj.getValue()).shortValue()));
- } else {
- backups.add(obj);
- }
- break;
- case 20:
- if (watcher instanceof MinecartWatcher) {
- // TODO
- backups.add(obj);
- } else {
- backups.add(obj);
- }
- default:
- backups.add(obj);
- break;
+ // TODO: Future version support
}
}
Iterator itel = backups.iterator();
@@ -687,6 +620,8 @@ public class DisguiseUtilities {
if (disguise.isDisguiseInUse() && disguise.getEntity() instanceof Player
&& ((Player) disguise.getEntity()).getName().equalsIgnoreCase(player)) {
removeSelfDisguise((Player) disguise.getEntity());
+ if (disguise.isSelfDisguiseVisible())
+ selfDisguised.add(disguise.getEntity().getUniqueId());
ProtocolLibrary.getProtocolManager().sendServerPacket((Player) disguise.getEntity(), destroyPacket);
Bukkit.getScheduler().scheduleSyncDelayedTask(libsDisguises, new Runnable() {
public void run() {
@@ -697,7 +632,6 @@ public class DisguiseUtilities {
}
}
}, 2);
- DisguiseUtilities.sendSelfDisguise((Player) disguise.getEntity(), disguise);
} else {
final Object entityTrackerEntry = ReflectionManager.getEntityTrackerEntry(disguise.getEntity());
if (entityTrackerEntry != null) {
@@ -781,6 +715,7 @@ public class DisguiseUtilities {
try {
if (selfDisguised.contains(disguise.getEntity().getUniqueId()) && disguise.isDisguiseInUse()) {
removeSelfDisguise((Player) disguise.getEntity());
+ selfDisguised.add(disguise.getEntity().getUniqueId());
ProtocolLibrary.getProtocolManager().sendServerPacket((Player) disguise.getEntity(), destroyPacket);
Bukkit.getScheduler().scheduleSyncDelayedTask(libsDisguises, new Runnable() {
public void run() {
@@ -850,8 +785,7 @@ public class DisguiseUtilities {
public static void removeSelfDisguise(Player player) {
if (selfDisguised.contains(player.getUniqueId())) {
// Send a packet to destroy the fake entity
- PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_DESTROY);
- packet.getModifier().write(0, new int[] { DisguiseAPI.getSelfDisguiseId() });
+ PacketContainer packet = getDestroyPacket(DisguiseAPI.getSelfDisguiseId());
try {
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
} catch (Exception ex) {
@@ -979,10 +913,11 @@ public class DisguiseUtilities {
}
// Resend any active potion effects
- for (Object potionEffect : player.getActivePotionEffects()) {
+ for (PotionEffect potionEffect : player.getActivePotionEffects()) {
+ Object mobEffect = ReflectionManager.createMobEffect(potionEffect);
sendSelfPacket(player,
- manager.createPacketConstructor(PacketType.Play.Server.ENTITY_EFFECT, player.getEntityId(), potionEffect)
- .createPacket(player.getEntityId(), potionEffect));
+ manager.createPacketConstructor(PacketType.Play.Server.ENTITY_EFFECT, player.getEntityId(), mobEffect)
+ .createPacket(player.getEntityId(), mobEffect));
}
} catch (Exception ex) {
ex.printStackTrace();
diff --git a/src/me/libraryaddict/disguise/utilities/DisguiseValues.java b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseValues.java
similarity index 100%
rename from src/me/libraryaddict/disguise/utilities/DisguiseValues.java
rename to src/main/java/me/libraryaddict/disguise/utilities/DisguiseValues.java
diff --git a/src/me/libraryaddict/disguise/utilities/FakeBoundingBox.java b/src/main/java/me/libraryaddict/disguise/utilities/FakeBoundingBox.java
similarity index 100%
rename from src/me/libraryaddict/disguise/utilities/FakeBoundingBox.java
rename to src/main/java/me/libraryaddict/disguise/utilities/FakeBoundingBox.java
diff --git a/src/me/libraryaddict/disguise/utilities/LibsProfileLookup.java b/src/main/java/me/libraryaddict/disguise/utilities/LibsProfileLookup.java
similarity index 100%
rename from src/me/libraryaddict/disguise/utilities/LibsProfileLookup.java
rename to src/main/java/me/libraryaddict/disguise/utilities/LibsProfileLookup.java
diff --git a/src/me/libraryaddict/disguise/utilities/LibsProfileLookupCaller.java b/src/main/java/me/libraryaddict/disguise/utilities/LibsProfileLookupCaller.java
similarity index 81%
rename from src/me/libraryaddict/disguise/utilities/LibsProfileLookupCaller.java
rename to src/main/java/me/libraryaddict/disguise/utilities/LibsProfileLookupCaller.java
index 5b46e681..49c9213f 100644
--- a/src/me/libraryaddict/disguise/utilities/LibsProfileLookupCaller.java
+++ b/src/main/java/me/libraryaddict/disguise/utilities/LibsProfileLookupCaller.java
@@ -2,8 +2,8 @@ package me.libraryaddict.disguise.utilities;
import com.comphenix.protocol.wrappers.WrappedGameProfile;
-import net.minecraft.util.com.mojang.authlib.GameProfile;
-import net.minecraft.util.com.mojang.authlib.ProfileLookupCallback;
+import com.mojang.authlib.GameProfile;
+import com.mojang.authlib.ProfileLookupCallback;
public class LibsProfileLookupCaller implements ProfileLookupCallback {
private WrappedGameProfile gameProfile;
diff --git a/src/me/libraryaddict/disguise/utilities/PacketsManager.java b/src/main/java/me/libraryaddict/disguise/utilities/PacketsManager.java
similarity index 97%
rename from src/me/libraryaddict/disguise/utilities/PacketsManager.java
rename to src/main/java/me/libraryaddict/disguise/utilities/PacketsManager.java
index d64ca7ea..0a8bb056 100644
--- a/src/me/libraryaddict/disguise/utilities/PacketsManager.java
+++ b/src/main/java/me/libraryaddict/disguise/utilities/PacketsManager.java
@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
+import java.util.UUID;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.DisguiseConfig;
@@ -21,7 +22,6 @@ import me.libraryaddict.disguise.disguisetypes.watchers.PlayerWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SheepWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.WolfWatcher;
import me.libraryaddict.disguise.utilities.DisguiseSound.SoundType;
-import me.libraryaddict.disguise.utilities.ReflectionManager.LibVersion;
import org.bukkit.Art;
import org.bukkit.Bukkit;
@@ -84,7 +84,7 @@ public class PacketsManager {
try {
Player observer = event.getPlayer();
StructureModifier entityModifer = event.getPacket().getEntityModifier(observer.getWorld());
- Entity entity = entityModifer.read(LibVersion.is1_7() ? 0 : 1);
+ Entity entity = entityModifer.read(0);
if (entity instanceof ExperienceOrb || entity instanceof Item || entity instanceof Arrow
|| entity == observer) {
event.setCancelled(true);
@@ -196,12 +196,10 @@ public class PacketsManager {
spawnPackets[0] = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY_PAINTING);
StructureModifier