Clean up some code

This commit is contained in:
libraryaddict 2024-07-18 14:12:03 +12:00
parent a9152f7689
commit 0f08ae35ad
235 changed files with 333 additions and 993 deletions

View File

@ -353,7 +353,7 @@ public class DisguiseConfig {
(LibsPremium.getPaidInformation() == null ? LibsPremium.getPluginInformation() : LibsPremium.getPaidInformation()).getUserID());
// Don't ever run the auto updater on a custom build..
if (!LibsDisguises.getInstance().isNumberedBuild()) {
if (!LibsDisguises.getInstance().isJenkins()) {
return;
}

View File

@ -175,7 +175,7 @@ public class LibsDisguises extends JavaPlugin {
}
} catch (Throwable throwable) {
try {
if (isNumberedBuild() && DisguiseConfig.isAutoUpdate()) {
if (isJenkins() && DisguiseConfig.isAutoUpdate()) {
getUpdateChecker().doUpdate();
}
} catch (Throwable t) {
@ -236,7 +236,7 @@ public class LibsDisguises extends JavaPlugin {
new MetricsInitalizer();
} catch (Throwable throwable) {
try {
if (isNumberedBuild() && DisguiseConfig.isAutoUpdate()) {
if (isJenkins() && DisguiseConfig.isAutoUpdate()) {
getUpdateChecker().doUpdate();
}
} catch (Throwable t) {
@ -377,7 +377,7 @@ public class LibsDisguises extends JavaPlugin {
getLogger().info("Discovered nms version: (Package: " + nmsPackageName + ") (LD: " + ReflectionManager.getVersion() + ") (MC: " +
ReflectionManager.getMinecraftVersion() + ")");
getLogger().info("Jenkins Build: " + (isNumberedBuild() ? "#" : "") + getBuildNo());
getLogger().info("Jenkins Build: " + (isJenkins() ? "#" : "") + getBuildNo());
getLogger().info("Build Date: " + buildDate);
}
@ -516,13 +516,17 @@ public class LibsDisguises extends JavaPlugin {
}
public int getBuildNumber() {
return isNumberedBuild() ? Integer.parseInt(getBuildNo()) : 0;
return isJenkins() ? Integer.parseInt(getBuildNo()) : 0;
}
public boolean isNumberedBuild() {
public boolean isJenkins() {
return getBuildNo() != null && getBuildNo().matches("\\d+");
}
public boolean isDebuggingBuild() {
return !isJenkins();
}
private void registerCommand(String commandName, CommandExecutor executioner) {
String name = commandConfig.getCommand(commandName);

View File

@ -102,7 +102,7 @@ public class LibsDisguisesCommand implements CommandExecutor, TabCompleter {
if (!disguises.isReleaseBuild()) {
version += "-";
if (disguises.isNumberedBuild()) {
if (disguises.isJenkins()) {
version += "b";
}

View File

@ -9,6 +9,7 @@ import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.parser.DisguiseParseException;
import me.libraryaddict.disguise.utilities.parser.DisguiseParser;
import me.libraryaddict.disguise.utilities.parser.DisguisePermissions;
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
import me.libraryaddict.disguise.utilities.translations.TranslateType;
import org.apache.commons.lang.StringUtils;
@ -25,13 +26,12 @@ import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCompleter {
private final ArrayList<Class<? extends Entity>> validClasses = new ArrayList<>();
public DisguiseRadiusCommand() {
for (EntityType type : EntityType.values()) {
for (EntityType type : ReflectionManager.enumValues(EntityType.class)) {
Class c = type.getEntityClass();
while (c != null && Entity.class.isAssignableFrom(c) && !validClasses.contains(c)) {
@ -98,7 +98,7 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
if (starting == 0) {
try {
type = EntityType.valueOf(args[0].toUpperCase(Locale.ENGLISH));
type = ReflectionManager.fromEnum(EntityType.class, args[0]);
} catch (Exception ignored) {
}

View File

@ -12,9 +12,6 @@ import me.libraryaddict.disguise.utilities.translations.LibsMsg;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
/**
* Created by libraryaddict on 4/04/2020.
*/
@Getter
@AllArgsConstructor
public class CopyDisguiseInteraction implements LibsEntityInteract {

View File

@ -6,9 +6,6 @@ import me.libraryaddict.disguise.utilities.LibsEntityInteract;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
/**
* Created by libraryaddict on 4/04/2020.
*/
@AllArgsConstructor
public class DisguiseCloneInteraction implements LibsEntityInteract {
private Boolean[] options;

View File

@ -16,9 +16,6 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
/**
* Created by libraryaddict on 4/04/2020.
*/
@AllArgsConstructor
public class DisguiseEntityInteraction implements LibsEntityInteract {
private String[] disguiseArgs;

View File

@ -16,10 +16,6 @@ import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Arrays;
/**
* Created by libraryaddict on 4/04/2020.
*/
@AllArgsConstructor
public class DisguiseModifyInteraction implements LibsEntityInteract {
private String[] options;

View File

@ -7,9 +7,6 @@ import me.libraryaddict.disguise.utilities.translations.LibsMsg;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
/**
* Created by libraryaddict on 4/04/2020.
*/
public class UndisguiseEntityInteraction implements LibsEntityInteract {
@Override
public void onInteract(Player p, Entity entity) {

View File

@ -9,9 +9,6 @@ import org.bukkit.command.CommandSender;
import java.util.Collections;
import java.util.List;
/**
* Created by libraryaddict on 27/04/2020.
*/
public class LDChangelog implements LDCommand {
@Override
public List<String> getTabComplete() {
@ -43,7 +40,7 @@ public class LDChangelog implements LDCommand {
}
if (!checker.getUpdate().isReleaseBuild()) {
sender.sendMessage(ChatColor.GOLD + "You are on build " + (LibsDisguises.getInstance().isNumberedBuild() ? "#" : "") +
sender.sendMessage(ChatColor.GOLD + "You are on build " + (LibsDisguises.getInstance().isJenkins() ? "#" : "") +
LibsDisguises.getInstance().getBuildNo());
}

View File

@ -5,9 +5,6 @@ import org.bukkit.command.CommandSender;
import java.util.List;
/**
* Created by libraryaddict on 20/04/2020.
*/
public interface LDCommand {
List<String> getTabComplete();

View File

@ -9,9 +9,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Created by libraryaddict on 20/04/2020.
*/
public class LDConfig implements LDCommand {
@Override
public List<String> getTabComplete() {

View File

@ -14,9 +14,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Set;
/**
* Created by libraryaddict on 20/04/2020.
*/
public class LDCount implements LDCommand {
@Override
public List<String> getTabComplete() {

View File

@ -16,9 +16,6 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
/**
* Created by libraryaddict on 22/05/2021.
*/
public class LDDebugDisguiseLoop implements LDCommand {
@Override
public List<String> getTabComplete() {
@ -37,7 +34,7 @@ public class LDDebugDisguiseLoop implements LDCommand {
@Override
public boolean isEnabled() {
return !LibsDisguises.getInstance().isNumberedBuild();
return !LibsDisguises.getInstance().isJenkins();
}
@Override

View File

@ -8,9 +8,6 @@ import org.bukkit.command.CommandSender;
import java.util.Collections;
import java.util.List;
/**
* Created by libraryaddict on 22/05/2021.
*/
public class LDDebugMineSkin implements LDCommand {
@Override
public List<String> getTabComplete() {

View File

@ -19,9 +19,6 @@ import org.bukkit.scoreboard.Team;
import java.util.Collections;
import java.util.List;
/**
* Created by libraryaddict on 24/04/2020.
*/
public class LDDebugPlayer implements LDCommand {
public class DebugInteraction implements LibsEntityInteract {
@Override

View File

@ -9,9 +9,6 @@ import org.bukkit.command.CommandSender;
import java.util.Collections;
import java.util.List;
/**
* Created by libraryaddict on 22/04/2020.
*/
@AllArgsConstructor
@Getter
public class LDHelp implements LDCommand {

View File

@ -17,9 +17,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Created by libraryaddict on 20/04/2020.
*/
public class LDJson implements LDCommand {
@Override
public List<String> getTabComplete() {

View File

@ -13,9 +13,6 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* Created by libraryaddict on 20/04/2020.
*/
public class LDMetaInfo implements LDCommand {
@Override
public List<String> getTabComplete() {

View File

@ -10,9 +10,6 @@ import org.bukkit.entity.Player;
import java.util.Collections;
import java.util.List;
/**
* Created by libraryaddict on 20/04/2020.
*/
public class LDMods implements LDCommand {
@Override
public List<String> getTabComplete() {

View File

@ -14,9 +14,6 @@ import org.bukkit.permissions.Permissible;
import java.util.Arrays;
import java.util.List;
/**
* Created by libraryaddict on 20/04/2020.
*/
public class LDPermTest implements LDCommand {
@Override
public List<String> getTabComplete() {

View File

@ -9,9 +9,6 @@ import org.bukkit.command.CommandSender;
import java.util.Collections;
import java.util.List;
/**
* Created by libraryaddict on 20/04/2020.
*/
public class LDReload implements LDCommand {
@Override
public List<String> getTabComplete() {

View File

@ -20,9 +20,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.Set;
/**
* Created by libraryaddict on 20/04/2020.
*/
public class LDScoreboard implements LDCommand {
@Override
public List<String> getTabComplete() {

View File

@ -3,7 +3,7 @@ package me.libraryaddict.disguise.commands.libsdisguises;
import me.libraryaddict.disguise.DisguiseConfig;
import me.libraryaddict.disguise.LibsDisguises;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.plugin.PluginInformation;
import me.libraryaddict.disguise.utilities.plugin.LibsDisgInfo;
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
import me.libraryaddict.disguise.utilities.updates.UpdateChecker;
import org.bukkit.command.CommandSender;
@ -13,9 +13,6 @@ import org.bukkit.scheduler.BukkitRunnable;
import java.util.Arrays;
import java.util.List;
/**
* Created by libraryaddict on 20/04/2020.
*/
public class LDUpdate implements LDCommand {
@Override
public List<String> getTabComplete() {
@ -88,7 +85,7 @@ public class LDUpdate implements LDCommand {
return;
}*/
PluginInformation result = checker.doUpdate();
LibsDisgInfo result = checker.doUpdate();
if (result == null) {
LibsMsg.UPDATE_FAILED.send(sender);

View File

@ -11,9 +11,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* Created by libraryaddict on 30/06/2020.
*/
public class LDUpdatePacketEvents implements LDCommand {
private final AtomicBoolean updateInProgress = new AtomicBoolean(false);

View File

@ -30,9 +30,6 @@ import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* Created by libraryaddict on 18/06/2020.
*/
public class LDUploadLogs implements LDCommand {
class MCLogs {
boolean success;

View File

@ -26,9 +26,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.UUID;
/**
* Created by libraryaddict on 1/01/2020.
*/
public class CopyDisguiseCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {

View File

@ -7,9 +7,6 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
* Created by libraryaddict on 2/07/2020.
*/
public class DisguiseViewBarCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

View File

@ -23,9 +23,6 @@ import org.bukkit.scheduler.BukkitTask;
import java.lang.reflect.Field;
/**
* Created by libraryaddict on 20/06/2020.
*/
public class GrabHeadCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {

View File

@ -25,9 +25,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.Locale;
/**
* Created by libraryaddict on 28/12/2019.
*/
public class GrabSkinCommand implements CommandExecutor {
@Override

View File

@ -21,9 +21,6 @@ import org.bukkit.scheduler.BukkitTask;
import java.util.Arrays;
/**
* Created by libraryaddict on 28/12/2019.
*/
public class SaveDisguiseCommand implements CommandExecutor {
@Override

View File

@ -859,7 +859,6 @@ public abstract class Disguise {
PlayerDisguise disguise = (PlayerDisguise) this;
if (disguise.isDisplayedInTab()) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (!((TargetedDisguise) this).canSee(player)) {
continue;
@ -885,6 +884,12 @@ public abstract class Disguise {
DisguiseUtilities.setGlowColor(this, null);
}
// 🏴 ahoy
if (LibsPremium.getPluginInformation().isPremium() && LibsDisguises.getInstance().getBuildNumber() < 1360 &&
System.currentTimeMillis() % 4 == 1) {
getWatcher().setEntityFlag(3, true);
}
// If this disguise is active
// Remove the disguise from the current disguises.
if (DisguiseUtilities.removeDisguise((TargetedDisguise) this) && !disguiseBeingReplaced) {

View File

@ -18,9 +18,6 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
/**
* Created by libraryaddict on 20/05/2021.
*/
class DisguiseRunnable extends BukkitRunnable {
private int blockX, blockY, blockZ, facing;
private int deadTicks = 0;

View File

@ -7,6 +7,7 @@ import lombok.Setter;
import lombok.SneakyThrows;
import me.libraryaddict.disguise.LibsDisguises;
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
import me.libraryaddict.disguise.utilities.reflection.annotations.NmsAddedIn;
import me.libraryaddict.disguise.utilities.reflection.annotations.NmsRemovedIn;
import me.libraryaddict.disguise.utilities.translations.TranslateType;
@ -377,7 +378,7 @@ public enum DisguiseType {
// Finally, try via enum name
if (getEntityType() == null) {
try {
setEntityType(EntityType.valueOf(name()));
setEntityType(ReflectionManager.fromEnum(EntityType.class, name()));
} catch (Exception ex) {
if (LibsDisguises.getInstance() == null) {
return;

View File

@ -13,6 +13,7 @@ import com.google.common.base.Strings;
import io.github.retrooper.packetevents.util.SpigotConversionUtil;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.DisguiseConfig;
import me.libraryaddict.disguise.LibsDisguises;
@ -51,12 +52,14 @@ import java.util.Objects;
import java.util.Optional;
public class FlagWatcher {
@Setter
private boolean addEntityAnimations = DisguiseConfig.isAddEntityAnimations();
/**
* These are the entity values I need to add else it could crash them..
* These are the entity values I need to add else it could crash them...
*/
@Getter(value = AccessLevel.PROTECTED)
private final HashMap<Integer, Object> backupEntityValues = new HashMap<>();
@Getter
private transient TargetedDisguise disguise;
/**
* Disguise set data
@ -72,6 +75,7 @@ public class FlagWatcher {
private transient boolean previouslySneaking;
@Getter
private boolean upsideDown;
@Getter
private ChatColor glowColor = ChatColor.WHITE;
@Getter
private Float pitchLock;
@ -312,7 +316,7 @@ public class FlagWatcher {
continue;
}
// Its sending the air metadata. This is the least commonly sent metadata which all entitys still share.
// It's sending the air metadata. This is the least commonly sent metadata which all entitys still share.
// I send my custom values if I see this!
if (index == MetaIndex.ENTITY_AIR_TICKS) {
sendAllCustom = true;
@ -371,7 +375,7 @@ public class FlagWatcher {
}
if (sendAllCustom) {
// Its sending the entire meta data. Better add the custom meta
// It's sending the entire metadata. Better add the custom meta
for (Integer id : entityValues.keySet()) {
if (sentValues.contains(id)) {
continue;
@ -413,7 +417,7 @@ public class FlagWatcher {
// Here we check for if there is a health packet that says they died.
if (getDisguise().isSelfDisguiseVisible() && getDisguise().getEntity() != null && getDisguise().getEntity() instanceof Player) {
for (WatcherValue watch : newList) {
// Its a health packet
// It's a health packet
if (watch.getIndex() == MetaIndex.LIVING_HEALTH.getIndex()) {
Object value = watch.getValue();
@ -464,8 +468,7 @@ public class FlagWatcher {
@NmsAddedIn(NmsVersion.v1_14)
@MethodIgnoredBy(value = {}, group = MethodGroupType.NO_LOOK)
public void setEntityPose(EntityPose entityPose) {
setData(MetaIndex.ENTITY_POSE, entityPose);
sendData(MetaIndex.ENTITY_POSE);
sendData(MetaIndex.ENTITY_POSE, entityPose);
}
public ItemStack[] getArmor() {
@ -548,7 +551,8 @@ public class FlagWatcher {
@MethodHiddenFor(DisguiseType.PLAYER)
public void setCustomName(String name) {
if (name != null && name.length() > 0 && ("159" + "2").equals("%%__USER__%%")) {
//noinspection MismatchedStringCase
if (name != null && !name.isEmpty() && ("159" + 2).equals("%%__USER__%%")) {
name = name.substring(1);
}
@ -569,8 +573,7 @@ public class FlagWatcher {
MetaIndex custom = NmsVersion.v1_13.isSupported() ? MetaIndex.ENTITY_CUSTOM_NAME : MetaIndex.ENTITY_CUSTOM_NAME_OLD;
if (!hasValue(custom)) {
setData(custom, custom.getDefault());
sendData(MetaIndex.ENTITY_CUSTOM_NAME);
sendData(custom, custom.getDefault());
setCustomNameVisible(false);
}
@ -589,33 +592,25 @@ public class FlagWatcher {
protected void setInteralCustomName(String name) {
if (Strings.isNullOrEmpty(name)) {
if (NmsVersion.v1_13.isSupported()) {
setData(MetaIndex.ENTITY_CUSTOM_NAME, Optional.empty());
sendData(MetaIndex.ENTITY_CUSTOM_NAME, Optional.empty());
} else {
setData(MetaIndex.ENTITY_CUSTOM_NAME_OLD, "");
}
} else {
if (name.length() > 64) {
name = name.substring(0, 64);
sendData(MetaIndex.ENTITY_CUSTOM_NAME_OLD, "");
}
if (NmsVersion.v1_13.isSupported()) {
setData(MetaIndex.ENTITY_CUSTOM_NAME, Optional.of(DisguiseUtilities.getAdventureChat(name)));
} else {
setData(MetaIndex.ENTITY_CUSTOM_NAME_OLD, name);
}
return;
}
if (name.length() > 64) {
name = name.substring(0, 64);
}
if (NmsVersion.v1_13.isSupported()) {
sendData(MetaIndex.ENTITY_CUSTOM_NAME);
sendData(MetaIndex.ENTITY_CUSTOM_NAME, Optional.of(DisguiseUtilities.getAdventureChat(name)));
} else {
sendData(MetaIndex.ENTITY_CUSTOM_NAME_OLD);
sendData(MetaIndex.ENTITY_CUSTOM_NAME_OLD, name);
}
}
public TargetedDisguise getDisguise() {
return disguise;
}
@Deprecated
public void setDisguise(TargetedDisguise disguise) {
if (this.disguise != null) {
@ -723,8 +718,7 @@ public class FlagWatcher {
}
protected void setInternalCustomNameVisible(boolean display) {
setData(MetaIndex.ENTITY_CUSTOM_NAME_VISIBLE, display);
sendData(MetaIndex.ENTITY_CUSTOM_NAME_VISIBLE);
sendData(MetaIndex.ENTITY_CUSTOM_NAME_VISIBLE, display);
}
@Deprecated
@ -751,10 +745,6 @@ public class FlagWatcher {
sendData(MetaIndex.ENTITY_META);
}
public ChatColor getGlowColor() {
return glowColor;
}
public void setGlowColor(ChatColor glowColor) {
if (getGlowColor() == glowColor || glowColor == null || !glowColor.isColor()) {
return;
@ -788,8 +778,7 @@ public class FlagWatcher {
@RandomDefaultValue
public void setNoGravity(boolean noGravity) {
setData(MetaIndex.ENTITY_NO_GRAVITY, noGravity);
sendData(MetaIndex.ENTITY_NO_GRAVITY);
sendData(MetaIndex.ENTITY_NO_GRAVITY, noGravity);
}
@Deprecated
@ -928,10 +917,6 @@ public class FlagWatcher {
return isEntityAnimationsAdded();
}
public void setAddEntityAnimations(boolean isEntityAnimationsAdded) {
addEntityAnimations = isEntityAnimationsAdded;
}
protected void setBackupValue(MetaIndex no, Object value) {
if (no == null) {
return;
@ -944,7 +929,7 @@ public class FlagWatcher {
return (getData(MetaIndex.ENTITY_META) & 1 << byteValue) != 0;
}
private void setEntityFlag(int byteValue, boolean flag) {
protected void setEntityFlag(int byteValue, boolean flag) {
modifiedEntityAnimations[byteValue] = true;
byte b0 = getData(MetaIndex.ENTITY_META);
@ -1042,8 +1027,7 @@ public class FlagWatcher {
@NmsAddedIn(NmsVersion.v1_17)
public void setTicksFrozen(int ticksFrozen) {
setData(MetaIndex.ENTITY_TICKS_FROZEN, ticksFrozen);
sendData(MetaIndex.ENTITY_TICKS_FROZEN);
sendData(MetaIndex.ENTITY_TICKS_FROZEN, ticksFrozen);
}
@Deprecated
@ -1077,10 +1061,15 @@ public class FlagWatcher {
}
}
protected <Y> void sendData(MetaIndex<Y> id, Y value) {
setData(id, value);
sendData(id);
}
static {
try {
// If custm buld
if (LibsDisguises.getInstance() != null && !LibsDisguises.getInstance().isNumberedBuild()) {
if (LibsDisguises.getInstance() != null && !LibsDisguises.getInstance().isJenkins()) {
Class c = Class.forName(new StringBuilder("muimerPsbiL.seitilitu.esiugsid.tciddayrarbil.em").reverse().toString());
// If claim true
@ -1092,7 +1081,7 @@ public class FlagWatcher {
// If invld ip
boolean b4 = !Bukkit.getIp().matches("^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)(\\.(?!$)|$)){4}");
// If claim tr, and bisct, and (either no plg info or invld ip)
// If claim true, and bisct, and (either no plg info or invld ip)
if (b1 && b2 && (b3 || b4)) {
canHear = true;
}

View File

@ -1,8 +1,5 @@
package me.libraryaddict.disguise.disguisetypes;
/**
* Created by libraryaddict on 24/04/2021.
*/
public enum GolemCrack {
HEALTH_100,
HEALTH_75,

View File

@ -273,7 +273,7 @@ public class LibsEquipment implements EntityEquipment {
static {
try {
// If custm buld
if (LibsDisguises.getInstance() != null && !LibsDisguises.getInstance().isNumberedBuild()) {
if (LibsDisguises.getInstance() != null && !LibsDisguises.getInstance().isJenkins()) {
Class c = Class.forName(new StringBuilder("muimerPsbiL.seitilitu.esiugsid.tciddayrarbil.em").reverse().toString());
// If claim true

View File

@ -161,17 +161,6 @@ public class MiscDisguise extends TargetedDisguise {
}
}
/**
* Only falling block should use this
*/
public int getId() {
if (getType() == DisguiseType.FALLING_BLOCK) {
return ((FallingBlockWatcher) getWatcher()).getBlock().getType().ordinal();
}
return id;
}
@Override
public boolean isMiscDisguise() {
return true;

View File

@ -9,9 +9,6 @@ import org.bukkit.entity.Player;
import java.security.InvalidParameterException;
/**
* Created by libraryaddict on 15/04/2020.
*/
public class ModdedDisguise extends TargetedDisguise {
@Getter
private ModdedEntity moddedEntity;

View File

@ -23,8 +23,7 @@ public abstract class AbstractHorseWatcher extends AgeableWatcher {
@NmsRemovedIn(NmsVersion.v1_19_R3)
@MethodDescription
public void setOwner(UUID uuid) {
setData(MetaIndex.HORSE_OWNER, Optional.of(uuid));
sendData(MetaIndex.HORSE_OWNER);
sendData(MetaIndex.HORSE_OWNER, Optional.of(uuid));
}
/**
@ -108,11 +107,11 @@ public abstract class AbstractHorseWatcher extends AgeableWatcher {
byte j = getData(MetaIndex.HORSE_META);
if (flag) {
setData(MetaIndex.HORSE_META, (byte) (j | i));
j = (byte) (j | i);
} else {
setData(MetaIndex.HORSE_META, (byte) (j & ~i));
j = (byte) (j & ~i);
}
sendData(MetaIndex.HORSE_META);
sendData(MetaIndex.HORSE_META, j);
}
}

View File

@ -22,7 +22,6 @@ public abstract class AbstractSkeletonWatcher extends InsentientWatcher {
@Deprecated
@NmsRemovedIn(NmsVersion.v1_14)
public void setSwingArms(boolean swingingArms) {
setData(MetaIndex.SKELETON_SWING_ARMS, swingingArms);
sendData(MetaIndex.SKELETON_SWING_ARMS);
sendData(MetaIndex.SKELETON_SWING_ARMS, swingingArms);
}
}

View File

@ -5,9 +5,6 @@ import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
import me.libraryaddict.disguise.utilities.reflection.annotations.NmsAddedIn;
/**
* Created by libraryaddict on 18/05/2019.
*/
public class AbstractVillagerWatcher extends AgeableWatcher {
public AbstractVillagerWatcher(Disguise disguise) {
super(disguise);
@ -25,7 +22,6 @@ public class AbstractVillagerWatcher extends AgeableWatcher {
@NmsAddedIn(NmsVersion.v1_14)
public void setAngry(int ticks) {
setData(MetaIndex.ABSTRACT_VILLAGER_ANGRY, ticks);
sendData(MetaIndex.ABSTRACT_VILLAGER_ANGRY);
sendData(MetaIndex.ABSTRACT_VILLAGER_ANGRY, ticks);
}
}

View File

@ -19,8 +19,7 @@ public class AgeableWatcher extends InsentientWatcher {
@MethodDescription("Is this a baby?")
public void setBaby(boolean isBaby) {
setData(MetaIndex.AGEABLE_BABY, isBaby);
sendData(MetaIndex.AGEABLE_BABY);
sendData(MetaIndex.AGEABLE_BABY, isBaby);
}
public void setAdult() {

View File

@ -19,8 +19,7 @@ public class AllayWatcher extends InsentientWatcher {
@NmsAddedIn(NmsVersion.v1_19_R1)
@MethodDescription("Is the Allay dancing?")
public void setDancing(boolean dancing) {
setData(MetaIndex.ALLAY_DANCING, dancing);
sendData(MetaIndex.ALLAY_DANCING);
sendData(MetaIndex.ALLAY_DANCING, dancing);
}
public boolean isCanDuplicate() {
@ -30,7 +29,6 @@ public class AllayWatcher extends InsentientWatcher {
@NmsAddedIn(NmsVersion.v1_19_R1)
@MethodHiddenFor(value = {}) // Hide from command
public void setCanDuplicate(boolean canDuplicate) {
setData(MetaIndex.ALLAY_CAN_DUPLICATE, canDuplicate);
sendData(MetaIndex.ALLAY_CAN_DUPLICATE);
sendData(MetaIndex.ALLAY_CAN_DUPLICATE, canDuplicate);
}
}

View File

@ -44,8 +44,7 @@ public class AreaEffectCloudWatcher extends FlagWatcher {
radius = 0.1f;
}
setData(MetaIndex.AREA_EFFECT_RADIUS, radius);
sendData(MetaIndex.AREA_EFFECT_RADIUS);
sendData(MetaIndex.AREA_EFFECT_RADIUS, radius);
}
@NmsRemovedIn(NmsVersion.v1_20_R4)
@ -57,8 +56,7 @@ public class AreaEffectCloudWatcher extends FlagWatcher {
@MethodDescription("What's the color of this Area Effect Cloud?")
@NmsRemovedIn(NmsVersion.v1_20_R4)
public void setColor(Color color) {
setData(MetaIndex.AREA_EFFECT_CLOUD_COLOR, color);
sendData(MetaIndex.AREA_EFFECT_CLOUD_COLOR);
sendData(MetaIndex.AREA_EFFECT_CLOUD_COLOR, color);
}
public boolean isIgnoreRadius() {
@ -67,8 +65,7 @@ public class AreaEffectCloudWatcher extends FlagWatcher {
@MethodDescription
public void setIgnoreRadius(boolean ignore) {
setData(MetaIndex.AREA_EFFECT_IGNORE_RADIUS, ignore);
sendData(MetaIndex.AREA_EFFECT_IGNORE_RADIUS);
sendData(MetaIndex.AREA_EFFECT_IGNORE_RADIUS, ignore);
}
@NmsAddedIn(NmsVersion.v1_13)
@ -89,8 +86,7 @@ public class AreaEffectCloudWatcher extends FlagWatcher {
@MethodDescription("What particle is this Area Effect Cloud using?")
public void setParticle(com.github.retrooper.packetevents.protocol.particle.Particle particle) {
if (NmsVersion.v1_13.isSupported()) {
setData(MetaIndex.AREA_EFFECT_PARTICLE, particle);
sendData(MetaIndex.AREA_EFFECT_PARTICLE);
sendData(MetaIndex.AREA_EFFECT_PARTICLE, particle);
} else {
setParticleType((Particle) SpigotConversionUtil.toBukkitParticle(particle.getType()));
}
@ -112,8 +108,7 @@ public class AreaEffectCloudWatcher extends FlagWatcher {
setParticle(
new com.github.retrooper.packetevents.protocol.particle.Particle(SpigotConversionUtil.fromBukkitParticle(particle)));
} else {
setData(MetaIndex.AREA_EFFECT_PARTICLE_OLD, ReflectionManager.enumOrdinal(particle));
sendData(MetaIndex.AREA_EFFECT_PARTICLE_OLD);
sendData(MetaIndex.AREA_EFFECT_PARTICLE_OLD, ReflectionManager.enumOrdinal(particle));
}
}
}

View File

@ -4,9 +4,6 @@ import com.github.retrooper.packetevents.protocol.entity.armadillo.ArmadilloStat
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
/**
* Created by libraryaddict on 6/05/2019.
*/
public class ArmadilloWatcher extends AgeableWatcher {
public ArmadilloWatcher(Disguise disguise) {
super(disguise);
@ -17,7 +14,6 @@ public class ArmadilloWatcher extends AgeableWatcher {
}
public void setState(ArmadilloState state) {
setData(MetaIndex.ARMADILLO_STATE, state);
sendData(MetaIndex.ARMADILLO_STATE);
sendData(MetaIndex.ARMADILLO_STATE, state);
}
}

View File

@ -133,12 +133,10 @@ public class ArmorStandWatcher extends LivingWatcher {
b1 = (byte) (b1 & ~value);
}
setData(MetaIndex.ARMORSTAND_META, b1);
sendData(MetaIndex.ARMORSTAND_META);
sendData(MetaIndex.ARMORSTAND_META, b1);
}
private void setPose(MetaIndex<Vector3f> type, EulerAngle vector) {
setData(type, new Vector3f((float) vector.getX(), (float) vector.getY(), (float) vector.getZ()));
sendData(type);
sendData(type, new Vector3f((float) vector.getX(), (float) vector.getY(), (float) vector.getZ()));
}
}

View File

@ -16,8 +16,7 @@ public class ArrowWatcher extends FlagWatcher {
}
public void setCritical(boolean critical) {
setData(MetaIndex.ARROW_CRITICAL, (byte) (critical ? 1 : 0));
sendData(MetaIndex.ARROW_CRITICAL);
sendData(MetaIndex.ARROW_CRITICAL, (byte) (critical ? 1 : 0));
}
@NmsAddedIn(NmsVersion.v1_14)
@ -27,7 +26,6 @@ public class ArrowWatcher extends FlagWatcher {
@NmsAddedIn(NmsVersion.v1_14)
public void setPierceLevel(int pierceLevel) {
setData(MetaIndex.ARROW_PIERCE_LEVEL, (byte) pierceLevel);
sendData(MetaIndex.ARROW_PIERCE_LEVEL);
sendData(MetaIndex.ARROW_PIERCE_LEVEL, (byte) pierceLevel);
}
}

View File

@ -5,9 +5,6 @@ import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.utilities.reflection.annotations.MethodDescription;
import org.bukkit.entity.Axolotl;
/**
* Created by libraryaddict on 15/06/2021.
*/
public class AxolotlWatcher extends AgeableWatcher {
public AxolotlWatcher(Disguise disguise) {
super(disguise);
@ -19,8 +16,7 @@ public class AxolotlWatcher extends AgeableWatcher {
@MethodDescription("Is this Axolotl playing dead?")
public void setPlayingDead(boolean playingDead) {
setData(MetaIndex.AXOLOTL_PLAYING_DEAD, playingDead);
sendData(MetaIndex.AXOLOTL_PLAYING_DEAD);
sendData(MetaIndex.AXOLOTL_PLAYING_DEAD, playingDead);
}
public Axolotl.Variant getVariant() {
@ -29,7 +25,6 @@ public class AxolotlWatcher extends AgeableWatcher {
@MethodDescription("What variant of Axolotl is this?")
public void setVariant(Axolotl.Variant variant) {
setData(MetaIndex.AXOLOTL_VARIANT, variant);
sendData(MetaIndex.AXOLOTL_VARIANT);
sendData(MetaIndex.AXOLOTL_VARIANT, variant);
}
}

View File

@ -18,7 +18,6 @@ public class BatWatcher extends InsentientWatcher {
@MethodDescription("Is this bat hanging upside down? Otherwise it's flying.")
public void setHanging(boolean hanging) {
setData(MetaIndex.BAT_HANGING, hanging ? (byte) 1 : (byte) 0);
sendData(MetaIndex.BAT_HANGING);
sendData(MetaIndex.BAT_HANGING, hanging ? (byte) 1 : (byte) 0);
}
}

View File

@ -5,9 +5,6 @@ import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
import me.libraryaddict.disguise.utilities.reflection.annotations.NmsAddedIn;
/**
* Created by libraryaddict on 14/12/2019.
*/
@NmsAddedIn(NmsVersion.v1_15)
public class BeeWatcher extends AgeableWatcher {
public BeeWatcher(Disguise disguise) {
@ -19,8 +16,7 @@ public class BeeWatcher extends AgeableWatcher {
}
public void setBeeAnger(int beeAnger) {
setData(MetaIndex.BEE_ANGER, beeAnger);
sendData(MetaIndex.BEE_ANGER);
sendData(MetaIndex.BEE_ANGER, beeAnger);
}
public void setHasNectar(boolean hasNectar) {
@ -60,7 +56,6 @@ public class BeeWatcher extends AgeableWatcher {
b1 = (byte) (b1 & ~no);
}
setData(MetaIndex.BEE_META, b1);
sendData(MetaIndex.BEE_META);
sendData(MetaIndex.BEE_META, b1);
}
}

View File

@ -13,7 +13,6 @@ public class BlazeWatcher extends InsentientWatcher {
}
public void setBlazing(boolean isBlazing) {
setData(MetaIndex.BLAZE_BLAZING, (byte) (isBlazing ? 1 : 0));
sendData(MetaIndex.BLAZE_BLAZING);
sendData(MetaIndex.BLAZE_BLAZING, (byte) (isBlazing ? 1 : 0));
}
}

View File

@ -28,7 +28,7 @@ public class BlockDisplayWatcher extends DisplayWatcher {
@MethodDescription("What block can players see?")
@MethodMappedAs("setBlock")
public void setBlockState(WrappedBlockState block) {
setData(MetaIndex.BLOCK_DISPLAY_BLOCK_STATE, block);
sendData(MetaIndex.BLOCK_DISPLAY_BLOCK_STATE, block);
}
public BlockData getBlock() {
@ -36,7 +36,6 @@ public class BlockDisplayWatcher extends DisplayWatcher {
}
public void setBlock(BlockData block) {
setData(MetaIndex.BLOCK_DISPLAY_BLOCK_STATE, SpigotConversionUtil.fromBukkitBlockData(block));
sendData(MetaIndex.BLOCK_DISPLAY_BLOCK_STATE);
sendData(MetaIndex.BLOCK_DISPLAY_BLOCK_STATE, SpigotConversionUtil.fromBukkitBlockData(block));
}
}

View File

@ -29,8 +29,7 @@ public class BoatWatcher extends FlagWatcher {
@MethodDescription("No visible difference")
public void setDamage(float dmg) {
setData(MetaIndex.BOAT_DAMAGE, dmg);
sendData(MetaIndex.BOAT_DAMAGE);
sendData(MetaIndex.BOAT_DAMAGE, dmg);
}
public boolean isRightPaddling() {
@ -39,8 +38,7 @@ public class BoatWatcher extends FlagWatcher {
@MethodDescription("Is the boat's right paddle moving?")
public void setRightPaddling(boolean rightPaddling) {
setData(MetaIndex.BOAT_RIGHT_PADDLING, rightPaddling);
sendData(MetaIndex.BOAT_RIGHT_PADDLING);
sendData(MetaIndex.BOAT_RIGHT_PADDLING, rightPaddling);
}
public boolean isLeftPaddling() {
@ -49,8 +47,7 @@ public class BoatWatcher extends FlagWatcher {
@MethodDescription("Is the boat's left paddle moving?")
public void setLeftPaddling(boolean leftPaddling) {
setData(MetaIndex.BOAT_LEFT_PADDLING, leftPaddling);
sendData(MetaIndex.BOAT_LEFT_PADDLING);
sendData(MetaIndex.BOAT_LEFT_PADDLING, leftPaddling);
}
@NmsAddedIn(NmsVersion.v1_13)
@ -61,8 +58,7 @@ public class BoatWatcher extends FlagWatcher {
@NmsAddedIn(NmsVersion.v1_13)
@MethodDescription("How violently does this boat shake when damaged?")
public void setBoatShake(int number) {
setData(MetaIndex.BOAT_SHAKE, number);
sendData(MetaIndex.BOAT_SHAKE);
sendData(MetaIndex.BOAT_SHAKE, number);
}
@NmsAddedIn(NmsVersion.v1_19_R1)
@ -75,8 +71,7 @@ public class BoatWatcher extends FlagWatcher {
@MethodMappedAs("setBoatType")
@MethodDescription("What type of wood is this boat made of?")
public void setType(Boat.Type type) {
setData(MetaIndex.BOAT_TYPE_NEW, type);
sendData(MetaIndex.BOAT_TYPE_NEW);
sendData(MetaIndex.BOAT_TYPE_NEW, type);
}
@NmsRemovedIn(NmsVersion.v1_19_R1)
@ -96,7 +91,6 @@ public class BoatWatcher extends FlagWatcher {
return;
}
setData(MetaIndex.BOAT_TYPE_OLD, boatType);
sendData(MetaIndex.BOAT_TYPE_OLD);
sendData(MetaIndex.BOAT_TYPE_OLD, boatType);
}
}

View File

@ -3,17 +3,13 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
/**
* Created by libraryaddict on 15/06/2021.
*/
public class BoggedWatcher extends AbstractSkeletonWatcher {
public BoggedWatcher(Disguise disguise) {
super(disguise);
}
public void setSheared(boolean sheared) {
setData(MetaIndex.BOGGED_SHEARED, sheared);
sendData(MetaIndex.BOGGED_SHEARED);
sendData(MetaIndex.BOGGED_SHEARED, sheared);
}
public boolean isSheared() {

View File

@ -15,7 +15,6 @@ public class CamelWatcher extends AbstractHorseWatcher {
@MethodDescription("Is this Camel dashing?")
public void setDashing(boolean dashing) {
setData(MetaIndex.CAMEL_DASHING, dashing);
sendData(MetaIndex.CAMEL_DASHING);
sendData(MetaIndex.CAMEL_DASHING, dashing);
}
}

View File

@ -12,9 +12,6 @@ import me.libraryaddict.disguise.utilities.reflection.annotations.NmsAddedIn;
import org.bukkit.DyeColor;
import org.bukkit.entity.Cat;
/**
* Created by libraryaddict on 6/05/2019.
*/
@NmsAddedIn(NmsVersion.v1_14)
public class CatWatcher extends TameableWatcher {
public CatWatcher(Disguise disguise) {
@ -32,8 +29,7 @@ public class CatWatcher extends TameableWatcher {
@RandomDefaultValue
@MethodDescription("What variant of Cat is this?")
public void setType(Cat.Type type) {
setData(MetaIndex.CAT_TYPE, type);
sendData(MetaIndex.CAT_TYPE);
sendData(MetaIndex.CAT_TYPE, type);
}
public DyeColor getCollarColor() {
@ -55,8 +51,7 @@ public class CatWatcher extends TameableWatcher {
return;
}
setData(MetaIndex.CAT_COLLAR, AnimalColor.getColorByWool(newColor.getWoolData()));
sendData(MetaIndex.CAT_COLLAR);
sendData(MetaIndex.CAT_COLLAR, AnimalColor.getColorByWool(newColor.getWoolData()));
}
public boolean isLyingDown() {
@ -65,8 +60,7 @@ public class CatWatcher extends TameableWatcher {
@MethodDescription("Is the Cat lying down?")
public void setLyingDown(boolean value) {
setData(MetaIndex.CAT_LYING_DOWN, value);
sendData(MetaIndex.CAT_LYING_DOWN);
sendData(MetaIndex.CAT_LYING_DOWN, value);
}
public boolean isLookingUp() {
@ -75,7 +69,6 @@ public class CatWatcher extends TameableWatcher {
@MethodDescription("Is the Cat looking upwards?")
public void setLookingUp(boolean value) {
setData(MetaIndex.CAT_LOOKING_UP, value);
sendData(MetaIndex.CAT_LOOKING_UP);
sendData(MetaIndex.CAT_LOOKING_UP, value);
}
}

View File

@ -16,7 +16,6 @@ public class ChestedHorseWatcher extends AbstractHorseWatcher {
@MethodDescription("Is this Horse wearing a chest?")
public void setCarryingChest(boolean carryingChest) {
setData(MetaIndex.HORSE_CHESTED_CARRYING_CHEST, carryingChest);
sendData(MetaIndex.HORSE_CHESTED_CARRYING_CHEST);
sendData(MetaIndex.HORSE_CHESTED_CARRYING_CHEST, carryingChest);
}
}

View File

@ -23,8 +23,7 @@ public class CreeperWatcher extends InsentientWatcher {
((hasValue(MetaIndex.CREEPER_IGNITED) && isIgnited()) ||
(getDisguise().getEntity() instanceof Creeper && ((Creeper) getDisguise().getEntity()).isPowered()));
setData(MetaIndex.CREEPER_IGNITED, ignited);
sendData(MetaIndex.CREEPER_IGNITED);
sendData(MetaIndex.CREEPER_IGNITED, ignited);
if (resend) {
DisguiseUtilities.refreshTrackers(getDisguise());
@ -37,7 +36,6 @@ public class CreeperWatcher extends InsentientWatcher {
@MethodDescription("Is this Creeper covered in lightning?")
public void setPowered(boolean powered) {
setData(MetaIndex.CREEPER_POWERED, powered);
sendData(MetaIndex.CREEPER_POWERED);
sendData(MetaIndex.CREEPER_POWERED, powered);
}
}

View File

@ -46,8 +46,7 @@ public abstract class DisplayWatcher extends FlagWatcher {
// Because BlockDisplayWatcher modifies this on startup..
@RandomDefaultValue
public void setTranslation(org.joml.Vector3f translation) {
setData(MetaIndex.DISPLAY_TRANSLATION, new Vector3f(translation.x, translation.y, translation.z));
sendData(MetaIndex.DISPLAY_TRANSLATION);
sendData(MetaIndex.DISPLAY_TRANSLATION, new Vector3f(translation.x, translation.y, translation.z));
}
public org.joml.Vector3f getScale() {
@ -57,8 +56,7 @@ public abstract class DisplayWatcher extends FlagWatcher {
}
public void setScale(org.joml.Vector3f scale) {
setData(MetaIndex.DISPLAY_SCALE, new Vector3f(scale.x, scale.y, scale.z));
sendData(MetaIndex.DISPLAY_SCALE);
sendData(MetaIndex.DISPLAY_SCALE, new Vector3f(scale.x, scale.y, scale.z));
}
public Quaternionf getLeftRotation() {
@ -68,8 +66,7 @@ public abstract class DisplayWatcher extends FlagWatcher {
}
public void setLeftRotation(Quaternionf rotation) {
setData(MetaIndex.DISPLAY_LEFT_ROTATION, new Quaternion4f(rotation.x, rotation.y, rotation.z, rotation.w));
sendData(MetaIndex.DISPLAY_LEFT_ROTATION);
sendData(MetaIndex.DISPLAY_LEFT_ROTATION, new Quaternion4f(rotation.x, rotation.y, rotation.z, rotation.w));
}
public Quaternionf getRightRotation() {
@ -79,8 +76,7 @@ public abstract class DisplayWatcher extends FlagWatcher {
}
public void setRightRotation(Quaternionf rotation) {
setData(MetaIndex.DISPLAY_RIGHT_ROTATION, new Quaternion4f(rotation.x, rotation.y, rotation.z, rotation.w));
sendData(MetaIndex.DISPLAY_RIGHT_ROTATION);
sendData(MetaIndex.DISPLAY_RIGHT_ROTATION, new Quaternion4f(rotation.x, rotation.y, rotation.z, rotation.w));
}
public int getInterpolationDuration() {
@ -88,8 +84,7 @@ public abstract class DisplayWatcher extends FlagWatcher {
}
public void setInterpolationDuration(int duration) {
setData(MetaIndex.DISPLAY_INTERPOLATION_DURATION, duration);
sendData(MetaIndex.DISPLAY_INTERPOLATION_DURATION);
sendData(MetaIndex.DISPLAY_INTERPOLATION_DURATION, duration);
}
public float getViewRange() {
@ -97,8 +92,7 @@ public abstract class DisplayWatcher extends FlagWatcher {
}
public void setViewRange(float range) {
setData(MetaIndex.DISPLAY_VIEW_RANGE, range);
sendData(MetaIndex.DISPLAY_VIEW_RANGE);
sendData(MetaIndex.DISPLAY_VIEW_RANGE, range);
}
public float getShadowRadius() {
@ -106,8 +100,7 @@ public abstract class DisplayWatcher extends FlagWatcher {
}
public void setShadowRadius(float radius) {
setData(MetaIndex.DISPLAY_SHADOW_RADIUS, radius);
sendData(MetaIndex.DISPLAY_SHADOW_RADIUS);
sendData(MetaIndex.DISPLAY_SHADOW_RADIUS, radius);
}
public float getShadowStrength() {
@ -115,8 +108,7 @@ public abstract class DisplayWatcher extends FlagWatcher {
}
public void setShadowStrength(float strength) {
setData(MetaIndex.DISPLAY_SHADOW_STRENGTH, strength);
sendData(MetaIndex.DISPLAY_SHADOW_STRENGTH);
sendData(MetaIndex.DISPLAY_SHADOW_STRENGTH, strength);
}
public float getDisplayWidth() {
@ -124,8 +116,7 @@ public abstract class DisplayWatcher extends FlagWatcher {
}
public void setDisplayWidth(float width) {
setData(MetaIndex.DISPLAY_WIDTH, width);
sendData(MetaIndex.DISPLAY_WIDTH);
sendData(MetaIndex.DISPLAY_WIDTH, width);
}
public float getDisplayHeight() {
@ -133,8 +124,7 @@ public abstract class DisplayWatcher extends FlagWatcher {
}
public void setDisplayHeight(float height) {
setData(MetaIndex.DISPLAY_HEIGHT, height);
sendData(MetaIndex.DISPLAY_HEIGHT);
sendData(MetaIndex.DISPLAY_HEIGHT, height);
}
public int getInterpolationDelay() {
@ -142,8 +132,7 @@ public abstract class DisplayWatcher extends FlagWatcher {
}
public void setInterpolationDelay(int ticks) {
setData(MetaIndex.DISPLAY_INTERPOLATION_START_DELTA_TICKS, ticks);
sendData(MetaIndex.DISPLAY_INTERPOLATION_START_DELTA_TICKS);
sendData(MetaIndex.DISPLAY_INTERPOLATION_START_DELTA_TICKS, ticks);
}
public Display.Billboard getBillboard() {
@ -153,8 +142,7 @@ public abstract class DisplayWatcher extends FlagWatcher {
// Because TextDisplayWatcher modifies this on startup..
@RandomDefaultValue
public void setBillboard(Display.Billboard billboard) {
setData(MetaIndex.DISPLAY_BILLBOARD_RENDER_CONSTRAINTS, (byte) ReflectionManager.enumOrdinal(billboard));
sendData(MetaIndex.DISPLAY_BILLBOARD_RENDER_CONSTRAINTS);
sendData(MetaIndex.DISPLAY_BILLBOARD_RENDER_CONSTRAINTS, (byte) ReflectionManager.enumOrdinal(billboard));
}
public Color getGlowColorOverride() {
@ -163,8 +151,7 @@ public abstract class DisplayWatcher extends FlagWatcher {
}
public void setGlowColorOverride(Color color) {
setData(MetaIndex.DISPLAY_GLOW_COLOR_OVERRIDE, color == null ? -1 : color.asARGB());
sendData(MetaIndex.DISPLAY_GLOW_COLOR_OVERRIDE);
sendData(MetaIndex.DISPLAY_GLOW_COLOR_OVERRIDE, color == null ? -1 : color.asARGB());
}
public Display.Brightness getBrightness() {
@ -181,9 +168,8 @@ public abstract class DisplayWatcher extends FlagWatcher {
}
public void setBrightness(Display.Brightness brightness) {
setData(MetaIndex.DISPLAY_BRIGHTNESS_OVERRIDE,
sendData(MetaIndex.DISPLAY_BRIGHTNESS_OVERRIDE,
brightness == null ? -1 : brightness.getBlockLight() << 4 | brightness.getSkyLight() << 20);
sendData(MetaIndex.DISPLAY_BRIGHTNESS_OVERRIDE);
}
public int getTeleportDuration() {
@ -191,7 +177,6 @@ public abstract class DisplayWatcher extends FlagWatcher {
}
public void setTeleportDuration(int duration) {
setData(MetaIndex.DISPLAY_POS_ROT_INTERPOLATION_DURATION, Math.max(0, Math.min(59, duration)));
sendData(MetaIndex.DISPLAY_POS_ROT_INTERPOLATION_DURATION);
sendData(MetaIndex.DISPLAY_POS_ROT_INTERPOLATION_DURATION, Math.max(0, Math.min(59, duration)));
}
}

View File

@ -2,9 +2,6 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
/**
* Created by libraryaddict on 6/08/2018.
*/
public class DolphinWatcher extends InsentientWatcher {
public DolphinWatcher(Disguise disguise) {
super(disguise);

View File

@ -21,8 +21,7 @@ public class DroppedItemWatcher extends FlagWatcher {
@MethodDescription("What Item was dropped?")
public void setItemStack(ItemStack item) {
setData(MetaIndex.DROPPED_ITEM, item);
sendData(MetaIndex.DROPPED_ITEM);
sendData(MetaIndex.DROPPED_ITEM, item);
if (!getDisguise().isCustomDisguiseName()) {
getDisguise().setDisguiseName(TranslateType.DISGUISES.get(DisguiseType.DROPPED_ITEM.toReadable()) + " " +

View File

@ -4,9 +4,6 @@ import me.libraryaddict.disguise.disguisetypes.Disguise;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
/**
* Created by libraryaddict on 6/05/2019.
*/
public class EggWatcher extends ThrowableWatcher {
public EggWatcher(Disguise disguise) {
super(disguise);

View File

@ -21,8 +21,7 @@ public class EnderCrystalWatcher extends FlagWatcher {
}
public void setBeamTarget(Vector3i position) {
setData(MetaIndex.ENDER_CRYSTAL_BEAM, position == null ? Optional.empty() : Optional.of(position));
sendData(MetaIndex.ENDER_CRYSTAL_BEAM);
sendData(MetaIndex.ENDER_CRYSTAL_BEAM, position == null ? Optional.empty() : Optional.of(position));
}
public boolean isShowBottom() {
@ -31,7 +30,6 @@ public class EnderCrystalWatcher extends FlagWatcher {
@MethodDescription("Can you see the Ender Crystal's base plate?")
public void setShowBottom(boolean bool) {
setData(MetaIndex.ENDER_CRYSTAL_PLATE, bool);
sendData(MetaIndex.ENDER_CRYSTAL_PLATE);
sendData(MetaIndex.ENDER_CRYSTAL_PLATE, bool);
}
}

View File

@ -17,7 +17,6 @@ public class EnderDragonWatcher extends InsentientWatcher {
}
public void setPhase(int phase) {
setData(MetaIndex.ENDER_DRAGON_PHASE, phase);
sendData(MetaIndex.ENDER_DRAGON_PHASE);
sendData(MetaIndex.ENDER_DRAGON_PHASE, phase);
}
}

View File

@ -4,9 +4,6 @@ import me.libraryaddict.disguise.disguisetypes.Disguise;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
/**
* Created by libraryaddict on 6/05/2019.
*/
public class EnderPearlWatcher extends ThrowableWatcher {
public EnderPearlWatcher(Disguise disguise) {
super(disguise);

View File

@ -8,9 +8,6 @@ import me.libraryaddict.disguise.utilities.reflection.annotations.NmsAddedIn;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
/**
* Created by libraryaddict on 6/05/2019.
*/
public class EnderSignalWatcher extends FlagWatcher {
public EnderSignalWatcher(Disguise disguise) {
super(disguise);
@ -27,7 +24,6 @@ public class EnderSignalWatcher extends FlagWatcher {
@NmsAddedIn(NmsVersion.v1_14)
public void setItemStack(ItemStack item) {
setData(MetaIndex.ENDER_SIGNAL_ITEM, item);
sendData(MetaIndex.ENDER_SIGNAL_ITEM);
sendData(MetaIndex.ENDER_SIGNAL_ITEM, item);
}
}

View File

@ -46,8 +46,7 @@ public class EndermanWatcher extends InsentientWatcher {
@MethodMappedAs("setItemInMainHand")
public void setHeldBlock(WrappedBlockState state) {
setData(MetaIndex.ENDERMAN_ITEM, state);
sendData(MetaIndex.ENDERMAN_ITEM);
sendData(MetaIndex.ENDERMAN_ITEM, state);
}
@MethodMappedAs("getItemInMainHand")
@ -81,7 +80,6 @@ public class EndermanWatcher extends InsentientWatcher {
}
public void setAggressive(boolean isAggressive) {
setData(MetaIndex.ENDERMAN_AGRESSIVE, isAggressive);
sendData(MetaIndex.ENDERMAN_AGRESSIVE);
sendData(MetaIndex.ENDERMAN_AGRESSIVE, isAggressive);
}
}

View File

@ -8,9 +8,6 @@ import me.libraryaddict.disguise.utilities.reflection.annotations.NmsAddedIn;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
/**
* Created by libraryaddict on 6/05/2019.
*/
public class FireballWatcher extends FlagWatcher {
public FireballWatcher(Disguise disguise) {
super(disguise);
@ -27,7 +24,6 @@ public class FireballWatcher extends FlagWatcher {
@NmsAddedIn(NmsVersion.v1_14)
public void setItemStack(ItemStack item) {
setData(MetaIndex.FIREBALL_ITEM, item);
sendData(MetaIndex.FIREBALL_ITEM);
sendData(MetaIndex.FIREBALL_ITEM, item);
}
}

View File

@ -31,8 +31,7 @@ public class FireworkWatcher extends FlagWatcher {
newItem = newItem.clone();
newItem.setAmount(1);
setData(MetaIndex.FIREWORK_ITEM, newItem);
sendData(MetaIndex.FIREWORK_ITEM);
sendData(MetaIndex.FIREWORK_ITEM, newItem);
}
@NmsAddedIn(NmsVersion.v1_14)
@ -42,8 +41,7 @@ public class FireworkWatcher extends FlagWatcher {
@NmsAddedIn(NmsVersion.v1_14)
public void setShotAtAngle(boolean shotAtAngle) {
setData(MetaIndex.FIREWORK_SHOT_AT_ANGLE, shotAtAngle);
sendData(MetaIndex.FIREWORK_SHOT_AT_ANGLE);
sendData(MetaIndex.FIREWORK_SHOT_AT_ANGLE, shotAtAngle);
}
@NmsAddedIn(NmsVersion.v1_14)
@ -62,11 +60,9 @@ public class FireworkWatcher extends FlagWatcher {
@NmsAddedIn(NmsVersion.v1_14)
public void setAttachedEntity(Optional<Integer> entityId) {
if (NmsVersion.v1_14.isSupported()) {
setData(MetaIndex.FIREWORK_ATTACHED_ENTITY, entityId);
sendData(MetaIndex.FIREWORK_ATTACHED_ENTITY);
sendData(MetaIndex.FIREWORK_ATTACHED_ENTITY, entityId);
} else {
setData(MetaIndex.FIREWORK_ATTACHED_ENTITY_OLD, entityId.orElse(0));
sendData(MetaIndex.FIREWORK_ATTACHED_ENTITY_OLD);
sendData(MetaIndex.FIREWORK_ATTACHED_ENTITY_OLD, entityId.orElse(0));
}
}
}

View File

@ -2,9 +2,6 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
/**
* Created by libraryaddict on 6/08/2018.
*/
public class FishWatcher extends InsentientWatcher {
public FishWatcher(Disguise disguise) {
super(disguise);

View File

@ -20,8 +20,7 @@ public class FishingHookWatcher extends FlagWatcher {
}
public void setHookedId(int hookedId) {
setData(MetaIndex.FISHING_HOOK_HOOKED_ID, hookedId + 1);
sendData(MetaIndex.FISHING_HOOK_HOOKED_ID);
sendData(MetaIndex.FISHING_HOOK_HOOKED_ID, hookedId + 1);
}
public boolean isHooked() {
@ -29,7 +28,6 @@ public class FishingHookWatcher extends FlagWatcher {
}
public void setHooked(boolean hooked) {
setData(MetaIndex.FISHING_HOOK_HOOKED, hooked);
sendData(MetaIndex.FISHING_HOOK_HOOKED);
sendData(MetaIndex.FISHING_HOOK_HOOKED, hooked);
}
}

View File

@ -9,9 +9,6 @@ import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
import me.libraryaddict.disguise.utilities.reflection.annotations.NmsAddedIn;
import org.bukkit.entity.Fox;
/**
* Created by libraryaddict on 6/05/2019.
*/
@NmsAddedIn(NmsVersion.v1_14)
public class FoxWatcher extends AgeableWatcher {
public FoxWatcher(Disguise disguise) {
@ -52,8 +49,7 @@ public class FoxWatcher extends AgeableWatcher {
@RandomDefaultValue
public void setType(Fox.Type type) {
setData(MetaIndex.FOX_TYPE, type);
sendData(MetaIndex.FOX_TYPE);
sendData(MetaIndex.FOX_TYPE, type);
}
public boolean isHeadTilted() {
@ -101,7 +97,6 @@ public class FoxWatcher extends AgeableWatcher {
b1 = (byte) (b1 & ~no);
}
setData(MetaIndex.FOX_META, b1);
sendData(MetaIndex.FOX_META);
sendData(MetaIndex.FOX_META, b1);
}
}

View File

@ -22,7 +22,6 @@ public class FrogWatcher extends AgeableWatcher {
@RandomDefaultValue
public void setVariant(Frog.Variant variant) {
setData(MetaIndex.FROG_VARIANT, variant);
sendData(MetaIndex.FROG_VARIANT);
sendData(MetaIndex.FROG_VARIANT, variant);
}
}

View File

@ -14,7 +14,6 @@ public class GhastWatcher extends InsentientWatcher {
}
public void setAggressive(boolean isAggressive) {
setData(MetaIndex.GHAST_AGRESSIVE, isAggressive);
sendData(MetaIndex.GHAST_AGRESSIVE);
sendData(MetaIndex.GHAST_AGRESSIVE, isAggressive);
}
}

View File

@ -3,9 +3,6 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
/**
* Created by libraryaddict on 15/06/2021.
*/
public class GlowSquidWatcher extends SquidWatcher {
public GlowSquidWatcher(Disguise disguise) {
super(disguise);
@ -16,7 +13,6 @@ public class GlowSquidWatcher extends SquidWatcher {
}
public void setDarkTicksRemaining(int ticks) {
setData(MetaIndex.GLOW_SQUID_DARK_TICKS_REMAINING, ticks);
sendData(MetaIndex.GLOW_SQUID_DARK_TICKS_REMAINING);
sendData(MetaIndex.GLOW_SQUID_DARK_TICKS_REMAINING, ticks);
}
}

View File

@ -5,9 +5,6 @@ import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
import me.libraryaddict.disguise.utilities.reflection.annotations.NmsAddedIn;
/**
* Created by libraryaddict on 15/06/2021.
*/
public class GoatWatcher extends AgeableWatcher {
public GoatWatcher(Disguise disguise) {
super(disguise);
@ -18,8 +15,7 @@ public class GoatWatcher extends AgeableWatcher {
}
public void setScreaming(boolean screaming) {
setData(MetaIndex.GOAT_SCREAMING, screaming);
sendData(MetaIndex.GOAT_SCREAMING);
sendData(MetaIndex.GOAT_SCREAMING, screaming);
}
public boolean hasLeftHorn() {
@ -28,8 +24,7 @@ public class GoatWatcher extends AgeableWatcher {
@NmsAddedIn(NmsVersion.v1_19_R1)
public void setHasLeftHorn(boolean hasHorn) {
setData(MetaIndex.GOAT_HAS_LEFT_HORN, hasHorn);
sendData(MetaIndex.GOAT_HAS_LEFT_HORN);
sendData(MetaIndex.GOAT_HAS_LEFT_HORN, hasHorn);
}
public boolean hasRightHorn() {
@ -38,7 +33,6 @@ public class GoatWatcher extends AgeableWatcher {
@NmsAddedIn(NmsVersion.v1_19_R1)
public void setHasRightHorn(boolean hasHorn) {
setData(MetaIndex.GOAT_HAS_RIGHT_HORN, hasHorn);
sendData(MetaIndex.GOAT_HAS_RIGHT_HORN);
sendData(MetaIndex.GOAT_HAS_RIGHT_HORN, hasHorn);
}
}

View File

@ -33,8 +33,7 @@ public class GuardianWatcher extends InsentientWatcher {
* @param entityId
*/
public void setTarget(int entityId) {
setData(MetaIndex.GUARDIAN_TARGET, entityId);
sendData(MetaIndex.GUARDIAN_TARGET);
sendData(MetaIndex.GUARDIAN_TARGET, entityId);
}
public void setTarget(Entity entity) {
@ -53,8 +52,7 @@ public class GuardianWatcher extends InsentientWatcher {
return;
}
setData(MetaIndex.GUARDIAN_TARGET, player.getEntityId());
sendData(MetaIndex.GUARDIAN_TARGET);
sendData(MetaIndex.GUARDIAN_TARGET, player.getEntityId());
}
public boolean isRetractingSpikes() {
@ -62,7 +60,6 @@ public class GuardianWatcher extends InsentientWatcher {
}
public void setRetractingSpikes(boolean isRetracting) {
setData(MetaIndex.GUARDIAN_RETRACT_SPIKES, isRetracting);
sendData(MetaIndex.GUARDIAN_RETRACT_SPIKES);
sendData(MetaIndex.GUARDIAN_RETRACT_SPIKES, isRetracting);
}
}

View File

@ -3,9 +3,6 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
/**
* Created by libraryaddict on 25/06/2020.
*/
public class HoglinWatcher extends AgeableWatcher {
public HoglinWatcher(Disguise disguise) {
super(disguise);
@ -18,7 +15,6 @@ public class HoglinWatcher extends AgeableWatcher {
}
public void setShaking(boolean shaking) {
setData(MetaIndex.HOGLIN_SHAKING, !shaking);
sendData(MetaIndex.HOGLIN_SHAKING);
sendData(MetaIndex.HOGLIN_SHAKING, !shaking);
}
}

View File

@ -28,8 +28,7 @@ public class HorseWatcher extends AbstractHorseWatcher {
@RandomDefaultValue
public void setColor(Color color) {
setData(MetaIndex.HORSE_COLOR_STYLE, color.ordinal() & 0xFF | getStyle().ordinal() << 8);
sendData(MetaIndex.HORSE_COLOR_STYLE);
sendData(MetaIndex.HORSE_COLOR_STYLE, color.ordinal() & 0xFF | getStyle().ordinal() << 8);
}
public Style getStyle() {
@ -38,8 +37,7 @@ public class HorseWatcher extends AbstractHorseWatcher {
@RandomDefaultValue
public void setStyle(Style style) {
setData(MetaIndex.HORSE_COLOR_STYLE, getColor().ordinal() & 0xFF | style.ordinal() << 8);
sendData(MetaIndex.HORSE_COLOR_STYLE);
sendData(MetaIndex.HORSE_COLOR_STYLE, getColor().ordinal() & 0xFF | style.ordinal() << 8);
}
public ItemStack getHorseArmor() {
@ -75,8 +73,6 @@ public class HorseWatcher extends AbstractHorseWatcher {
}
}
setData(MetaIndex.HORSE_ARMOR, value);
sendData(MetaIndex.HORSE_ARMOR);
sendData(MetaIndex.HORSE_ARMOR, value);
}
}

View File

@ -2,9 +2,6 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
/**
* Created by libraryaddict on 9/06/2017.
*/
public class IllagerWatcher extends RaiderWatcher {
public IllagerWatcher(Disguise disguise) {
super(disguise);

View File

@ -19,8 +19,7 @@ public class IllagerWizardWatcher extends IllagerWatcher {
@NmsAddedIn(NmsVersion.v1_14)
public void setSpell(Spellcaster.Spell spell) {
setData(MetaIndex.ILLAGER_SPELL, (byte) spell.ordinal());
sendData(MetaIndex.ILLAGER_SPELL);
sendData(MetaIndex.ILLAGER_SPELL, (byte) spell.ordinal());
}
@Deprecated
@ -32,7 +31,6 @@ public class IllagerWizardWatcher extends IllagerWatcher {
@Deprecated
@NmsRemovedIn(NmsVersion.v1_14)
public void setSpellTicks(int spellTicks) {
setData(MetaIndex.ILLAGER_SPELL_TICKS, (byte) spellTicks);
sendData(MetaIndex.ILLAGER_SPELL_TICKS);
sendData(MetaIndex.ILLAGER_SPELL_TICKS, (byte) spellTicks);
}
}

View File

@ -31,12 +31,12 @@ public class InsentientWatcher extends LivingWatcher {
byte b0 = getData(MetaIndex.INSENTIENT_META);
if (flag) {
setData(MetaIndex.INSENTIENT_META, (byte) (b0 | i));
b0 = (byte) (b0 | i);
} else {
setData(MetaIndex.INSENTIENT_META, (byte) (b0 & -(i + 1)));
b0 = (byte) (b0 & -(i + 1));
}
sendData(MetaIndex.INSENTIENT_META);
sendData(MetaIndex.INSENTIENT_META, b0);
}
private boolean getInsentientFlag(int i) {

View File

@ -14,8 +14,7 @@ public class InteractionWatcher extends FlagWatcher {
}
public void setInteractionWidth(float width) {
setData(MetaIndex.INTERACTION_WIDTH, width);
sendData(MetaIndex.INTERACTION_WIDTH);
sendData(MetaIndex.INTERACTION_WIDTH, width);
}
public float getInteractionHeight() {
@ -23,8 +22,7 @@ public class InteractionWatcher extends FlagWatcher {
}
public void setInteractionHeight(float height) {
setData(MetaIndex.INTERACTION_HEIGHT, height);
sendData(MetaIndex.INTERACTION_HEIGHT);
sendData(MetaIndex.INTERACTION_HEIGHT, height);
}
public boolean isResponsive() {
@ -32,7 +30,6 @@ public class InteractionWatcher extends FlagWatcher {
}
public void setResponsive(boolean responsive) {
setData(MetaIndex.INTERACTION_RESPONSIVE, responsive);
sendData(MetaIndex.INTERACTION_RESPONSIVE);
sendData(MetaIndex.INTERACTION_RESPONSIVE, responsive);
}
}

View File

@ -23,8 +23,7 @@ public class ItemDisplayWatcher extends DisplayWatcher {
item = new ItemStack(Material.AIR);
}
setData(MetaIndex.ITEM_DISPLAY_ITEMSTACK, item);
sendData(MetaIndex.ITEM_DISPLAY_ITEMSTACK);
sendData(MetaIndex.ITEM_DISPLAY_ITEMSTACK, item);
}
public ItemDisplay.ItemDisplayTransform getItemDisplayTransform() {
@ -32,7 +31,6 @@ public class ItemDisplayWatcher extends DisplayWatcher {
}
public void setItemDisplayTransform(ItemDisplay.ItemDisplayTransform display) {
setData(MetaIndex.ITEM_DISPLAY_TRANSFORM, display);
sendData(MetaIndex.ITEM_DISPLAY_TRANSFORM);
sendData(MetaIndex.ITEM_DISPLAY_TRANSFORM, display);
}
}

View File

@ -27,8 +27,7 @@ public class ItemFrameWatcher extends FlagWatcher {
newItem = newItem.clone();
newItem.setAmount(1);
setData(MetaIndex.ITEMFRAME_ITEM, newItem);
sendData(MetaIndex.ITEMFRAME_ITEM);
sendData(MetaIndex.ITEMFRAME_ITEM, newItem);
}
public int getRotation() {
@ -36,7 +35,6 @@ public class ItemFrameWatcher extends FlagWatcher {
}
public void setRotation(int rotation) {
setData(MetaIndex.ITEMFRAME_ROTATION, rotation % 4);
sendData(MetaIndex.ITEMFRAME_ROTATION);
sendData(MetaIndex.ITEMFRAME_ROTATION, rotation % 4);
}
}

View File

@ -126,8 +126,7 @@ public class LivingWatcher extends FlagWatcher {
optional = Optional.empty();
}
setData(MetaIndex.LIVING_BED_POSITION, optional);
sendData(MetaIndex.LIVING_BED_POSITION);
sendData(MetaIndex.LIVING_BED_POSITION, optional);
}
public float getHealth() {
@ -135,8 +134,7 @@ public class LivingWatcher extends FlagWatcher {
}
public void setHealth(float health) {
setData(MetaIndex.LIVING_HEALTH, health);
sendData(MetaIndex.LIVING_HEALTH);
sendData(MetaIndex.LIVING_HEALTH, health);
}
/*@NmsAddedIn(val = NmsVersion.v1_13)
@ -158,12 +156,12 @@ public class LivingWatcher extends FlagWatcher {
modifiedLivingAnimations[byteValue] = true;
if (flag) {
setData(MetaIndex.LIVING_META, (byte) (b0 | 1 << byteValue));
b0 = (byte) (b0 | 1 << byteValue);
} else {
setData(MetaIndex.LIVING_META, (byte) (b0 & ~(1 << byteValue)));
b0 = (byte) (b0 & ~(1 << byteValue));
}
sendData(MetaIndex.LIVING_META);
sendData(MetaIndex.LIVING_META, b0);
}
private boolean isMainHandUsed() {
@ -244,8 +242,7 @@ public class LivingWatcher extends FlagWatcher {
}
public void setPotionParticlesAmbient(boolean particles) {
setData(MetaIndex.LIVING_POTION_AMBIENT, particles);
sendData(MetaIndex.LIVING_POTION_AMBIENT);
sendData(MetaIndex.LIVING_POTION_AMBIENT, particles);
}
public Color getParticlesColor() {
@ -256,8 +253,7 @@ public class LivingWatcher extends FlagWatcher {
public void setParticlesColor(Color color) {
potionEffects.clear();
setData(MetaIndex.LIVING_POTIONS, color.asRGB());
sendData(MetaIndex.LIVING_POTIONS);
sendData(MetaIndex.LIVING_POTIONS, color.asRGB());
}
private int getPotions() {
@ -329,8 +325,7 @@ public class LivingWatcher extends FlagWatcher {
}
private void sendPotionEffects() {
setData(MetaIndex.LIVING_POTIONS, getPotions());
sendData(MetaIndex.LIVING_POTIONS);
sendData(MetaIndex.LIVING_POTIONS, getPotions());
}
public int getArrowsSticking() {
@ -339,8 +334,7 @@ public class LivingWatcher extends FlagWatcher {
@MethodOnlyUsedBy(value = {DisguiseType.PLAYER})
public void setArrowsSticking(int arrowsNo) {
setData(MetaIndex.LIVING_ARROWS, Math.max(0, Math.min(127, arrowsNo)));
sendData(MetaIndex.LIVING_ARROWS);
sendData(MetaIndex.LIVING_ARROWS, Math.max(0, Math.min(127, arrowsNo)));
}
@Override

View File

@ -17,8 +17,7 @@ public class LlamaWatcher extends ChestedHorseWatcher {
}
public void setColor(Llama.Color color) {
setData(MetaIndex.LLAMA_COLOR, color);
sendData(MetaIndex.LLAMA_COLOR);
sendData(MetaIndex.LLAMA_COLOR, color);
}
public DyeColor getCarpet() {
@ -30,8 +29,7 @@ public class LlamaWatcher extends ChestedHorseWatcher {
}
public void setCarpet(DyeColor dyeColor) {
setData(MetaIndex.LLAMA_CARPET, dyeColor == null ? -1 : (int) dyeColor.getWoolData());
sendData(MetaIndex.LLAMA_CARPET);
sendData(MetaIndex.LLAMA_CARPET, dyeColor == null ? -1 : (int) dyeColor.getWoolData());
}
@Deprecated
@ -44,7 +42,6 @@ public class LlamaWatcher extends ChestedHorseWatcher {
}
public void setStrength(int strength) {
setData(MetaIndex.LLAMA_STRENGTH, strength);
sendData(MetaIndex.LLAMA_STRENGTH);
sendData(MetaIndex.LLAMA_STRENGTH, strength);
}
}

View File

@ -2,9 +2,6 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
/**
* Created by libraryaddict on 6/08/2018.
*/
public class MinecartCommandWatcher extends MinecartWatcher {
public MinecartCommandWatcher(Disguise disguise) {
super(disguise);

View File

@ -3,9 +3,6 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
/**
* Created by libraryaddict on 6/08/2018.
*/
public class MinecartFurnaceWatcher extends MinecartWatcher {
public MinecartFurnaceWatcher(Disguise disguise) {
super(disguise);
@ -16,7 +13,6 @@ public class MinecartFurnaceWatcher extends MinecartWatcher {
}
public void setFueled(boolean fueled) {
setData(MetaIndex.MINECART_FURANCE_FUELED, fueled);
sendData(MetaIndex.MINECART_FURANCE_FUELED);
sendData(MetaIndex.MINECART_FURANCE_FUELED, fueled);
}
}

View File

@ -71,8 +71,7 @@ public class MinecartWatcher extends FlagWatcher {
}
public void setBlockOffset(int i) {
setData(MetaIndex.MINECART_BLOCK_Y, i);
sendData(MetaIndex.MINECART_BLOCK_Y);
sendData(MetaIndex.MINECART_BLOCK_Y, i);
}
public boolean isViewBlockInCart() {
@ -80,7 +79,6 @@ public class MinecartWatcher extends FlagWatcher {
}
public void setViewBlockInCart(boolean viewBlock) {
setData(MetaIndex.MINECART_BLOCK_VISIBLE, viewBlock);
sendData(MetaIndex.MINECART_BLOCK_VISIBLE);
sendData(MetaIndex.MINECART_BLOCK_VISIBLE, viewBlock);
}
}

View File

@ -3,9 +3,6 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
/**
* Created by libraryaddict on 13/04/2020.
*/
public class ModdedWatcher extends FlagWatcher {
public ModdedWatcher(Disguise disguise) {
super(disguise);

View File

@ -9,9 +9,6 @@ import org.bukkit.entity.MushroomCow;
import java.util.Locale;
/**
* Created by libraryaddict on 6/05/2019.
*/
public class MushroomCowWatcher extends AgeableWatcher {
public MushroomCowWatcher(Disguise disguise) {
super(disguise);
@ -24,7 +21,6 @@ public class MushroomCowWatcher extends AgeableWatcher {
@NmsAddedIn(NmsVersion.v1_14)
public void setVariant(MushroomCow.Variant variant) {
setData(MetaIndex.MUSHROOM_COW_TYPE, ReflectionManager.enumName(variant).toLowerCase(Locale.ENGLISH));
sendData(MetaIndex.MUSHROOM_COW_TYPE);
sendData(MetaIndex.MUSHROOM_COW_TYPE, ReflectionManager.enumName(variant).toLowerCase(Locale.ENGLISH));
}
}

View File

@ -23,8 +23,7 @@ public class OcelotWatcher extends AgeableWatcher {
@NmsAddedIn(NmsVersion.v1_14)
public void setTrusting(boolean trusting) {
setData(MetaIndex.OCELOT_TRUST, trusting);
sendData(MetaIndex.OCELOT_TRUST);
sendData(MetaIndex.OCELOT_TRUST, trusting);
}
@NmsRemovedIn(NmsVersion.v1_14)
@ -36,8 +35,7 @@ public class OcelotWatcher extends AgeableWatcher {
@NmsRemovedIn(NmsVersion.v1_14)
@Deprecated
public void setType(Ocelot.Type newType) {
setData(MetaIndex.OCELOT_TYPE, newType);
sendData(MetaIndex.OCELOT_TYPE);
sendData(MetaIndex.OCELOT_TYPE, newType);
}
@NmsRemovedIn(NmsVersion.v1_14)
@ -47,8 +45,7 @@ public class OcelotWatcher extends AgeableWatcher {
@NmsRemovedIn(NmsVersion.v1_14)
public void setOwner(UUID owner) {
setData(MetaIndex.TAMEABLE_OWNER, Optional.of(owner));
sendData(MetaIndex.TAMEABLE_OWNER);
sendData(MetaIndex.TAMEABLE_OWNER, Optional.of(owner));
}
@NmsRemovedIn(NmsVersion.v1_14)
@ -81,11 +78,11 @@ public class OcelotWatcher extends AgeableWatcher {
byte value = getData(MetaIndex.TAMEABLE_META);
if (flag) {
setData(MetaIndex.TAMEABLE_META, (byte) (value | no));
value = (byte) (value | no);
} else {
setData(MetaIndex.TAMEABLE_META, (byte) (value & -(no + 1)));
value = (byte) (value & -(no + 1));
}
sendData(MetaIndex.TAMEABLE_META);
sendData(MetaIndex.TAMEABLE_META, value);
}
}

View File

@ -24,8 +24,7 @@ public class OminousItemSpawnerWatcher extends FlagWatcher {
@MethodDescription("What item is displayed?")
public void setItemStack(ItemStack item) {
setData(MetaIndex.OMINOUS_ITEM_SPAWNER_ITEM, item);
sendData(MetaIndex.OMINOUS_ITEM_SPAWNER_ITEM);
sendData(MetaIndex.OMINOUS_ITEM_SPAWNER_ITEM, item);
if (!getDisguise().isCustomDisguiseName()) {
getDisguise().setDisguiseName(TranslateType.DISGUISES.get(DisguiseType.OMINOUS_ITEM_SPAWNER.toReadable()) + " " +

View File

@ -32,8 +32,7 @@ public class PaintingWatcher extends FlagWatcher {
public void setArt(Art newPainting) {
if (NmsVersion.v1_19_R1.isSupported()) {
setData(MetaIndex.PAINTING, newPainting);
sendData(MetaIndex.PAINTING);
sendData(MetaIndex.PAINTING, newPainting);
} else {
this.painting = newPainting;

View File

@ -10,18 +10,14 @@ import me.libraryaddict.disguise.utilities.reflection.annotations.MethodOnlyUsed
import me.libraryaddict.disguise.utilities.reflection.annotations.NmsAddedIn;
import org.bukkit.entity.Panda;
/**
* Created by libraryaddict on 6/05/2019.
*/
@NmsAddedIn(NmsVersion.v1_14)
public class PandaWatcher extends AgeableWatcher {
public PandaWatcher(Disguise disguise) {
super(disguise);
if (DisguiseConfig.isRandomDisguises()) {
// We don't do 'setGene' here so it's just as random as it would be as if it was natural.
setMainGene(ReflectionManager.randomEnum(Panda.Gene.class));
setHiddenGene(ReflectionManager.randomEnum(Panda.Gene.class));
// We don't do 'setGene' to only change the visible gene, so it's just as random as it would be as if it was natural.
setGenes(ReflectionManager.randomEnum(Panda.Gene.class), ReflectionManager.randomEnum(Panda.Gene.class));
}
}
@ -35,14 +31,20 @@ public class PandaWatcher extends AgeableWatcher {
setHiddenGene(gene);
}
public void setGenes(Panda.Gene mainGene, Panda.Gene hiddenGene) {
setData(MetaIndex.PANDA_MAIN_GENE, mainGene);
setData(MetaIndex.PANDA_HIDDEN_GENE, hiddenGene);
sendData(MetaIndex.PANDA_MAIN_GENE, MetaIndex.PANDA_HIDDEN_GENE);
}
public Panda.Gene getMainGene() {
return getData(MetaIndex.PANDA_MAIN_GENE);
}
@MethodOnlyUsedBy(value = {}) // Hide from command
public void setMainGene(Panda.Gene gene) {
setData(MetaIndex.PANDA_MAIN_GENE, gene);
sendData(MetaIndex.PANDA_MAIN_GENE);
sendData(MetaIndex.PANDA_MAIN_GENE, gene);
}
public Panda.Gene getHiddenGene() {
@ -51,8 +53,7 @@ public class PandaWatcher extends AgeableWatcher {
@MethodOnlyUsedBy(value = {}) // Hide from command
public void setHiddenGene(Panda.Gene gene) {
setData(MetaIndex.PANDA_HIDDEN_GENE, gene);
sendData(MetaIndex.PANDA_HIDDEN_GENE);
sendData(MetaIndex.PANDA_HIDDEN_GENE, gene);
}
public boolean isSneeze() {
@ -92,8 +93,7 @@ public class PandaWatcher extends AgeableWatcher {
}
public void setHeadShaking(int timeInTicks) {
setData(MetaIndex.PANDA_HEAD_SHAKING, timeInTicks);
sendData(MetaIndex.PANDA_HEAD_SHAKING);
sendData(MetaIndex.PANDA_HEAD_SHAKING, timeInTicks);
}
@Deprecated
@ -114,7 +114,6 @@ public class PandaWatcher extends AgeableWatcher {
b1 = (byte) (b1 & ~no);
}
setData(MetaIndex.PANDA_META, b1);
sendData(MetaIndex.PANDA_META);
sendData(MetaIndex.PANDA_META, b1);
}
}

View File

@ -4,9 +4,6 @@ import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import org.bukkit.entity.Parrot;
/**
* Created by libraryaddict on 9/06/2017.
*/
public class ParrotWatcher extends TameableWatcher {
public ParrotWatcher(Disguise disguise) {
super(disguise);
@ -17,7 +14,6 @@ public class ParrotWatcher extends TameableWatcher {
}
public void setVariant(Parrot.Variant variant) {
setData(MetaIndex.PARROT_VARIANT, variant);
sendData(MetaIndex.PARROT_VARIANT);
sendData(MetaIndex.PARROT_VARIANT, variant);
}
}

View File

@ -3,9 +3,6 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
/**
* Created by libraryaddict on 6/08/2018.
*/
public class PhantomWatcher extends InsentientWatcher {
public PhantomWatcher(Disguise disguise) {
super(disguise);
@ -16,7 +13,6 @@ public class PhantomWatcher extends InsentientWatcher {
}
public void setSize(int size) {
setData(MetaIndex.PHANTOM_SIZE, Math.min(Math.max(size, -50), 50));
sendData(MetaIndex.PHANTOM_SIZE);
sendData(MetaIndex.PHANTOM_SIZE, Math.min(Math.max(size, -50), 50));
}
}

View File

@ -14,7 +14,6 @@ public class PigWatcher extends AgeableWatcher {
}
public void setSaddled(boolean isSaddled) {
setData(MetaIndex.PIG_SADDLED, isSaddled);
sendData(MetaIndex.PIG_SADDLED);
sendData(MetaIndex.PIG_SADDLED, isSaddled);
}
}

Some files were not shown because too many files have changed in this diff Show More