Work towards backwards compatibility
This commit is contained in:
parent
788bbf4b4e
commit
2d28988cc4
@ -46,22 +46,18 @@ public class LibsEquipment implements EntityEquipment {
|
|||||||
flagWatcher.sendItemStack(slot, item);
|
flagWatcher.sendItemStack(slot, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getItemInMainHand() {
|
public ItemStack getItemInMainHand() {
|
||||||
return getItem(EquipmentSlot.HAND);
|
return getItem(EquipmentSlot.HAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setItemInMainHand(ItemStack item) {
|
public void setItemInMainHand(ItemStack item) {
|
||||||
setItem(EquipmentSlot.HAND, item);
|
setItem(EquipmentSlot.HAND, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getItemInOffHand() {
|
public ItemStack getItemInOffHand() {
|
||||||
return getItem(EquipmentSlot.OFF_HAND);
|
return getItem(EquipmentSlot.OFF_HAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setItemInOffHand(ItemStack item) {
|
public void setItemInOffHand(ItemStack item) {
|
||||||
setItem(EquipmentSlot.OFF_HAND, item);
|
setItem(EquipmentSlot.OFF_HAND, item);
|
||||||
}
|
}
|
||||||
|
@ -106,10 +106,6 @@ public class MetaIndex<Y> {
|
|||||||
|
|
||||||
public static MetaIndex<Boolean> ENTITY_SILENT = new MetaIndex<>(FlagWatcher.class, 4, false);
|
public static MetaIndex<Boolean> ENTITY_SILENT = new MetaIndex<>(FlagWatcher.class, 4, false);
|
||||||
|
|
||||||
public static MetaIndex<Byte> ILLAGER_SPELL_TICKS = new MetaIndex<>(IllagerWizardWatcher.class, 0, (byte) 0);
|
|
||||||
|
|
||||||
public static MetaIndex<Byte> ILLAGER_META = new MetaIndex<>(IllagerWatcher.class, 0, (byte) 0);
|
|
||||||
|
|
||||||
public static MetaIndex<BlockPosition> FALLING_BLOCK_POSITION = new MetaIndex<>(FallingBlockWatcher.class, 0,
|
public static MetaIndex<BlockPosition> FALLING_BLOCK_POSITION = new MetaIndex<>(FallingBlockWatcher.class, 0,
|
||||||
BlockPosition.ORIGIN);
|
BlockPosition.ORIGIN);
|
||||||
|
|
||||||
@ -138,6 +134,10 @@ public class MetaIndex<Y> {
|
|||||||
public static MetaIndex<Optional<UUID>> HORSE_OWNER = new MetaIndex<>(AbstractHorseWatcher.class, 1,
|
public static MetaIndex<Optional<UUID>> HORSE_OWNER = new MetaIndex<>(AbstractHorseWatcher.class, 1,
|
||||||
Optional.<UUID>absent());
|
Optional.<UUID>absent());
|
||||||
|
|
||||||
|
public static MetaIndex<Byte> ILLAGER_META = new MetaIndex<>(IllagerWatcher.class, 0, (byte) 0);
|
||||||
|
|
||||||
|
public static MetaIndex<Byte> ILLAGER_SPELL_TICKS = new MetaIndex<>(IllagerWizardWatcher.class, 0, (byte) 0);
|
||||||
|
|
||||||
public static MetaIndex<Byte> INSENTIENT_META = new MetaIndex<>(InsentientWatcher.class, 0, (byte) 0);
|
public static MetaIndex<Byte> INSENTIENT_META = new MetaIndex<>(InsentientWatcher.class, 0, (byte) 0);
|
||||||
|
|
||||||
public static MetaIndex<Byte> IRON_GOLEM_PLAYER_CREATED = new MetaIndex<>(IronGolemWatcher.class, 0, (byte) 0);
|
public static MetaIndex<Byte> IRON_GOLEM_PLAYER_CREATED = new MetaIndex<>(IronGolemWatcher.class, 0, (byte) 0);
|
||||||
@ -220,8 +220,7 @@ public class MetaIndex<Y> {
|
|||||||
|
|
||||||
public static MetaIndex<Byte> SPIDER_CLIMB = new MetaIndex<>(SpiderWatcher.class, 0, (byte) 0);
|
public static MetaIndex<Byte> SPIDER_CLIMB = new MetaIndex<>(SpiderWatcher.class, 0, (byte) 0);
|
||||||
|
|
||||||
public static MetaIndex<ItemStack> SPLASH_POTION_ITEM = new MetaIndex<>(SplashPotionWatcher.class, 0,
|
public static MetaIndex<ItemStack> SPLASH_POTION_ITEM;
|
||||||
new ItemStack(Material.SPLASH_POTION));
|
|
||||||
|
|
||||||
public static MetaIndex<Byte> TAMEABLE_META = new MetaIndex<>(TameableWatcher.class, 0, (byte) 0);
|
public static MetaIndex<Byte> TAMEABLE_META = new MetaIndex<>(TameableWatcher.class, 0, (byte) 0);
|
||||||
|
|
||||||
@ -267,6 +266,13 @@ public class MetaIndex<Y> {
|
|||||||
public static MetaIndex<Boolean> ZOMBIE_VILLAGER_SHAKING = new MetaIndex<>(ZombieVillagerWatcher.class, 0, false);
|
public static MetaIndex<Boolean> ZOMBIE_VILLAGER_SHAKING = new MetaIndex<>(ZombieVillagerWatcher.class, 0, false);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
try {
|
||||||
|
SPLASH_POTION_ITEM = new MetaIndex<>(SplashPotionWatcher.class, 0,
|
||||||
|
new ItemStack(Material.valueOf("SPLASH_POTION")));
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
SPLASH_POTION_ITEM = new MetaIndex<>(SplashPotionWatcher.class, 0, new ItemStack(Material.POTION));
|
||||||
|
}
|
||||||
setValues();
|
setValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,8 +349,10 @@ public class MetaIndex<Y> {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (found != null) {
|
if (found != null) {
|
||||||
System.err.println(
|
System.err.println(entry.getKey()
|
||||||
entry.getKey().getSimpleName() + " has multiple FlagType's registered for the index " + i + " (" + type.getFlagWatcher().getSimpleName() + ", " + found.getFlagWatcher().getSimpleName() + ")");
|
.getSimpleName() + " has multiple FlagType's registered for the index " + i + " (" + type
|
||||||
|
.getFlagWatcher().getSimpleName() + ", " + found.getFlagWatcher()
|
||||||
|
.getSimpleName() + ")");
|
||||||
continue loop;
|
continue loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,8 +377,8 @@ public class MetaIndex<Y> {
|
|||||||
|
|
||||||
MetaIndex index = (MetaIndex) field.get(null);
|
MetaIndex index = (MetaIndex) field.get(null);
|
||||||
|
|
||||||
toPrint.add(
|
toPrint.add(index.getFlagWatcher().getSimpleName() + " " + field.getName() + " " + index
|
||||||
index.getFlagWatcher().getSimpleName() + " " + field.getName() + " " + index.getIndex() + " " + index.getDefault().getClass().getSimpleName());
|
.getIndex() + " " + index.getDefault().getClass().getSimpleName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
@ -443,8 +451,10 @@ public class MetaIndex<Y> {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.err.println(
|
System.err.println("[LibsDisguises] MetaIndex " + metaIndex.getFlagWatcher()
|
||||||
"[LibsDisguises] MetaIndex " + metaIndex.getFlagWatcher().getSimpleName() + " at index " + metaIndex.getIndex() + " has already registered this! (" + metaIndex.getDefault() + "," + index.getDefault() + ")");
|
.getSimpleName() + " at index " + metaIndex
|
||||||
|
.getIndex() + " has already registered this! (" + metaIndex.getDefault() + "," + index
|
||||||
|
.getDefault() + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
values()[i] = metaIndexes[a];
|
values()[i] = metaIndexes[a];
|
||||||
|
@ -5,51 +5,40 @@ import org.bukkit.inventory.MainHand;
|
|||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
|
|
||||||
public class InsentientWatcher extends LivingWatcher
|
public class InsentientWatcher extends LivingWatcher {
|
||||||
{
|
public InsentientWatcher(Disguise disguise) {
|
||||||
public InsentientWatcher(Disguise disguise)
|
|
||||||
{
|
|
||||||
super(disguise);
|
super(disguise);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMainHand(MainHand mainHand)
|
public void setMainHand(MainHand mainHand) {
|
||||||
{
|
|
||||||
setInsentientFlag(2, mainHand == MainHand.RIGHT);
|
setInsentientFlag(2, mainHand == MainHand.RIGHT);
|
||||||
sendData(MetaIndex.INSENTIENT_META);
|
sendData(MetaIndex.INSENTIENT_META);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MainHand getMainHand()
|
public MainHand getMainHand() {
|
||||||
{
|
|
||||||
return getInsentientFlag(2) ? MainHand.RIGHT : MainHand.LEFT;
|
return getInsentientFlag(2) ? MainHand.RIGHT : MainHand.LEFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAI()
|
public boolean isAI() {
|
||||||
{
|
|
||||||
return getInsentientFlag(1);
|
return getInsentientFlag(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAI(boolean ai)
|
public void setAI(boolean ai) {
|
||||||
{
|
|
||||||
setInsentientFlag(1, ai);
|
setInsentientFlag(1, ai);
|
||||||
sendData(MetaIndex.INSENTIENT_META);
|
sendData(MetaIndex.INSENTIENT_META);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setInsentientFlag(int i, boolean flag)
|
private void setInsentientFlag(int i, boolean flag) {
|
||||||
{
|
|
||||||
byte b0 = (byte) getData(MetaIndex.INSENTIENT_META);
|
byte b0 = (byte) getData(MetaIndex.INSENTIENT_META);
|
||||||
|
|
||||||
if (flag)
|
if (flag) {
|
||||||
{
|
|
||||||
setData(MetaIndex.INSENTIENT_META, (byte) (b0 | 1 << i));
|
setData(MetaIndex.INSENTIENT_META, (byte) (b0 | 1 << i));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
setData(MetaIndex.INSENTIENT_META, (byte) (b0 & (~1 << i)));
|
setData(MetaIndex.INSENTIENT_META, (byte) (b0 & (~1 << i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean getInsentientFlag(int i)
|
private boolean getInsentientFlag(int i) {
|
||||||
{
|
|
||||||
return ((byte) getData(MetaIndex.INSENTIENT_META) & 1 << i) != 0;
|
return ((byte) getData(MetaIndex.INSENTIENT_META) & 1 << i) != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,10 +60,9 @@ public class PlayerWatcher extends LivingWatcher {
|
|||||||
public BlockFace getSleepingDirection() {
|
public BlockFace getSleepingDirection() {
|
||||||
if (sleepingDirection == null) {
|
if (sleepingDirection == null) {
|
||||||
if (this.getDisguise().getEntity() != null && isSleeping()) {
|
if (this.getDisguise().getEntity() != null && isSleeping()) {
|
||||||
this.sleepingDirection = BlockFace
|
this.sleepingDirection = BlockFace.values()[Math
|
||||||
.values()[Math.round(this.getDisguise().getEntity().getLocation().getYaw() / 90F) & 0x3];
|
.round(this.getDisguise().getEntity().getLocation().getYaw() / 90F) & 0x3];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return BlockFace.EAST;
|
return BlockFace.EAST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -189,8 +188,9 @@ public class PlayerWatcher extends LivingWatcher {
|
|||||||
try {
|
try {
|
||||||
if (isSleeping()) {
|
if (isSleeping()) {
|
||||||
for (Player player : DisguiseUtilities.getPerverts(getDisguise())) {
|
for (Player player : DisguiseUtilities.getPerverts(getDisguise())) {
|
||||||
PacketContainer[] packets = DisguiseUtilities.getBedPackets(getDisguise().getEntity().getLocation(),
|
PacketContainer[] packets = DisguiseUtilities
|
||||||
player.getLocation(), (PlayerDisguise) getDisguise());
|
.getBedPackets(getDisguise().getEntity().getLocation(), player.getLocation(),
|
||||||
|
(PlayerDisguise) getDisguise());
|
||||||
|
|
||||||
if (getDisguise().getEntity() == player) {
|
if (getDisguise().getEntity() == player) {
|
||||||
for (PacketContainer packet : packets) {
|
for (PacketContainer packet : packets) {
|
||||||
@ -200,15 +200,13 @@ public class PlayerWatcher extends LivingWatcher {
|
|||||||
|
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
|
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
for (PacketContainer packet : packets) {
|
for (PacketContainer packet : packets) {
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
|
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
PacketContainer packet = new PacketContainer(Server.ANIMATION);
|
PacketContainer packet = new PacketContainer(Server.ANIMATION);
|
||||||
|
|
||||||
StructureModifier<Integer> mods = packet.getIntegers();
|
StructureModifier<Integer> mods = packet.getIntegers();
|
||||||
@ -232,10 +230,8 @@ public class PlayerWatcher extends LivingWatcher {
|
|||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
setData(MetaIndex.PLAYER_SKIN, (byte) (b0 | 1 << i));
|
setData(MetaIndex.PLAYER_SKIN, (byte) (b0 | 1 << i));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
setData(MetaIndex.PLAYER_SKIN, (byte) (b0 & (~1 << i)));
|
setData(MetaIndex.PLAYER_SKIN, (byte) (b0 & (~1 << i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -704,7 +704,7 @@ public class DisguiseParser {
|
|||||||
value = ReflectionManager.parseGameProfile(valueString);
|
value = ReflectionManager.parseGameProfile(valueString);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
throw parseToException(GameProfile.class, valueString, methodName);
|
throw parseToException(WrappedGameProfile.class, valueString, methodName);
|
||||||
}
|
}
|
||||||
} else if (float.class == param || double.class == param) {
|
} else if (float.class == param || double.class == param) {
|
||||||
// Parse to number
|
// Parse to number
|
||||||
@ -733,7 +733,7 @@ public class DisguiseParser {
|
|||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
throw parseToException(param, valueString, methodName);
|
throw parseToException(param, valueString, methodName);
|
||||||
}
|
}
|
||||||
} else if (param == Llama.Color.class) {
|
} else if (param.getName().equals("org.bukkit.entity.Llama$Color")) {
|
||||||
try {
|
try {
|
||||||
value = Llama.Color.valueOf(valueString.toUpperCase());
|
value = Llama.Color.valueOf(valueString.toUpperCase());
|
||||||
}
|
}
|
||||||
|
@ -10,83 +10,71 @@ import org.bukkit.Sound;
|
|||||||
* Only living disguises go in here!
|
* Only living disguises go in here!
|
||||||
*/
|
*/
|
||||||
public enum DisguiseSound {
|
public enum DisguiseSound {
|
||||||
|
ARROW(null, null, null, null, "entity.arrow.hit", "entity.arrow.shoot"),
|
||||||
|
|
||||||
ARROW(null, null, null, null, Sound.ENTITY_ARROW_HIT, Sound.ENTITY_ARROW_SHOOT),
|
BAT("entity.bat.hurt", null, "entity.bat.death", "entity.bat.ambient", "entity.player.small_fall",
|
||||||
|
"entity.bat.loop", "entity.player.big_fall", "entity.bat.takeoff"),
|
||||||
|
|
||||||
BAT(Sound.ENTITY_BAT_HURT, null, Sound.ENTITY_BAT_DEATH, Sound.ENTITY_BAT_AMBIENT, Sound.ENTITY_PLAYER_SMALL_FALL,
|
BLAZE("entity.blaze.hurt", null, "entity.blaze.death", "entity.blaze.ambient", "entity.player.small_fall",
|
||||||
Sound.ENTITY_BAT_LOOP, Sound.ENTITY_PLAYER_BIG_FALL, Sound.ENTITY_BAT_TAKEOFF),
|
"entity.player.big_fall"),
|
||||||
|
|
||||||
BLAZE(Sound.ENTITY_BLAZE_HURT, null, Sound.ENTITY_BLAZE_DEATH, Sound.ENTITY_BLAZE_AMBIENT,
|
CAVE_SPIDER("entity.spider.ambient", "entity.spider.step", "entity.spider.death", "entity.spider.ambient"),
|
||||||
Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_PLAYER_BIG_FALL),
|
|
||||||
|
|
||||||
CAVE_SPIDER(Sound.ENTITY_SPIDER_AMBIENT, Sound.ENTITY_SPIDER_STEP, Sound.ENTITY_SPIDER_DEATH,
|
CHICKEN("entity.chicken.hurt", "entity.chicken.step", "entity.chicken.hurt", "entity.chicken.ambient",
|
||||||
Sound.ENTITY_SPIDER_AMBIENT),
|
"entity.player.small_fall", "entity.chicken.egg", "entity.player.big_fall"),
|
||||||
|
|
||||||
CHICKEN(Sound.ENTITY_CHICKEN_HURT, Sound.ENTITY_CHICKEN_STEP, Sound.ENTITY_CHICKEN_HURT,
|
COW("entity.cow.hurt", "entity.cow.step", "entity.cow.death", "entity.cow.ambient"),
|
||||||
Sound.ENTITY_CHICKEN_AMBIENT, Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_CHICKEN_EGG,
|
|
||||||
Sound.ENTITY_PLAYER_BIG_FALL),
|
|
||||||
|
|
||||||
COW(Sound.ENTITY_COW_HURT, Sound.ENTITY_COW_STEP, Sound.ENTITY_COW_DEATH, Sound.ENTITY_COW_AMBIENT),
|
CREEPER("entity.creeper.hurt", "block.grass.step", "entity.creeper.death", null, "entity.creeper.primed"),
|
||||||
|
|
||||||
CREEPER(Sound.ENTITY_CREEPER_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_CREEPER_DEATH, null,
|
DONKEY("entity.donkey.hurt", "block.grass.step", "entity.donkey.death", "entity.donkey.ambient",
|
||||||
Sound.ENTITY_CREEPER_PRIMED),
|
"entity.horse.gallop", "entity.horse.saddle", "entity.donkey.angry", "entity.horse.step_wood",
|
||||||
|
"entity.horse.armor", "entity.horse.land", "entity.horse.jump", "entity.horse.angry"),
|
||||||
|
|
||||||
DONKEY(Sound.ENTITY_DONKEY_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_DONKEY_DEATH, Sound.ENTITY_DONKEY_AMBIENT,
|
ELDER_GUARDIAN("entity.elder_guardian.hurt", null, "entity.elder_guardian.death", "entity.elder_guardian.ambient"),
|
||||||
Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_DONKEY_ANGRY,
|
|
||||||
Sound.ENTITY_HORSE_STEP_WOOD, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP,
|
|
||||||
Sound.ENTITY_HORSE_ANGRY),
|
|
||||||
|
|
||||||
ELDER_GUARDIAN(Sound.ENTITY_ELDER_GUARDIAN_HURT, null, Sound.ENTITY_ELDER_GUARDIAN_DEATH,
|
ENDER_DRAGON("entity.enderdragon.hurt", null, "entity.enderdragon.death", "entity.enderdragon.ambient",
|
||||||
Sound.ENTITY_ELDER_GUARDIAN_AMBIENT),
|
"entity.player.small_fall", "entity.enderdragon.flap", "entity.player.big_fall"),
|
||||||
|
|
||||||
ENDER_DRAGON(Sound.ENTITY_ENDERDRAGON_HURT, null, Sound.ENTITY_ENDERDRAGON_DEATH, Sound.ENTITY_ENDERDRAGON_AMBIENT,
|
ENDERMAN("entity.endermen.hurt", "block.grass.step", "entity.endermen.death", "entity.endermen.ambient",
|
||||||
Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_ENDERDRAGON_FLAP, Sound.ENTITY_PLAYER_BIG_FALL),
|
"entity.endermen.scream", "entity.endermen.teleport", "entity.endermen.stare"),
|
||||||
|
|
||||||
ENDERMAN(Sound.ENTITY_ENDERMEN_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_ENDERMEN_DEATH,
|
ENDERMITE("entity.silverfish.hurt", "entity.endermite.step", "entity.endermite.death", "entity.endermite.ambient"),
|
||||||
Sound.ENTITY_ENDERMEN_AMBIENT, Sound.ENTITY_ENDERMEN_SCREAM, Sound.ENTITY_ENDERMEN_TELEPORT,
|
|
||||||
Sound.ENTITY_ENDERMEN_STARE),
|
|
||||||
|
|
||||||
ENDERMITE(Sound.ENTITY_SILVERFISH_HURT, Sound.ENTITY_ENDERMITE_STEP, Sound.ENTITY_ENDERMITE_DEATH,
|
EVOKER("entity.evocation_illager.hurt", null, "entity.evocation_illager.death", "entity.evocation_illager.ambient",
|
||||||
Sound.ENTITY_ENDERMITE_AMBIENT),
|
"entity.evocation_illager.cast_spell", "entity.evocation_illager.prepare_attack",
|
||||||
|
"entity.evocation_illager.prepare_summon", "entity.evocation_illager.prepare_wololo"),
|
||||||
|
|
||||||
EVOKER(Sound.ENTITY_EVOCATION_ILLAGER_HURT, null, Sound.ENTITY_EVOCATION_ILLAGER_DEATH,
|
EVOKER_FANGS(null, null, null, null, "entity.evocation_fangs.attack"),
|
||||||
Sound.ENTITY_EVOCATION_ILLAGER_AMBIENT, Sound.ENTITY_EVOCATION_ILLAGER_CAST_SPELL,
|
|
||||||
Sound.ENTITY_EVOCATION_ILLAGER_PREPARE_ATTACK, Sound.ENTITY_EVOCATION_ILLAGER_PREPARE_SUMMON,
|
|
||||||
Sound.ENTITY_EVOCATION_ILLAGER_PREPARE_WOLOLO),
|
|
||||||
|
|
||||||
EVOKER_FANGS(null, null, null, null, Sound.ENTITY_EVOCATION_FANGS_ATTACK),
|
GHAST("entity.ghast.hurt", null, "entity.ghast.death", "entity.ghast.ambient", "entity.player.small_fall",
|
||||||
|
"entity.ghast.shoot", "entity.player.big_fall", "entity.ghast.scream", "entity.ghast.warn"),
|
||||||
|
|
||||||
GHAST(Sound.ENTITY_GHAST_HURT, null, Sound.ENTITY_GHAST_DEATH, Sound.ENTITY_GHAST_AMBIENT,
|
GIANT("entity.player.hurt", "block.grass.step", null, null),
|
||||||
Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_GHAST_SHOOT, Sound.ENTITY_PLAYER_BIG_FALL,
|
|
||||||
Sound.ENTITY_GHAST_SCREAM, Sound.ENTITY_GHAST_WARN),
|
|
||||||
|
|
||||||
GIANT(Sound.ENTITY_PLAYER_HURT, Sound.BLOCK_GRASS_STEP, null, null),
|
GUARDIAN("entity.guardian.hurt", null, "entity.guardian.death", "entity.elder_guardian.ambient"),
|
||||||
|
|
||||||
GUARDIAN(Sound.ENTITY_GUARDIAN_HURT, null, Sound.ENTITY_GUARDIAN_DEATH, Sound.ENTITY_ELDER_GUARDIAN_AMBIENT),
|
HORSE("entity.horse.hurt", "block.grass.step", "entity.horse.death", "entity.horse.ambient", "entity.horse.gallop",
|
||||||
|
"entity.horse.saddle", "entity.donkey.angry", "entity.horse.step_wood", "entity.horse.armor",
|
||||||
HORSE(Sound.ENTITY_HORSE_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_HORSE_DEATH, Sound.ENTITY_HORSE_AMBIENT,
|
"entity.horse.land", "entity.horse.jump", "entity.horse.angry"),
|
||||||
Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_DONKEY_ANGRY,
|
|
||||||
Sound.ENTITY_HORSE_STEP_WOOD, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP,
|
|
||||||
Sound.ENTITY_HORSE_ANGRY),
|
|
||||||
|
|
||||||
ILLUSIONER("entity.illusion_illager.hurt", null, "entity.illusion_illager.death", "entity.illusion_illager.ambient",
|
ILLUSIONER("entity.illusion_illager.hurt", null, "entity.illusion_illager.death", "entity.illusion_illager.ambient",
|
||||||
"entity.illusion_illager.cast_spell", "entity.illusion_illager" + ".prepare_blindness",
|
"entity.illusion_illager.cast_spell", "entity.illusion_illager.prepare_blindness",
|
||||||
"entity.illusion_illager.prepare_mirror", "entity.illusion_illager.mirror_move"),
|
"entity.illusion_illager.prepare_mirror", "entity.illusion_illager.mirror_move"),
|
||||||
|
|
||||||
IRON_GOLEM(Sound.ENTITY_IRONGOLEM_HURT, Sound.ENTITY_IRONGOLEM_STEP, Sound.ENTITY_IRONGOLEM_DEATH,
|
IRON_GOLEM("entity.irongolem.hurt", "entity.irongolem.step", "entity.irongolem.death", "entity.irongolem.attack"),
|
||||||
Sound.ENTITY_IRONGOLEM_ATTACK),
|
|
||||||
|
|
||||||
LLAMA(Sound.ENTITY_LLAMA_HURT, Sound.ENTITY_LLAMA_STEP, Sound.ENTITY_LLAMA_DEATH, Sound.ENTITY_LLAMA_AMBIENT,
|
LLAMA("entity.llama.hurt", "entity.llama.step", "entity.llama.death", "entity.llama.ambient", "entity.llama.angry",
|
||||||
Sound.ENTITY_LLAMA_ANGRY, Sound.ENTITY_LLAMA_CHEST, Sound.ENTITY_LLAMA_EAT, Sound.ENTITY_LLAMA_SWAG),
|
"entity.llama.chest", "entity.llama.eat", "entity.llama.swag"),
|
||||||
|
|
||||||
MAGMA_CUBE(Sound.ENTITY_MAGMACUBE_HURT, Sound.ENTITY_MAGMACUBE_JUMP, null, null),
|
MAGMA_CUBE("entity.magmacube.hurt", "entity.magmacube.jump", null, null),
|
||||||
|
|
||||||
MULE(Sound.ENTITY_MULE_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_MULE_DEATH, Sound.ENTITY_MULE_AMBIENT),
|
MULE("entity.mule.hurt", "block.grass.step", "entity.mule.death", "entity.mule.ambient"),
|
||||||
|
|
||||||
MUSHROOM_COW(Sound.ENTITY_COW_HURT, Sound.ENTITY_COW_STEP, Sound.ENTITY_COW_HURT, Sound.ENTITY_COW_AMBIENT),
|
MUSHROOM_COW("entity.cow.hurt", "entity.cow.step", "entity.cow.hurt", "entity.cow.ambient"),
|
||||||
|
|
||||||
OCELOT(Sound.ENTITY_CAT_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_CAT_HURT, Sound.ENTITY_CAT_AMBIENT,
|
OCELOT("entity.cat.hurt", "block.grass.step", "entity.cat.hurt", "entity.cat.ambient", "entity.cat.purr",
|
||||||
Sound.ENTITY_CAT_PURR, Sound.ENTITY_CAT_PURREOW),
|
"entity.cat.purreow"),
|
||||||
|
|
||||||
PARROT("entity.parrot.hurt", "entity.parrot.step", "entity.parrot.death", "entity.parrot.ambient",
|
PARROT("entity.parrot.hurt", "entity.parrot.step", "entity.parrot.death", "entity.parrot.ambient",
|
||||||
"entity.parrot.eat", "entity.parrot.fly", "entity.parrot.imitate.blaze", "entity.parrot.imitate.creeper",
|
"entity.parrot.eat", "entity.parrot.fly", "entity.parrot.imitate.blaze", "entity.parrot.imitate.creeper",
|
||||||
@ -101,81 +89,77 @@ public enum DisguiseSound {
|
|||||||
"entity.parrot.imitate.wolf", "entity.parrot.imitate.zombie", "entity.parrot.imitate.zombie_pigman",
|
"entity.parrot.imitate.wolf", "entity.parrot.imitate.zombie", "entity.parrot.imitate.zombie_pigman",
|
||||||
"entity.parrot.imitate.zombie_villager"),
|
"entity.parrot.imitate.zombie_villager"),
|
||||||
|
|
||||||
PIG(Sound.ENTITY_PIG_HURT, Sound.ENTITY_PIG_STEP, Sound.ENTITY_PIG_DEATH, Sound.ENTITY_PIG_AMBIENT),
|
PIG("entity.pig.hurt", "entity.pig.step", "entity.pig.death", "entity.pig.ambient"),
|
||||||
|
|
||||||
PIG_ZOMBIE(Sound.ENTITY_ZOMBIE_PIG_HURT, null, Sound.ENTITY_ZOMBIE_PIG_DEATH, Sound.ENTITY_ZOMBIE_PIG_AMBIENT,
|
PIG_ZOMBIE("entity.zombie_pig.hurt", null, "entity.zombie_pig.death", "entity.zombie_pig.ambient",
|
||||||
Sound.ENTITY_ZOMBIE_PIG_ANGRY),
|
"entity.zombie_pig.angry"),
|
||||||
|
|
||||||
PLAYER(Sound.ENTITY_PLAYER_HURT,
|
PLAYER("entity.player.hurt", "block.stone.step", "block.grass.step", "block.anvil.step", "block.cloth.step",
|
||||||
new Sound[]{Sound.BLOCK_STONE_STEP, Sound.BLOCK_GRASS_STEP, Sound.BLOCK_ANVIL_STEP, Sound.BLOCK_CLOTH_STEP,
|
"block.glass.step", "block.gravel.step", "block.ladder.step", "block.metal.step", "block.sand.step",
|
||||||
Sound.BLOCK_GLASS_STEP, Sound.BLOCK_GRAVEL_STEP, Sound.BLOCK_LADDER_STEP, Sound.BLOCK_METAL_STEP,
|
"block.slime.step", "block.snow.step", "block.wood.step", "entity.player.death", null),
|
||||||
Sound.BLOCK_SAND_STEP, Sound.BLOCK_SLIME_STEP, Sound.BLOCK_SNOW_STEP, Sound.BLOCK_WOOD_STEP},
|
|
||||||
Sound.ENTITY_PLAYER_DEATH, null),
|
|
||||||
|
|
||||||
RABBIT(Sound.ENTITY_RABBIT_HURT, Sound.ENTITY_RABBIT_JUMP, Sound.ENTITY_RABBIT_DEATH, Sound.ENTITY_RABBIT_AMBIENT),
|
RABBIT("entity.rabbit.hurt", "entity.rabbit.jump", "entity.rabbit.death", "entity.rabbit.ambient"),
|
||||||
|
|
||||||
SHEEP(Sound.ENTITY_SHEEP_HURT, Sound.ENTITY_SHEEP_STEP, null, Sound.ENTITY_SHEEP_AMBIENT, Sound.ENTITY_SHEEP_SHEAR),
|
SHEEP("entity.sheep.hurt", "entity.sheep.step", null, "entity.sheep.ambient", "entity.sheep.shear"),
|
||||||
|
|
||||||
SHULKER(Sound.ENTITY_SHULKER_HURT, null, Sound.ENTITY_SHULKER_DEATH, Sound.ENTITY_SHULKER_AMBIENT,
|
SHULKER("entity.shulker.hurt", null, "entity.shulker.death", "entity.shulker.ambient", "entity.shulker.open",
|
||||||
Sound.ENTITY_SHULKER_OPEN, Sound.ENTITY_SHULKER_CLOSE, Sound.ENTITY_SHULKER_HURT_CLOSED,
|
"entity.shulker.close", "entity.shulker.hurt_closed", "entity.shulker.teleport"),
|
||||||
Sound.ENTITY_SHULKER_TELEPORT),
|
|
||||||
|
|
||||||
SILVERFISH(Sound.ENTITY_SILVERFISH_HURT, Sound.ENTITY_SILVERFISH_STEP, Sound.ENTITY_SILVERFISH_DEATH,
|
SILVERFISH("entity.silverfish.hurt", "entity.silverfish.step", "entity.silverfish.death",
|
||||||
Sound.ENTITY_SILVERFISH_AMBIENT),
|
"entity.silverfish.ambient"),
|
||||||
|
|
||||||
SKELETON(Sound.ENTITY_SKELETON_HURT, Sound.ENTITY_SKELETON_STEP, Sound.ENTITY_SKELETON_DEATH,
|
SKELETON("entity.skeleton.hurt", "entity.skeleton.step", "entity.skeleton.death", "entity.skeleton.ambient"),
|
||||||
Sound.ENTITY_SKELETON_AMBIENT),
|
|
||||||
|
|
||||||
SKELETON_HORSE(Sound.ENTITY_SKELETON_HORSE_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_SKELETON_HORSE_DEATH,
|
SKELETON_HORSE("entity.skeleton_horse.hurt", "block.grass.step", "entity.skeleton_horse.death",
|
||||||
Sound.ENTITY_SKELETON_HORSE_AMBIENT, Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE,
|
"entity.skeleton_horse.ambient", "entity.horse.gallop", "entity.horse.saddle", "entity.donkey.angry",
|
||||||
Sound.ENTITY_DONKEY_ANGRY, Sound.ENTITY_HORSE_STEP_WOOD, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND,
|
"entity.horse.step_wood", "entity.horse.armor", "entity.horse.land", "entity.horse.jump",
|
||||||
Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_HORSE_ANGRY),
|
"entity.horse.angry"),
|
||||||
|
|
||||||
SLIME(Sound.ENTITY_SLIME_HURT, Sound.ENTITY_SLIME_JUMP, Sound.ENTITY_SLIME_DEATH, null),
|
SLIME("entity.slime.hurt", "entity.slime.jump", "entity.slime.death", null),
|
||||||
|
|
||||||
SNOWMAN(Sound.ENTITY_SNOWMAN_HURT, null, Sound.ENTITY_SNOWMAN_DEATH, Sound.ENTITY_SNOWMAN_AMBIENT,
|
SNOWMAN("entity.snowman.hurt", null, "entity.snowman.death", "entity.snowman.ambient", "entity.snowman.shoot"),
|
||||||
Sound.ENTITY_SNOWMAN_SHOOT),
|
|
||||||
|
|
||||||
SPIDER(Sound.ENTITY_SPIDER_AMBIENT, Sound.ENTITY_SPIDER_STEP, Sound.ENTITY_SPIDER_DEATH,
|
SPIDER("entity.spider.ambient", "entity.spider.step", "entity.spider.death", "entity.spider.ambient"),
|
||||||
Sound.ENTITY_SPIDER_AMBIENT),
|
|
||||||
|
|
||||||
SQUID(Sound.ENTITY_SQUID_HURT, null, Sound.ENTITY_SQUID_DEATH, Sound.ENTITY_SQUID_AMBIENT),
|
SQUID("entity.squid.hurt", null, "entity.squid.death", "entity.squid.ambient"),
|
||||||
|
|
||||||
UNDEAD_HORSE(Sound.ENTITY_ZOMBIE_HORSE_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_ZOMBIE_HORSE_DEATH,
|
UNDEAD_HORSE("entity.zombie_horse.hurt", "block.grass.step", "entity.zombie_horse.death",
|
||||||
Sound.ENTITY_ZOMBIE_HORSE_AMBIENT, Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE,
|
"entity.zombie_horse.ambient", "entity.horse.gallop", "entity.horse.saddle", "entity.donkey.angry",
|
||||||
Sound.ENTITY_DONKEY_ANGRY, Sound.ENTITY_HORSE_STEP_WOOD, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND,
|
"entity.horse.step_wood", "entity.horse.armor", "entity.horse.land", "entity.horse.jump",
|
||||||
Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_HORSE_ANGRY),
|
"entity.horse.angry"),
|
||||||
|
|
||||||
VEX(Sound.ENTITY_VEX_HURT, null, Sound.ENTITY_VEX_DEATH, Sound.ENTITY_VEX_AMBIENT, Sound.ENTITY_VEX_CHARGE),
|
VEX("entity.vex.hurt", null, "entity.vex.death", "entity.vex.ambient", "entity.vex.charge"),
|
||||||
|
|
||||||
VILLAGER(Sound.ENTITY_VILLAGER_HURT, null, Sound.ENTITY_VILLAGER_DEATH, Sound.ENTITY_VILLAGER_AMBIENT,
|
VILLAGER("entity.villager.hurt", null, "entity.villager.death", "entity.villager.ambient",
|
||||||
Sound.ENTITY_VILLAGER_TRADING, Sound.ENTITY_VILLAGER_NO, Sound.ENTITY_VILLAGER_YES),
|
"entity.villager.trading", "entity.villager.no", "entity.villager.yes"),
|
||||||
|
|
||||||
VINDICATOR(Sound.ENTITY_VINDICATION_ILLAGER_HURT, null, Sound.ENTITY_VINDICATION_ILLAGER_DEATH,
|
VINDICATOR("entity.vindication_illager.hurt", null, "entity.vindication_illager.death",
|
||||||
Sound.ENTITY_VINDICATION_ILLAGER_AMBIENT),
|
"entity.vindication_illager.ambient"),
|
||||||
|
|
||||||
WITCH(Sound.ENTITY_WITCH_HURT, null, Sound.ENTITY_WITCH_DEATH, Sound.ENTITY_WITCH_AMBIENT),
|
WITCH("entity.witch.hurt", null, "entity.witch.death", "entity.witch.ambient"),
|
||||||
|
|
||||||
WITHER(Sound.ENTITY_WITHER_HURT, null, Sound.ENTITY_WITHER_DEATH, Sound.ENTITY_WITHER_AMBIENT,
|
WITHER("entity.wither.hurt", null, "entity.wither.death", "entity.wither.ambient", "entity.player.small_fall",
|
||||||
Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_WITHER_SPAWN, Sound.ENTITY_PLAYER_BIG_FALL,
|
"entity.wither.spawn", "entity.player.big_fall", "entity.wither.shoot"),
|
||||||
Sound.ENTITY_WITHER_SHOOT),
|
|
||||||
|
|
||||||
WITHER_SKELETON(Sound.ENTITY_SKELETON_HURT, Sound.ENTITY_SKELETON_STEP, Sound.ENTITY_SKELETON_DEATH,
|
WITHER_SKELETON("entity.skeleton.hurt", "entity.skeleton.step", "entity.skeleton.death", "entity.skeleton.ambient"),
|
||||||
Sound.ENTITY_SKELETON_AMBIENT),
|
|
||||||
|
|
||||||
WOLF(Sound.ENTITY_WOLF_HURT, Sound.ENTITY_WOLF_STEP, Sound.ENTITY_WOLF_DEATH, Sound.ENTITY_WOLF_AMBIENT,
|
WOLF("entity.wolf.hurt", "entity.wolf.step", "entity.wolf.death", "entity.wolf.ambient", "entity.wolf.growl",
|
||||||
Sound.ENTITY_WOLF_GROWL, Sound.ENTITY_WOLF_PANT, Sound.ENTITY_WOLF_HOWL, Sound.ENTITY_WOLF_SHAKE,
|
"entity.wolf.pant", "entity.wolf.howl", "entity.wolf.shake", "entity.wolf.whine"),
|
||||||
Sound.ENTITY_WOLF_WHINE),
|
|
||||||
|
|
||||||
ZOMBIE(Sound.ENTITY_ZOMBIE_HURT, Sound.ENTITY_ZOMBIE_STEP, Sound.ENTITY_ZOMBIE_DEATH, Sound.ENTITY_ZOMBIE_AMBIENT,
|
ZOMBIE("entity.zombie.hurt", "entity.zombie.step", "entity.zombie.death", "entity.zombie.ambient",
|
||||||
Sound.ENTITY_ZOMBIE_INFECT, Sound.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, Sound.ENTITY_ZOMBIE_ATTACK_DOOR_WOOD,
|
"entity.zombie.infect", "entity.zombie.break_door_wood", "entity.zombie.attack_door_wood",
|
||||||
Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR), ZOMBIE_VILLAGER(Sound.ENTITY_ZOMBIE_VILLAGER_HURT,
|
"entity.zombie.attack_iron_door"),
|
||||||
Sound.ENTITY_ZOMBIE_VILLAGER_STEP, Sound.ENTITY_ZOMBIE_VILLAGER_DEATH, Sound.ENTITY_ZOMBIE_VILLAGER_AMBIENT,
|
|
||||||
Sound.ENTITY_ZOMBIE_INFECT, Sound.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, Sound.ENTITY_ZOMBIE_ATTACK_DOOR_WOOD,
|
ZOMBIE_VILLAGER("entity.zombie_villager.hurt", "entity.zombie_villager.step", "entity.zombie_villager.death",
|
||||||
Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR);
|
"entity.zombie_villager.ambient", "entity.zombie.infect", "entity.zombie.break_door_wood",
|
||||||
|
"entity.zombie.attack_door_wood", "entity.zombie.attack_iron_door");
|
||||||
|
|
||||||
public enum SoundType {
|
public enum SoundType {
|
||||||
CANCEL, DEATH, HURT, IDLE, STEP
|
CANCEL,
|
||||||
|
DEATH,
|
||||||
|
HURT,
|
||||||
|
IDLE,
|
||||||
|
STEP
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DisguiseSound getType(String name) {
|
public static DisguiseSound getType(String name) {
|
||||||
@ -308,8 +292,8 @@ public enum DisguiseSound {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
for (SoundType type : SoundType.values()) {
|
for (SoundType type : SoundType.values()) {
|
||||||
if (!disguiseSounds.containsKey(
|
if (!disguiseSounds
|
||||||
type) || type == SoundType.DEATH || (ignoreDamage && type == SoundType.HURT)) {
|
.containsKey(type) || type == SoundType.DEATH || (ignoreDamage && type == SoundType.HURT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,8 +920,8 @@ public class DisguiseUtilities {
|
|||||||
try {
|
try {
|
||||||
PacketContainer destroyPacket = getDestroyPacket(disguise.getEntity().getEntityId());
|
PacketContainer destroyPacket = getDestroyPacket(disguise.getEntity().getEntityId());
|
||||||
|
|
||||||
if (disguise.isDisguiseInUse() && disguise.getEntity() instanceof Player && disguise.getEntity().getName()
|
if (disguise.isDisguiseInUse() && disguise.getEntity() instanceof Player && ((Player) disguise.getEntity())
|
||||||
.equalsIgnoreCase(player)) {
|
.getName().equalsIgnoreCase(player)) {
|
||||||
removeSelfDisguise((Player) disguise.getEntity());
|
removeSelfDisguise((Player) disguise.getEntity());
|
||||||
|
|
||||||
if (disguise.isSelfDisguiseVisible()) {
|
if (disguise.isSelfDisguiseVisible()) {
|
||||||
@ -1178,7 +1178,15 @@ public class DisguiseUtilities {
|
|||||||
// Code to stop player pushing
|
// Code to stop player pushing
|
||||||
Scoreboard scoreboard = player.getScoreboard();
|
Scoreboard scoreboard = player.getScoreboard();
|
||||||
Team team = originalTeam == null ? null : scoreboard.getTeam(originalTeam);
|
Team team = originalTeam == null ? null : scoreboard.getTeam(originalTeam);
|
||||||
Team ldTeam = scoreboard.getEntryTeam(player.getName());
|
Team ldTeam = null;
|
||||||
|
|
||||||
|
for (Team t : scoreboard.getTeams()) {
|
||||||
|
if (!t.hasEntry(player.getName()))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ldTeam = t;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (ldTeam != null) {
|
if (ldTeam != null) {
|
||||||
if (!ldTeam.getName().equals("LD Pushing") && !ldTeam.getName().endsWith("_LDP")) {
|
if (!ldTeam.getName().equals("LD Pushing") && !ldTeam.getName().endsWith("_LDP")) {
|
||||||
@ -1276,10 +1284,18 @@ public class DisguiseUtilities {
|
|||||||
if (pOption != DisguisePushing.IGNORE_SCOREBOARD) {
|
if (pOption != DisguisePushing.IGNORE_SCOREBOARD) {
|
||||||
// Code to stop player pushing
|
// Code to stop player pushing
|
||||||
Scoreboard scoreboard = player.getScoreboard();
|
Scoreboard scoreboard = player.getScoreboard();
|
||||||
Team prevTeam = scoreboard.getEntryTeam(player.getName());
|
Team prevTeam = null;
|
||||||
Team ldTeam = null;
|
Team ldTeam = null;
|
||||||
String ldTeamName = "LD Pushing";
|
String ldTeamName = "LD Pushing";
|
||||||
|
|
||||||
|
for (Team t : scoreboard.getTeams()) {
|
||||||
|
if (!t.hasEntry(player.getName()))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
prevTeam = t;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// If the player is in a team already
|
// If the player is in a team already
|
||||||
if (prevTeam != null && !(prevTeam.getName().equals("LD Pushing") || prevTeam.getName()
|
if (prevTeam != null && !(prevTeam.getName().equals("LD Pushing") || prevTeam.getName()
|
||||||
.endsWith("_LDP"))) {
|
.endsWith("_LDP"))) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package me.libraryaddict.disguise.utilities;
|
package me.libraryaddict.disguise.utilities;
|
||||||
|
|
||||||
import com.comphenix.protocol.wrappers.BlockPosition;
|
import com.comphenix.protocol.wrappers.BlockPosition;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||||
import me.libraryaddict.disguise.disguisetypes.*;
|
import me.libraryaddict.disguise.disguisetypes.*;
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguisePerm;
|
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguisePerm;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@ -10,7 +10,6 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.TreeSpecies;
|
import org.bukkit.TreeSpecies;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Horse;
|
import org.bukkit.entity.Horse;
|
||||||
import org.bukkit.entity.Llama;
|
|
||||||
import org.bukkit.entity.Ocelot;
|
import org.bukkit.entity.Ocelot;
|
||||||
import org.bukkit.entity.Villager;
|
import org.bukkit.entity.Villager;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -143,19 +142,32 @@ public class ReflectionFlagWatchers {
|
|||||||
new ParamInfo(AnimalColor.class, "Animal Color", "View all the colors you can use for an animal color");
|
new ParamInfo(AnimalColor.class, "Animal Color", "View all the colors you can use for an animal color");
|
||||||
new ParamInfo(Art.class, "Art", "View all the paintings you can use for a painting disguise");
|
new ParamInfo(Art.class, "Art", "View all the paintings you can use for a painting disguise");
|
||||||
|
|
||||||
new ParamInfo(Llama.Color.class, "Llama Color", "View all the colors you can use for a llama color");
|
try {
|
||||||
|
new ParamInfo("org.bukkit.entity.Llama.Color", "Llama Color",
|
||||||
|
"View all the colors you can use for a llama color");
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
}
|
||||||
|
|
||||||
new ParamInfo(Horse.Color.class, "Horse Color", "View all the colors you can use for a horses color");
|
new ParamInfo(Horse.Color.class, "Horse Color", "View all the colors you can use for a horses color");
|
||||||
|
|
||||||
new ParamInfo(Ocelot.Type.class, "Ocelot Type", "View all the ocelot types you can use for ocelots");
|
new ParamInfo(Ocelot.Type.class, "Ocelot Type", "View all the ocelot types you can use for ocelots");
|
||||||
new ParamInfo(Villager.Profession.class, "Villager Profession",
|
new ParamInfo(Villager.Profession.class, "Villager Profession",
|
||||||
"View all the professions you can set on a villager");
|
"View all the professions you can set on a villager");
|
||||||
new ParamInfo(BlockFace.class, Arrays.copyOf(BlockFace.values(), 6), "Direction (North, East, South, West, " +
|
new ParamInfo(BlockFace.class, Arrays.copyOf(BlockFace.values(), 6),
|
||||||
"Up, Down)",
|
"Direction (North, East, South, West, " + "Up, Down)",
|
||||||
"View the four directions usable on player setSleeping disguise");
|
"View the directions usable on player setSleeping and shulker direction");
|
||||||
new ParamInfo(RabbitType.class, "Rabbit Type", "View the kinds of rabbits you can turn into");
|
new ParamInfo(RabbitType.class, "Rabbit Type", "View the kinds of rabbits you can turn into");
|
||||||
new ParamInfo(TreeSpecies.class, "Tree Species", "View the different types of tree species");
|
new ParamInfo(TreeSpecies.class, "Tree Species", "View the different types of tree species");
|
||||||
|
|
||||||
|
try {
|
||||||
|
new ParamInfo("org.bukkit.inventory.MainHand", "Main Hand", "Set the main hand for an entity");
|
||||||
|
new ParamInfo("org.bukkit.entity.Llama.Color", "Llama Color",
|
||||||
|
"View all the colors you can use for a llama color");
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
new ParamInfo("org.bukkit.entity.Parrot$Variant", "Parrot Variant",
|
new ParamInfo("org.bukkit.entity.Parrot$Variant", "Parrot Variant",
|
||||||
"View the different colors a parrot can be");
|
"View the different colors a parrot can be");
|
||||||
@ -178,11 +190,11 @@ public class ReflectionFlagWatchers {
|
|||||||
materials[i] = Material.values()[i].name();
|
materials[i] = Material.values()[i].name();
|
||||||
}
|
}
|
||||||
|
|
||||||
new ParamInfo(ItemStack.class, "Item (id:damage), damage optional", "An ItemStack compromised of " +
|
new ParamInfo(ItemStack.class, "Item (id:damage), damage optional",
|
||||||
"ID:Durability", materials);
|
"An ItemStack compromised of " + "ID:Durability", materials);
|
||||||
|
|
||||||
new ParamInfo(ItemStack[].class, "Four ItemStacks (id:damage,id:damage..), damage optional", "Four ItemStacks separated by an ,",
|
new ParamInfo(ItemStack[].class, "Four ItemStacks (id:damage,id:damage..), damage optional",
|
||||||
materials) {
|
"Four ItemStacks separated by an ,", materials) {
|
||||||
@Override
|
@Override
|
||||||
public String[] getEnums(String tabComplete) {
|
public String[] getEnums(String tabComplete) {
|
||||||
String beginning = tabComplete
|
String beginning = tabComplete
|
||||||
@ -214,7 +226,7 @@ public class ReflectionFlagWatchers {
|
|||||||
new ParamInfo(int[].class, "number,number,number..", "Numbers separated by an ,");
|
new ParamInfo(int[].class, "number,number,number..", "Numbers separated by an ,");
|
||||||
|
|
||||||
new ParamInfo(BlockPosition.class, "Block Position (num,num,num)", "Three numbers separated by a ,");
|
new ParamInfo(BlockPosition.class, "Block Position (num,num,num)", "Three numbers separated by a ,");
|
||||||
new ParamInfo(GameProfile.class, "GameProfile",
|
new ParamInfo(WrappedGameProfile.class, "GameProfile",
|
||||||
"Get the gameprofile here https://sessionserver.mojang.com/session/minecraft/profile/PLAYER_UUID_GOES_HERE?unsigned=false");
|
"Get the gameprofile here https://sessionserver.mojang.com/session/minecraft/profile/PLAYER_UUID_GOES_HERE?unsigned=false");
|
||||||
|
|
||||||
Collections.sort(paramList, new Comparator<ParamInfo>() {
|
Collections.sort(paramList, new Comparator<ParamInfo>() {
|
||||||
|
@ -5,15 +5,12 @@ import com.comphenix.protocol.wrappers.EnumWrappers.Direction;
|
|||||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher.Registry;
|
import com.comphenix.protocol.wrappers.WrappedDataWatcher.Registry;
|
||||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher.Serializer;
|
import com.comphenix.protocol.wrappers.WrappedDataWatcher.Serializer;
|
||||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObject;
|
import com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObject;
|
||||||
import com.comphenix.protocol.wrappers.nbt.NbtBase;
|
|
||||||
import com.comphenix.protocol.wrappers.nbt.NbtCompound;
|
import com.comphenix.protocol.wrappers.nbt.NbtCompound;
|
||||||
import com.comphenix.protocol.wrappers.nbt.NbtFactory;
|
|
||||||
import com.comphenix.protocol.wrappers.nbt.NbtWrapper;
|
import com.comphenix.protocol.wrappers.nbt.NbtWrapper;
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
@ -41,8 +38,8 @@ public class ReflectionManager {
|
|||||||
static {
|
static {
|
||||||
for (Method method : getNmsClass("EntityLiving").getDeclaredMethods()) {
|
for (Method method : getNmsClass("EntityLiving").getDeclaredMethods()) {
|
||||||
try {
|
try {
|
||||||
if (method.getReturnType() == float.class && Modifier.isProtected(
|
if (method.getReturnType() == float.class && Modifier.isProtected(method.getModifiers()) && method
|
||||||
method.getModifiers()) && method.getParameterTypes().length == 0) {
|
.getParameterTypes().length == 0) {
|
||||||
Object entity = createEntityInstance("Cow");
|
Object entity = createEntityInstance("Cow");
|
||||||
|
|
||||||
method.setAccessible(true);
|
method.setAccessible(true);
|
||||||
@ -85,9 +82,8 @@ public class ReflectionManager {
|
|||||||
String id = (String) response.get("id");
|
String id = (String) response.get("id");
|
||||||
|
|
||||||
if (!id.contains("-")) {
|
if (!id.contains("-")) {
|
||||||
id = Pattern.compile(
|
id = Pattern.compile("([0-9a-fA-F]{8})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]+)")
|
||||||
"([0-9a-fA-F]{8})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]+)").matcher(
|
.matcher(id).replaceFirst("$1-$2-$3-$4-$5");
|
||||||
id).replaceFirst("$1-$2-$3-$4-$5");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WrappedGameProfile gameProfile = new WrappedGameProfile(UUID.fromString(id), (String) response.get("name"));
|
WrappedGameProfile gameProfile = new WrappedGameProfile(UUID.fromString(id), (String) response.get("name"));
|
||||||
@ -117,28 +113,29 @@ public class ReflectionManager {
|
|||||||
case "Player":
|
case "Player":
|
||||||
Object minecraftServer = getNmsMethod("MinecraftServer", "getServer").invoke(null);
|
Object minecraftServer = getNmsMethod("MinecraftServer", "getServer").invoke(null);
|
||||||
|
|
||||||
Object playerinteractmanager = getNmsClass("PlayerInteractManager").getDeclaredConstructor(
|
Object playerinteractmanager = getNmsClass("PlayerInteractManager")
|
||||||
getNmsClass("World")).newInstance(world);
|
.getDeclaredConstructor(getNmsClass("World")).newInstance(world);
|
||||||
|
|
||||||
WrappedGameProfile gameProfile = getGameProfile(new UUID(0, 0), "Steve");
|
WrappedGameProfile gameProfile = getGameProfile(new UUID(0, 0), "Steve");
|
||||||
|
|
||||||
entityObject = entityClass.getDeclaredConstructor(getNmsClass("MinecraftServer"),
|
entityObject = entityClass
|
||||||
getNmsClass("WorldServer"), gameProfile.getHandleType(),
|
.getDeclaredConstructor(getNmsClass("MinecraftServer"), getNmsClass("WorldServer"),
|
||||||
playerinteractmanager.getClass()).newInstance(minecraftServer, world,
|
gameProfile.getHandleType(), playerinteractmanager.getClass())
|
||||||
gameProfile.getHandle(), playerinteractmanager);
|
.newInstance(minecraftServer, world, gameProfile.getHandle(), playerinteractmanager);
|
||||||
break;
|
break;
|
||||||
case "EnderPearl":
|
case "EnderPearl":
|
||||||
entityObject = entityClass.getDeclaredConstructor(getNmsClass("World"),
|
entityObject = entityClass.getDeclaredConstructor(getNmsClass("World"), getNmsClass("EntityLiving"))
|
||||||
getNmsClass("EntityLiving")).newInstance(world, createEntityInstance("Cow"));
|
.newInstance(world, createEntityInstance("Cow"));
|
||||||
break;
|
break;
|
||||||
case "Potion":
|
case "Potion":
|
||||||
entityObject = entityClass.getDeclaredConstructor(getNmsClass("World"), Double.TYPE, Double.TYPE,
|
entityObject = entityClass
|
||||||
Double.TYPE, getNmsClass("ItemStack")).newInstance(world, 0d, 0d, 0d,
|
.getDeclaredConstructor(getNmsClass("World"), Double.TYPE, Double.TYPE, Double.TYPE,
|
||||||
getNmsItem(new ItemStack(Material.SPLASH_POTION)));
|
getNmsClass("ItemStack"))
|
||||||
|
.newInstance(world, 0d, 0d, 0d, getNmsItem(new ItemStack(Material.SPLASH_POTION)));
|
||||||
break;
|
break;
|
||||||
case "FishingHook":
|
case "FishingHook":
|
||||||
entityObject = entityClass.getDeclaredConstructor(getNmsClass("World"),
|
entityObject = entityClass.getDeclaredConstructor(getNmsClass("World"), getNmsClass("EntityHuman"))
|
||||||
getNmsClass("EntityHuman")).newInstance(world, createEntityInstance("Player"));
|
.newInstance(world, createEntityInstance("Player"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
entityObject = entityClass.getDeclaredConstructor(getNmsClass("World")).newInstance(world);
|
entityObject = entityClass.getDeclaredConstructor(getNmsClass("World")).newInstance(world);
|
||||||
@ -174,9 +171,10 @@ public class ReflectionManager {
|
|||||||
|
|
||||||
public static Object createMobEffect(int id, int duration, int amplification, boolean ambient, boolean particles) {
|
public static Object createMobEffect(int id, int duration, int amplification, boolean ambient, boolean particles) {
|
||||||
try {
|
try {
|
||||||
return getNmsClass("MobEffect").getDeclaredConstructor(getNmsClass("MobEffectList"), Integer.TYPE,
|
return getNmsClass("MobEffect")
|
||||||
Integer.TYPE, Boolean.TYPE, Boolean.TYPE).newInstance(getMobEffectList(id), duration, amplification,
|
.getDeclaredConstructor(getNmsClass("MobEffectList"), Integer.TYPE, Integer.TYPE, Boolean.TYPE,
|
||||||
ambient, particles);
|
Boolean.TYPE)
|
||||||
|
.newInstance(getMobEffectList(id), duration, amplification, ambient, particles);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -331,8 +329,8 @@ public class ReflectionManager {
|
|||||||
|
|
||||||
public static Object getBlockPosition(int x, int y, int z) {
|
public static Object getBlockPosition(int x, int y, int z) {
|
||||||
try {
|
try {
|
||||||
return getNmsClass("BlockPosition").getDeclaredConstructor(int.class, int.class, int.class).newInstance(x,
|
return getNmsClass("BlockPosition").getDeclaredConstructor(int.class, int.class, int.class)
|
||||||
y, z);
|
.newInstance(x, y, z);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
@ -365,13 +363,14 @@ public class ReflectionManager {
|
|||||||
|
|
||||||
public static Object getPlayerInfoData(Object playerInfoPacket, WrappedGameProfile gameProfile) {
|
public static Object getPlayerInfoData(Object playerInfoPacket, WrappedGameProfile gameProfile) {
|
||||||
try {
|
try {
|
||||||
Object playerListName = getNmsClass("ChatComponentText").getDeclaredConstructor(String.class).newInstance(
|
Object playerListName = getNmsClass("ChatComponentText").getDeclaredConstructor(String.class)
|
||||||
gameProfile.getName());
|
.newInstance(gameProfile.getName());
|
||||||
|
|
||||||
return getNmsClass("PacketPlayOutPlayerInfo$PlayerInfoData").getDeclaredConstructor(
|
return getNmsClass("PacketPlayOutPlayerInfo$PlayerInfoData")
|
||||||
getNmsClass("PacketPlayOutPlayerInfo"), gameProfile.getHandleType(), int.class,
|
.getDeclaredConstructor(getNmsClass("PacketPlayOutPlayerInfo"), gameProfile.getHandleType(),
|
||||||
getNmsClass("EnumGamemode"), getNmsClass("IChatBaseComponent")).newInstance(playerInfoPacket,
|
int.class, getNmsClass("EnumGamemode"), getNmsClass("IChatBaseComponent"))
|
||||||
gameProfile.getHandle(), 0, getNmsClass("EnumGamemode").getEnumConstants()[1], playerListName);
|
.newInstance(playerInfoPacket, gameProfile.getHandle(), 0,
|
||||||
|
getNmsClass("EnumGamemode").getEnumConstants()[1], playerListName);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
@ -555,9 +554,9 @@ public class ReflectionManager {
|
|||||||
if (method.getReturnType().getSimpleName().equals("MinecraftSessionService")) {
|
if (method.getReturnType().getSimpleName().equals("MinecraftSessionService")) {
|
||||||
Object session = method.invoke(minecraftServer);
|
Object session = method.invoke(minecraftServer);
|
||||||
|
|
||||||
return WrappedGameProfile.fromHandle(
|
return WrappedGameProfile.fromHandle(session.getClass()
|
||||||
session.getClass().getDeclaredMethod("fillProfileProperties", gameProfile.getHandleType(),
|
.getDeclaredMethod("fillProfileProperties", gameProfile.getHandleType(), boolean.class)
|
||||||
boolean.class).invoke(session, gameProfile.getHandle(), true));
|
.invoke(session, gameProfile.getHandle(), true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -592,8 +591,8 @@ public class ReflectionManager {
|
|||||||
LibsProfileLookupCaller callback = new LibsProfileLookupCaller();
|
LibsProfileLookupCaller callback = new LibsProfileLookupCaller();
|
||||||
|
|
||||||
profileRepo.getClass().getDeclaredMethod("findProfilesByNames", String[].class, agent.getClass(),
|
profileRepo.getClass().getDeclaredMethod("findProfilesByNames", String[].class, agent.getClass(),
|
||||||
Class.forName("com.mojang.authlib.ProfileLookupCallback")).invoke(profileRepo,
|
Class.forName("com.mojang.authlib.ProfileLookupCallback"))
|
||||||
new String[]{playername}, agent, callback);
|
.invoke(profileRepo, new String[]{playername}, agent, callback);
|
||||||
|
|
||||||
if (callback.getGameProfile() != null) {
|
if (callback.getGameProfile() != null) {
|
||||||
return callback.getGameProfile();
|
return callback.getGameProfile();
|
||||||
@ -614,9 +613,9 @@ public class ReflectionManager {
|
|||||||
try {
|
try {
|
||||||
Location loc = entity.getLocation();
|
Location loc = entity.getLocation();
|
||||||
|
|
||||||
Object boundingBox = boundingBoxConstructor.newInstance(loc.getX() - newBox.getX(),
|
Object boundingBox = boundingBoxConstructor
|
||||||
loc.getY() - newBox.getY(), loc.getZ() - newBox.getZ(), loc.getX() + newBox.getX(),
|
.newInstance(loc.getX() - newBox.getX(), loc.getY() - newBox.getY(), loc.getZ() - newBox.getZ(),
|
||||||
loc.getY() + newBox.getY(), loc.getZ() + newBox.getZ());
|
loc.getX() + newBox.getX(), loc.getY() + newBox.getY(), loc.getZ() + newBox.getZ());
|
||||||
|
|
||||||
setBoundingBoxMethod.invoke(getNmsEntity(entity), boundingBox);
|
setBoundingBoxMethod.invoke(getNmsEntity(entity), boundingBox);
|
||||||
}
|
}
|
||||||
@ -799,9 +798,8 @@ public class ReflectionManager {
|
|||||||
BlockPosition pos = (BlockPosition) val;
|
BlockPosition pos = (BlockPosition) val;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return Optional.of(
|
return Optional.of(getNmsConstructor("BlockPosition", int.class, int.class, int.class)
|
||||||
getNmsConstructor("BlockPosition", int.class, int.class, int.class).newInstance(pos.getX(),
|
.newInstance(pos.getX(), pos.getY(), pos.getZ()));
|
||||||
pos.getY(), pos.getZ()));
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
@ -818,16 +816,16 @@ public class ReflectionManager {
|
|||||||
Vector3F angle = (Vector3F) value;
|
Vector3F angle = (Vector3F) value;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return getNmsConstructor("Vector3f", float.class, float.class, float.class).newInstance(angle.getX(),
|
return getNmsConstructor("Vector3f", float.class, float.class, float.class)
|
||||||
angle.getY(), angle.getZ());
|
.newInstance(angle.getX(), angle.getY(), angle.getZ());
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
} else if (value instanceof Direction) {
|
} else if (value instanceof Direction) {
|
||||||
try {
|
try {
|
||||||
return (Enum) getNmsMethod("EnumDirection", "fromType1", int.class).invoke(null,
|
return (Enum) getNmsMethod("EnumDirection", "fromType1", int.class)
|
||||||
((Direction) value).ordinal());
|
.invoke(null, ((Direction) value).ordinal());
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
@ -836,8 +834,8 @@ public class ReflectionManager {
|
|||||||
BlockPosition pos = (BlockPosition) value;
|
BlockPosition pos = (BlockPosition) value;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return getNmsConstructor("BlockPosition", int.class, int.class, int.class).newInstance(pos.getX(),
|
return getNmsConstructor("BlockPosition", int.class, int.class, int.class)
|
||||||
pos.getY(), pos.getZ());
|
.newInstance(pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
@ -906,7 +904,7 @@ public class ReflectionManager {
|
|||||||
return id + (data << 12);
|
return id + (data << 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Pair<Integer, Integer> getFromCombinedId(int combinedId) {
|
public static ImmutablePair<Integer, Integer> getFromCombinedId(int combinedId) {
|
||||||
int j = combinedId & 4095;
|
int j = combinedId & 4095;
|
||||||
int k = combinedId >> 12 & 15;
|
int k = combinedId >> 12 & 15;
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package me.libraryaddict.disguise.utilities;
|
package me.libraryaddict.disguise.utilities;
|
||||||
|
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import org.apache.commons.lang3.StringEscapeUtils;
|
import org.apache.commons.lang.StringEscapeUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
@ -2,8 +2,10 @@ package me.libraryaddict.disguise.utilities.backwards;
|
|||||||
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
import me.libraryaddict.disguise.utilities.LibsPremium;
|
import me.libraryaddict.disguise.utilities.LibsPremium;
|
||||||
import me.libraryaddict.disguise.utilities.ReflectionManager;
|
import me.libraryaddict.disguise.utilities.backwards.metadata.Version_1_10;
|
||||||
import me.libraryaddict.disguise.utilities.backwards.metadata.Version_1_11;
|
import me.libraryaddict.disguise.utilities.backwards.metadata.Version_1_11;
|
||||||
|
import me.libraryaddict.disguise.utilities.backwards.metadata.Version_1_9;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -14,16 +16,27 @@ import java.util.ArrayList;
|
|||||||
public class BackwardsSupport {
|
public class BackwardsSupport {
|
||||||
public static BackwardMethods getMethods() {
|
public static BackwardMethods getMethods() {
|
||||||
try {
|
try {
|
||||||
String version = ReflectionManager.getBukkitVersion();
|
String version = Bukkit.getVersion();
|
||||||
|
version = version.substring(version.lastIndexOf(" ") + 1, version.length() - 1);
|
||||||
|
|
||||||
Class<? extends BackwardMethods> methods = BackwardMethods.class;
|
Class<? extends BackwardMethods> methods = BackwardMethods.class;
|
||||||
|
|
||||||
if (version.equals("v1_11_R1")) {
|
if (version.equals("1.9") || version.equals("1.9.1") || version.equals("1.9.2") || version
|
||||||
|
.equals("1.9.3") || version.equals("1.9.4")) {
|
||||||
|
methods = Version_1_9.class;
|
||||||
|
} else if (version.equals("1.10") || version.equals("1.10.1") || version.equals("1.10.2")) {
|
||||||
|
methods = Version_1_10.class;
|
||||||
|
} else if (version.equals("1.11") || version.equals("1.11.1") || version.equals("1.11.2")) {
|
||||||
methods = Version_1_11.class;
|
methods = Version_1_11.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LibsPremium.isPremium() && methods != BackwardMethods.class) {
|
if (methods != BackwardMethods.class) {
|
||||||
|
if (!LibsPremium.isPremium()) {
|
||||||
System.out.println("[LibsDisguises] You must purchase the plugin to use backwards compatibility!");
|
System.out.println("[LibsDisguises] You must purchase the plugin to use backwards compatibility!");
|
||||||
methods = BackwardMethods.class;
|
methods = BackwardMethods.class;
|
||||||
|
} else {
|
||||||
|
System.out.println("[LibsDisguises] Enabled backwards support for " + version);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return setupMetadata(methods);
|
return setupMetadata(methods);
|
||||||
@ -35,12 +48,9 @@ public class BackwardsSupport {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BackwardMethods setupMetadata(Class<? extends BackwardMethods> backwardsClass) {
|
private static void getIndexes(Class backwardsClass, BackwardMethods backwards,
|
||||||
try {
|
ArrayList<MetaIndex> newIndexes) throws IllegalAccessException {
|
||||||
BackwardMethods backwards = backwardsClass.newInstance();
|
for (Field field : backwardsClass.getFields()) {
|
||||||
ArrayList<MetaIndex> newIndexes = new ArrayList<>();
|
|
||||||
|
|
||||||
for (Field field : backwards.getClass().getFields()) {
|
|
||||||
if (field.getType() != MetaIndex.class)
|
if (field.getType() != MetaIndex.class)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -51,6 +61,19 @@ public class BackwardsSupport {
|
|||||||
newIndexes.add((MetaIndex) field.get(backwards));
|
newIndexes.add((MetaIndex) field.get(backwards));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
backwardsClass = backwardsClass.getSuperclass();
|
||||||
|
|
||||||
|
if (backwardsClass.getSimpleName().contains("Version_"))
|
||||||
|
getIndexes(backwardsClass, backwards, newIndexes);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static BackwardMethods setupMetadata(Class<? extends BackwardMethods> backwardsClass) {
|
||||||
|
try {
|
||||||
|
BackwardMethods backwards = backwardsClass.newInstance();
|
||||||
|
ArrayList<MetaIndex> newIndexes = new ArrayList<>();
|
||||||
|
|
||||||
|
getIndexes(backwardsClass, backwards, newIndexes);
|
||||||
|
|
||||||
MetaIndex.setValues();
|
MetaIndex.setValues();
|
||||||
|
|
||||||
MetaIndex.addMetaIndexes(newIndexes.toArray(new MetaIndex[0]));
|
MetaIndex.addMetaIndexes(newIndexes.toArray(new MetaIndex[0]));
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
package me.libraryaddict.disguise.utilities.backwards.metadata;
|
package me.libraryaddict.disguise.utilities.backwards.metadata;
|
||||||
|
|
||||||
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 9/06/2017.
|
* Created by libraryaddict on 9/06/2017.
|
||||||
|
* <p>
|
||||||
|
* Supports 1.10.0 1.10.1 and 1.10.2
|
||||||
*/
|
*/
|
||||||
public class Version_1_10 {
|
public class Version_1_10 extends Version_1_11 {
|
||||||
|
private MetaIndex ILLAGER_META;
|
||||||
|
private MetaIndex ILLAGER_SPELL_TICKS;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package me.libraryaddict.disguise.utilities.backwards.metadata;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by libraryaddict on 24/06/2017.
|
||||||
|
*/
|
||||||
|
public class Version_1_7 {
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package me.libraryaddict.disguise.utilities.backwards.metadata;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by libraryaddict on 24/06/2017.
|
||||||
|
*/
|
||||||
|
public class Version_1_8 {
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package me.libraryaddict.disguise.utilities.backwards.metadata;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by libraryaddict on 24/06/2017.
|
||||||
|
* <p>
|
||||||
|
* Intended for 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4
|
||||||
|
*/
|
||||||
|
public class Version_1_9 extends Version_1_10 {
|
||||||
|
}
|
10
src/org/bukkit/inventory/EquipmentSlot.java
Normal file
10
src/org/bukkit/inventory/EquipmentSlot.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package org.bukkit.inventory;
|
||||||
|
|
||||||
|
public enum EquipmentSlot {
|
||||||
|
HAND,
|
||||||
|
OFF_HAND,
|
||||||
|
FEET,
|
||||||
|
LEGS,
|
||||||
|
CHEST,
|
||||||
|
HEAD
|
||||||
|
}
|
6
src/org/bukkit/inventory/MainHand.java
Normal file
6
src/org/bukkit/inventory/MainHand.java
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package org.bukkit.inventory;
|
||||||
|
|
||||||
|
public enum MainHand {
|
||||||
|
LEFT,
|
||||||
|
RIGHT
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user