2016-05-12 13:30:22 +02:00
|
|
|
package me.libraryaddict.disguise;
|
|
|
|
|
2018-05-18 05:27:05 +02:00
|
|
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
2018-09-07 04:35:38 +02:00
|
|
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
|
|
|
import me.libraryaddict.disguise.utilities.LibsPremium;
|
2019-01-03 03:13:03 +01:00
|
|
|
import me.libraryaddict.disguise.utilities.packets.PacketsManager;
|
2018-09-07 04:35:38 +02:00
|
|
|
import me.libraryaddict.disguise.utilities.parser.DisguiseParseException;
|
|
|
|
import me.libraryaddict.disguise.utilities.parser.DisguiseParser;
|
2019-03-05 05:46:47 +01:00
|
|
|
import me.libraryaddict.disguise.utilities.parser.DisguisePerm;
|
2020-01-02 05:10:36 +01:00
|
|
|
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
2019-02-03 02:02:59 +01:00
|
|
|
import me.libraryaddict.disguise.utilities.translations.TranslateType;
|
2020-01-02 05:10:36 +01:00
|
|
|
import org.apache.logging.log4j.core.util.IOUtils;
|
2016-11-30 18:38:43 +01:00
|
|
|
import org.bukkit.Bukkit;
|
2019-04-16 22:10:15 +02:00
|
|
|
import org.bukkit.command.CommandSender;
|
2016-05-12 13:30:22 +02:00
|
|
|
import org.bukkit.configuration.ConfigurationSection;
|
2016-11-30 18:38:43 +01:00
|
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
2020-01-02 05:10:36 +01:00
|
|
|
import org.bukkit.craftbukkit.libs.org.apache.commons.io.FileUtils;
|
2019-04-16 22:10:15 +02:00
|
|
|
import org.bukkit.entity.Entity;
|
2020-01-02 05:10:36 +01:00
|
|
|
import org.bukkit.util.FileUtil;
|
2016-05-12 13:30:22 +02:00
|
|
|
|
2018-05-18 05:27:05 +02:00
|
|
|
import java.io.File;
|
2020-01-02 05:10:36 +01:00
|
|
|
import java.io.IOException;
|
2019-04-16 22:10:15 +02:00
|
|
|
import java.lang.reflect.InvocationTargetException;
|
2018-05-18 05:27:05 +02:00
|
|
|
import java.util.HashMap;
|
2019-12-28 01:10:52 +01:00
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.Map;
|
2018-05-18 05:27:05 +02:00
|
|
|
import java.util.Map.Entry;
|
2019-12-28 01:10:52 +01:00
|
|
|
import java.util.Random;
|
2016-05-12 13:30:22 +02:00
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public class DisguiseConfig {
|
2019-05-18 08:54:51 +02:00
|
|
|
public enum DisguisePushing { // This enum has a really bad name..
|
2017-06-22 13:58:48 +02:00
|
|
|
MODIFY_SCOREBOARD,
|
|
|
|
IGNORE_SCOREBOARD,
|
2019-05-18 08:54:51 +02:00
|
|
|
CREATE_SCOREBOARD
|
2016-12-21 04:25:28 +01:00
|
|
|
}
|
2016-05-12 13:30:22 +02:00
|
|
|
|
2018-12-16 02:47:42 +01:00
|
|
|
public enum UpdatesBranch {
|
|
|
|
SAME_BUILDS,
|
|
|
|
SNAPSHOTS,
|
|
|
|
RELEASES
|
|
|
|
}
|
|
|
|
|
2016-05-12 13:30:22 +02:00
|
|
|
private static boolean animationEnabled;
|
2017-06-22 13:58:48 +02:00
|
|
|
private static boolean blowDisguisesWhenAttacking;
|
|
|
|
private static boolean blowDisguisesWhenAttacked;
|
2016-05-12 13:30:22 +02:00
|
|
|
private static boolean collectEnabled;
|
|
|
|
private static boolean colorizeSheep;
|
|
|
|
private static boolean colorizeWolf;
|
2019-11-14 02:42:32 +01:00
|
|
|
private static boolean colorizeCat;
|
2019-11-14 03:25:26 +01:00
|
|
|
private static boolean saddleableHorse;
|
|
|
|
private static boolean carpetableLlama;
|
2019-03-05 05:46:47 +01:00
|
|
|
private static HashMap<DisguisePerm, String> customDisguises = new HashMap<>();
|
2016-11-30 18:56:11 +01:00
|
|
|
private static boolean disableInvisibility;
|
2016-05-12 13:30:22 +02:00
|
|
|
private static int disguiseCloneExpire;
|
|
|
|
private static int disguiseEntityExpire;
|
2016-11-30 05:08:37 +01:00
|
|
|
private static boolean displayPlayerDisguisesInTab;
|
2016-05-12 13:30:22 +02:00
|
|
|
private static boolean entityAnimationsAdded;
|
|
|
|
private static boolean entityStatusEnabled;
|
|
|
|
private static boolean equipmentEnabled;
|
|
|
|
private static boolean hearSelfDisguise;
|
2016-11-30 05:08:37 +01:00
|
|
|
private static boolean hideDisguisedPlayers;
|
2016-05-12 13:30:22 +02:00
|
|
|
private static boolean hidingArmor;
|
|
|
|
private static boolean hidingHeldItem;
|
|
|
|
private static boolean keepDisguisePlayerDeath;
|
|
|
|
private static int maxClonedDisguises;
|
|
|
|
private static boolean maxHealthIsDisguisedEntity;
|
|
|
|
private static boolean miscDisguisesForLivingEnabled;
|
|
|
|
private static boolean modifyBoundingBox;
|
|
|
|
private static boolean movementEnabled;
|
|
|
|
private static boolean sendsEntityMetadata;
|
|
|
|
private static boolean sendVelocity;
|
|
|
|
private static boolean showNameAboveHead;
|
|
|
|
private static boolean showNameAboveHeadAlwaysVisible;
|
2016-11-30 05:08:37 +01:00
|
|
|
private static boolean stopShulkerDisguisesFromMoving;
|
2016-05-12 13:30:22 +02:00
|
|
|
private static boolean targetDisguises;
|
|
|
|
private static boolean undisguiseSwitchWorlds;
|
|
|
|
private static String updateNotificationPermission;
|
2016-11-30 05:08:37 +01:00
|
|
|
private static boolean viewSelfDisguise;
|
2016-05-12 13:30:22 +02:00
|
|
|
private static boolean witherSkullEnabled;
|
2017-03-26 14:40:51 +02:00
|
|
|
private static DisguisePushing disablePushing = DisguisePushing.MODIFY_SCOREBOARD;
|
2017-05-28 00:23:15 +02:00
|
|
|
private static boolean saveCache;
|
|
|
|
private static boolean updatePlayerCache;
|
|
|
|
private static boolean savePlayerDisguises;
|
|
|
|
private static boolean saveEntityDisguises;
|
2017-06-19 11:23:02 +02:00
|
|
|
private static boolean useTranslations;
|
2018-05-18 05:27:05 +02:00
|
|
|
private static boolean modifyCollisions;
|
2018-08-24 00:01:01 +02:00
|
|
|
private static boolean disableFriendlyInvisibles;
|
|
|
|
private static boolean warnScoreboardConflict;
|
2018-11-08 09:04:18 +01:00
|
|
|
private static boolean explicitDisguisePermissions;
|
|
|
|
private static boolean disableCommands;
|
2018-11-08 09:09:47 +01:00
|
|
|
private static int uuidGeneratedVersion;
|
2018-12-16 02:47:42 +01:00
|
|
|
private static UpdatesBranch updatesBranch = UpdatesBranch.SAME_BUILDS;
|
2019-02-03 02:02:59 +01:00
|
|
|
private static int playerDisguisesTablistExpires;
|
2019-03-06 03:16:14 +01:00
|
|
|
private static boolean dynamicExpiry;
|
2019-11-26 21:13:12 +01:00
|
|
|
private static boolean playerHideArmor;
|
2020-01-20 01:35:55 +01:00
|
|
|
private static boolean extendedDisguisesNames;
|
|
|
|
|
|
|
|
public static boolean isExtendedDisguiseNames() {
|
|
|
|
return extendedDisguisesNames;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setExtendedDisguiseNames(boolean extendedDisguiseNames) {
|
|
|
|
extendedDisguisesNames = extendedDisguiseNames;
|
|
|
|
}
|
2019-11-26 21:13:12 +01:00
|
|
|
|
|
|
|
public static boolean isPlayerHideArmor() {
|
|
|
|
return playerHideArmor;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setPlayerHideArmor(boolean playerHiddenArmor) {
|
|
|
|
playerHideArmor = playerHiddenArmor;
|
|
|
|
}
|
2019-03-06 03:16:14 +01:00
|
|
|
|
|
|
|
public static boolean isDynamicExpiry() {
|
|
|
|
return dynamicExpiry;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setDynamicExpiry(boolean setDynamicExpiry) {
|
|
|
|
dynamicExpiry = setDynamicExpiry;
|
|
|
|
}
|
2019-02-03 02:02:59 +01:00
|
|
|
|
|
|
|
public static int getPlayerDisguisesTablistExpires() {
|
|
|
|
return playerDisguisesTablistExpires;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setPlayerDisguisesTablistExpires(int playerDisguisesTablistExpiresTicks) {
|
|
|
|
playerDisguisesTablistExpires = playerDisguisesTablistExpiresTicks;
|
|
|
|
}
|
2018-12-16 02:47:42 +01:00
|
|
|
|
|
|
|
public static UpdatesBranch getUpdatesBranch() {
|
|
|
|
return updatesBranch;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setUpdatesBranch(UpdatesBranch newBranch) {
|
|
|
|
updatesBranch = newBranch;
|
|
|
|
}
|
2018-11-08 09:09:47 +01:00
|
|
|
|
|
|
|
public static int getUUIDGeneratedVersion() {
|
|
|
|
return uuidGeneratedVersion;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setUUIDGeneratedVersion(int uuidVersion) {
|
|
|
|
uuidGeneratedVersion = uuidVersion;
|
|
|
|
}
|
2018-11-08 09:04:18 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* No setter provided as this cannot be changed after startup
|
|
|
|
*/
|
|
|
|
public static boolean isDisableCommands() {
|
|
|
|
return disableCommands;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isExplicitDisguisePermissions() {
|
|
|
|
return explicitDisguisePermissions;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setExplicitDisguisePermissions(boolean explictDisguisePermission) {
|
|
|
|
explicitDisguisePermissions = explictDisguisePermission;
|
|
|
|
}
|
2016-11-30 18:56:11 +01:00
|
|
|
|
2019-05-16 08:07:53 +02:00
|
|
|
public static Entry<DisguisePerm, Disguise> getCustomDisguise(String disguise) {
|
|
|
|
Entry<DisguisePerm, String> entry = getRawCustomDisguise(disguise);
|
|
|
|
|
|
|
|
if (entry == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
return new HashMap.SimpleEntry(entry.getKey(), DisguiseParser.parseDisguise(entry.getValue()));
|
|
|
|
}
|
|
|
|
catch (IllegalAccessException | InvocationTargetException | DisguiseParseException e) {
|
|
|
|
DisguiseUtilities.getLogger().warning("Error when attempting to grab the custom disguise " + disguise);
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
2019-04-16 22:10:15 +02:00
|
|
|
|
2019-05-16 08:07:53 +02:00
|
|
|
return null;
|
2019-04-16 22:10:15 +02:00
|
|
|
}
|
|
|
|
|
2019-05-16 08:07:53 +02:00
|
|
|
public static Entry<DisguisePerm, Disguise> getCustomDisguise(Entity target,
|
2019-04-16 22:10:15 +02:00
|
|
|
String disguise) throws IllegalAccessException, DisguiseParseException, InvocationTargetException {
|
2019-05-16 08:07:53 +02:00
|
|
|
Entry<DisguisePerm, String> entry = getRawCustomDisguise(disguise);
|
|
|
|
|
|
|
|
if (entry == null) {
|
|
|
|
return null;
|
|
|
|
}
|
2019-04-16 22:10:15 +02:00
|
|
|
|
|
|
|
return new HashMap.SimpleEntry(entry.getKey(),
|
|
|
|
DisguiseParser.parseDisguise(Bukkit.getConsoleSender(), target, entry.getValue()));
|
|
|
|
}
|
|
|
|
|
2019-05-16 08:07:53 +02:00
|
|
|
public static Entry<DisguisePerm, Disguise> getCustomDisguise(CommandSender invoker, Entity target,
|
2019-04-16 22:10:15 +02:00
|
|
|
String disguise) throws IllegalAccessException, DisguiseParseException, InvocationTargetException {
|
2019-05-16 08:07:53 +02:00
|
|
|
Entry<DisguisePerm, String> entry = getRawCustomDisguise(disguise);
|
|
|
|
|
|
|
|
if (entry == null) {
|
|
|
|
return null;
|
|
|
|
}
|
2019-04-16 22:10:15 +02:00
|
|
|
|
|
|
|
return new HashMap.SimpleEntry(entry.getKey(), DisguiseParser.parseDisguise(invoker, target, entry.getValue()));
|
|
|
|
}
|
|
|
|
|
2020-01-02 05:10:36 +01:00
|
|
|
public static void removeCustomDisguise(String disguise) {
|
|
|
|
for (DisguisePerm entry : customDisguises.keySet()) {
|
|
|
|
String name = entry.toReadable();
|
|
|
|
|
|
|
|
if (!name.equalsIgnoreCase(disguise) && !name.replaceAll("_", "").equalsIgnoreCase(disguise))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
customDisguises.remove(entry);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-16 08:07:53 +02:00
|
|
|
public static Entry<DisguisePerm, String> getRawCustomDisguise(String disguise) {
|
2019-03-05 05:46:47 +01:00
|
|
|
for (Entry<DisguisePerm, String> entry : customDisguises.entrySet()) {
|
|
|
|
String name = entry.getKey().toReadable();
|
|
|
|
|
|
|
|
if (!name.equalsIgnoreCase(disguise) && !name.replaceAll("_", "").equalsIgnoreCase(disguise))
|
2016-11-30 18:56:11 +01:00
|
|
|
continue;
|
|
|
|
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2018-08-24 00:01:01 +02:00
|
|
|
public static boolean isWarnScoreboardConflict() {
|
|
|
|
return warnScoreboardConflict;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setWarnScoreboardConflict(boolean warnConflict) {
|
|
|
|
warnScoreboardConflict = warnConflict;
|
|
|
|
}
|
|
|
|
|
2018-05-18 05:27:05 +02:00
|
|
|
public static boolean isModifyCollisions() {
|
|
|
|
return modifyCollisions;
|
|
|
|
}
|
|
|
|
|
2018-08-24 00:01:01 +02:00
|
|
|
public static boolean isDisableFriendlyInvisibles() {
|
|
|
|
return disableFriendlyInvisibles;
|
2018-05-18 05:27:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void setModifyCollisions(boolean isModifyCollisions) {
|
|
|
|
modifyCollisions = isModifyCollisions;
|
|
|
|
}
|
|
|
|
|
2018-08-24 00:01:01 +02:00
|
|
|
public static void setDisableFriendlyInvisibles(boolean isDisableFriendlyInvisibles) {
|
|
|
|
disableFriendlyInvisibles = isDisableFriendlyInvisibles;
|
2018-05-18 05:27:05 +02:00
|
|
|
}
|
|
|
|
|
2017-05-28 00:23:15 +02:00
|
|
|
public static boolean isSavePlayerDisguises() {
|
|
|
|
return savePlayerDisguises;
|
|
|
|
}
|
|
|
|
|
2017-06-19 11:23:02 +02:00
|
|
|
public static boolean isUseTranslations() {
|
|
|
|
return useTranslations;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setUseTranslations(boolean setUseTranslations) {
|
|
|
|
useTranslations = setUseTranslations;
|
|
|
|
|
2018-07-11 20:05:36 +02:00
|
|
|
TranslateType.refreshTranslations();
|
2017-06-19 11:23:02 +02:00
|
|
|
}
|
|
|
|
|
2017-05-28 00:23:15 +02:00
|
|
|
public static boolean isSaveEntityDisguises() {
|
|
|
|
return saveEntityDisguises;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setSavePlayerDisguises(boolean saveDisguises) {
|
|
|
|
savePlayerDisguises = saveDisguises;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setSaveEntityDisguises(boolean saveDisguises) {
|
|
|
|
saveEntityDisguises = saveDisguises;
|
|
|
|
}
|
|
|
|
|
2016-12-21 04:25:28 +01:00
|
|
|
public static DisguisePushing getPushingOption() {
|
2016-12-15 21:23:44 +01:00
|
|
|
return disablePushing;
|
|
|
|
}
|
|
|
|
|
2019-03-05 05:46:47 +01:00
|
|
|
public static HashMap<DisguisePerm, String> getCustomDisguises() {
|
2016-11-30 18:56:11 +01:00
|
|
|
return customDisguises;
|
|
|
|
}
|
2016-11-30 05:08:12 +01:00
|
|
|
|
|
|
|
public static int getDisguiseCloneExpire() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return disguiseCloneExpire;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static int getDisguiseEntityExpire() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return disguiseEntityExpire;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static int getMaxClonedDisguises() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return maxClonedDisguises;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static String getUpdateNotificationPermission() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return updateNotificationPermission;
|
|
|
|
}
|
|
|
|
|
2017-06-02 15:51:03 +02:00
|
|
|
public static boolean isSaveGameProfiles() {
|
2017-05-28 00:23:15 +02:00
|
|
|
return saveCache;
|
|
|
|
}
|
|
|
|
|
2017-06-02 15:51:03 +02:00
|
|
|
public static void setSaveGameProfiles(boolean doCache) {
|
2017-05-28 00:23:15 +02:00
|
|
|
saveCache = doCache;
|
|
|
|
}
|
|
|
|
|
2017-06-02 15:51:03 +02:00
|
|
|
public static boolean isUpdateGameProfiles() {
|
2017-05-28 00:23:15 +02:00
|
|
|
return updatePlayerCache;
|
|
|
|
}
|
|
|
|
|
2017-06-02 15:51:03 +02:00
|
|
|
public static void setUpdateGameProfiles(boolean setUpdatePlayerCache) {
|
2017-05-28 00:23:15 +02:00
|
|
|
updatePlayerCache = setUpdatePlayerCache;
|
|
|
|
}
|
|
|
|
|
2018-08-24 00:01:01 +02:00
|
|
|
public static void loadConfig() {
|
|
|
|
// Always save the default config
|
|
|
|
LibsDisguises.getInstance().saveDefaultConfig();
|
|
|
|
// Redundant for the first load, however other plugins may call loadConfig() at a later stage where we
|
|
|
|
// definitely want to reload it.
|
|
|
|
LibsDisguises.getInstance().reloadConfig();
|
|
|
|
|
2020-01-02 05:10:36 +01:00
|
|
|
File skinsFolder = new File(LibsDisguises.getInstance().getDataFolder(), "Skins");
|
|
|
|
|
|
|
|
if (!skinsFolder.exists()) {
|
|
|
|
skinsFolder.mkdir();
|
|
|
|
|
|
|
|
File explain = new File(skinsFolder, "README");
|
|
|
|
|
|
|
|
try {
|
|
|
|
explain.createNewFile();
|
|
|
|
FileUtils.write(explain,
|
|
|
|
"This folder is used to store .png files for uploading with the /savedisguise or /grabskin " +
|
|
|
|
"commands");
|
|
|
|
}
|
|
|
|
catch (IOException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-24 00:01:01 +02:00
|
|
|
ConfigurationSection config = LibsDisguises.getInstance().getConfig();
|
|
|
|
|
2016-05-12 13:30:22 +02:00
|
|
|
setSoundsEnabled(config.getBoolean("DisguiseSounds"));
|
|
|
|
setVelocitySent(config.getBoolean("SendVelocity"));
|
2017-03-26 14:40:51 +02:00
|
|
|
setViewDisguises(
|
|
|
|
config.getBoolean("ViewSelfDisguises")); // Since we can now toggle, the view disguises listener must
|
|
|
|
// always be on
|
2016-05-12 13:30:22 +02:00
|
|
|
PacketsManager.setViewDisguisesListener(true);
|
|
|
|
setHearSelfDisguise(config.getBoolean("HearSelfDisguise"));
|
|
|
|
setHideArmorFromSelf(config.getBoolean("RemoveArmor"));
|
|
|
|
setHideHeldItemFromSelf(config.getBoolean("RemoveHeldItem"));
|
|
|
|
setAddEntityAnimations(config.getBoolean("AddEntityAnimations"));
|
|
|
|
setNameOfPlayerShownAboveDisguise(config.getBoolean("ShowNamesAboveDisguises"));
|
|
|
|
setNameAboveHeadAlwaysVisible(config.getBoolean("NameAboveHeadAlwaysVisible"));
|
|
|
|
setModifyBoundingBox(config.getBoolean("ModifyBoundingBox"));
|
|
|
|
setMonstersIgnoreDisguises(config.getBoolean("MonstersIgnoreDisguises"));
|
2017-06-22 18:14:19 +02:00
|
|
|
setDisguiseBlownWhenAttacking(
|
|
|
|
config.getBoolean("BlowDisguises", config.getBoolean("BlowDisguisesWhenAttacking")));
|
2017-06-22 18:21:52 +02:00
|
|
|
setDisguiseBlownWhenAttacked(
|
|
|
|
config.getBoolean("BlowDisguises", config.getBoolean("BlowDisguisesWhenAttacked")));
|
2016-05-12 13:30:22 +02:00
|
|
|
setKeepDisguiseOnPlayerDeath(config.getBoolean("KeepDisguises.PlayerDeath"));
|
|
|
|
setMiscDisguisesForLivingEnabled(config.getBoolean("MiscDisguisesForLiving"));
|
|
|
|
setMovementPacketsEnabled(config.getBoolean("PacketsEnabled.Movement"));
|
|
|
|
setWitherSkullPacketsEnabled(config.getBoolean("PacketsEnabled.WitherSkull"));
|
|
|
|
setEquipmentPacketsEnabled(config.getBoolean("PacketsEnabled.Equipment"));
|
|
|
|
setAnimationPacketsEnabled(config.getBoolean("PacketsEnabled.Animation"));
|
|
|
|
setEntityStatusPacketsEnabled(config.getBoolean("PacketsEnabled.EntityStatus"));
|
|
|
|
setCollectPacketsEnabled(config.getBoolean("PacketsEnabled.Collect"));
|
|
|
|
setMetadataPacketsEnabled(config.getBoolean("PacketsEnabled.Metadata"));
|
|
|
|
setMaxHealthDeterminedByDisguisedEntity(config.getBoolean("MaxHealthDeterminedByEntity"));
|
|
|
|
setDisguiseEntityExpire(config.getInt("DisguiseEntityExpire"));
|
|
|
|
setDisguiseCloneExpire(config.getInt("DisguiseCloneExpire"));
|
|
|
|
setMaxClonedDisguises(config.getInt("DisguiseCloneSize"));
|
|
|
|
setSheepDyeable(config.getBoolean("DyeableSheep"));
|
|
|
|
setWolfDyeable(config.getBoolean("DyeableWolf"));
|
2019-11-14 02:42:32 +01:00
|
|
|
setCatDyeable(config.getBoolean("DyeableCat"));
|
2019-11-14 03:25:26 +01:00
|
|
|
setHorseSaddleable(config.getBoolean("SaddleableHorse"));
|
|
|
|
setLlamaCarpetable(config.getBoolean("CarpetableLlama"));
|
2016-05-12 13:30:22 +02:00
|
|
|
setUndisguiseOnWorldChange(config.getBoolean("UndisguiseOnWorldChange"));
|
|
|
|
setUpdateNotificationPermission(config.getString("Permission"));
|
|
|
|
setStopShulkerDisguisesFromMoving(config.getBoolean("StopShulkerDisguisesFromMoving", true));
|
2016-11-30 05:08:12 +01:00
|
|
|
setHideDisguisedPlayers(config.getBoolean("HideDisguisedPlayersFromTab"));
|
|
|
|
setShowDisguisedPlayersInTab(config.getBoolean("ShowPlayerDisguisesInTab"));
|
2016-11-30 18:56:11 +01:00
|
|
|
setDisabledInvisibility(config.getBoolean("DisableInvisibility"));
|
2017-06-02 15:51:03 +02:00
|
|
|
setSaveGameProfiles(config.getBoolean("SaveGameProfiles"));
|
|
|
|
setUpdateGameProfiles(config.getBoolean("UpdateGameProfiles"));
|
2017-05-28 00:23:15 +02:00
|
|
|
setSavePlayerDisguises(config.getBoolean("SaveDisguises.Players"));
|
2017-06-02 15:51:03 +02:00
|
|
|
setSaveEntityDisguises(config.getBoolean("SaveDisguises.Entities"));
|
2017-06-19 11:23:02 +02:00
|
|
|
setUseTranslations(config.getBoolean("Translations"));
|
2018-05-18 05:27:05 +02:00
|
|
|
setModifyCollisions(config.getBoolean("Scoreboard.Collisions"));
|
2018-08-24 00:01:01 +02:00
|
|
|
setDisableFriendlyInvisibles(config.getBoolean("Scoreboard.DisableFriendlyInvisibles"));
|
|
|
|
setWarnScoreboardConflict(config.getBoolean("Scoreboard.WarnConflict"));
|
2018-11-08 09:04:18 +01:00
|
|
|
disableCommands = config.getBoolean("DisableCommands");
|
2019-01-27 05:18:00 +01:00
|
|
|
setExplicitDisguisePermissions(config.getBoolean("Permissions.ExplicitDisguises"));
|
2018-11-08 09:09:47 +01:00
|
|
|
setUUIDGeneratedVersion(config.getInt("UUIDVersion"));
|
2019-02-03 02:02:59 +01:00
|
|
|
setPlayerDisguisesTablistExpires(config.getInt("PlayerDisguisesTablistExpires"));
|
2019-03-06 03:16:14 +01:00
|
|
|
setDynamicExpiry(config.getBoolean("DynamicExpiry"));
|
2019-11-26 21:13:12 +01:00
|
|
|
setPlayerHideArmor(config.getBoolean("PlayerHideArmor"));
|
2020-01-20 01:35:55 +01:00
|
|
|
setExtendedDisguiseNames(config.getBoolean("ExtendedNames"));
|
2016-12-21 04:25:28 +01:00
|
|
|
|
2017-06-22 18:14:19 +02:00
|
|
|
if (!LibsPremium.isPremium() && (isSavePlayerDisguises() || isSaveEntityDisguises())) {
|
2018-08-14 02:42:35 +02:00
|
|
|
DisguiseUtilities.getLogger().warning("You must purchase the plugin to use saved disguises!");
|
2017-06-22 18:14:19 +02:00
|
|
|
}
|
|
|
|
|
2018-12-16 02:47:42 +01:00
|
|
|
try {
|
|
|
|
setUpdatesBranch(UpdatesBranch.valueOf(config.getString("UpdatesBranch").toUpperCase()));
|
|
|
|
}
|
|
|
|
catch (Exception ex) {
|
2019-02-03 02:02:59 +01:00
|
|
|
DisguiseUtilities.getLogger().warning(
|
|
|
|
"Cannot parse '" + config.getString("UpdatesBranch") + "' to a valid option for UpdatesBranch");
|
2018-12-16 02:47:42 +01:00
|
|
|
}
|
|
|
|
|
2016-12-21 04:25:28 +01:00
|
|
|
try {
|
2017-06-19 19:06:35 +02:00
|
|
|
String option = config.getString("SelfDisguisesScoreboard", DisguisePushing.MODIFY_SCOREBOARD.name())
|
|
|
|
.toUpperCase();
|
2017-02-23 13:28:37 +01:00
|
|
|
|
|
|
|
if (!option.endsWith("_SCOREBOARD"))
|
|
|
|
option += "_SCOREBOARD";
|
|
|
|
|
|
|
|
disablePushing = DisguisePushing.valueOf(option);
|
2016-12-21 04:25:28 +01:00
|
|
|
}
|
|
|
|
catch (Exception ex) {
|
2018-12-16 02:47:42 +01:00
|
|
|
DisguiseUtilities.getLogger().warning("Cannot parse '" + config.getString("SelfDisguisesScoreboard") +
|
2019-03-12 06:29:39 +01:00
|
|
|
"' to a valid option for SelfDisguisesScoreboard");
|
2016-12-21 04:25:28 +01:00
|
|
|
}
|
2016-11-30 18:38:43 +01:00
|
|
|
|
2018-08-14 02:42:35 +02:00
|
|
|
loadCustomDisguises();
|
|
|
|
|
2019-12-28 01:10:52 +01:00
|
|
|
// Another wee trap for the non-legit
|
2020-01-22 06:46:57 +01:00
|
|
|
if ("%%__USER__%%".equals("12345") && getCustomDisguises().size() > 10) {
|
2019-12-28 01:10:52 +01:00
|
|
|
setSoundsEnabled(false);
|
|
|
|
|
|
|
|
// Lets remove randomly half the custom disguises hey
|
|
|
|
Iterator<Entry<DisguisePerm, String>> itel = getCustomDisguises().entrySet().iterator();
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
while (itel.hasNext()) {
|
|
|
|
itel.next();
|
|
|
|
|
|
|
|
if (new Random().nextBoolean()) {
|
|
|
|
itel.remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-14 02:42:35 +02:00
|
|
|
int missingConfigs = 0;
|
|
|
|
|
|
|
|
for (String key : config.getDefaultSection().getKeys(true)) {
|
|
|
|
if (config.contains(key, true)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
missingConfigs++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (missingConfigs > 0) {
|
|
|
|
DisguiseUtilities.getLogger().warning(
|
|
|
|
"Your config is missing " + missingConfigs + " options! Please consider regenerating your config!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void loadCustomDisguises() {
|
2016-11-30 18:38:43 +01:00
|
|
|
customDisguises.clear();
|
|
|
|
|
|
|
|
File disguisesFile = new File("plugins/LibsDisguises/disguises.yml");
|
|
|
|
|
|
|
|
if (!disguisesFile.exists())
|
|
|
|
return;
|
|
|
|
|
|
|
|
YamlConfiguration disguisesConfig = YamlConfiguration.loadConfiguration(disguisesFile);
|
|
|
|
|
|
|
|
ConfigurationSection section = disguisesConfig.getConfigurationSection("Disguises");
|
|
|
|
|
|
|
|
if (section == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-08-14 02:42:35 +02:00
|
|
|
int failedCustomDisguises = 0;
|
|
|
|
|
2016-11-30 18:38:43 +01:00
|
|
|
for (String key : section.getKeys(false)) {
|
|
|
|
String toParse = section.getString(key);
|
|
|
|
|
|
|
|
try {
|
2019-12-28 01:10:52 +01:00
|
|
|
addCustomDisguise(key, toParse);
|
2016-11-30 18:38:43 +01:00
|
|
|
}
|
|
|
|
catch (DisguiseParseException e) {
|
2019-12-28 01:10:52 +01:00
|
|
|
failedCustomDisguises++;
|
2016-11-30 18:38:43 +01:00
|
|
|
|
2019-12-28 01:10:52 +01:00
|
|
|
if (e.getMessage() != null) {
|
|
|
|
DisguiseUtilities.getLogger().severe(e.getMessage());
|
|
|
|
}
|
2018-08-14 02:42:35 +02:00
|
|
|
|
2019-12-28 01:10:52 +01:00
|
|
|
if (e.getCause() != null) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
2016-11-30 18:38:43 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-14 02:42:35 +02:00
|
|
|
if (failedCustomDisguises > 0) {
|
|
|
|
DisguiseUtilities.getLogger().severe("Failed to load " + failedCustomDisguises + " custom disguises");
|
|
|
|
}
|
|
|
|
|
|
|
|
DisguiseUtilities.getLogger().info("Loaded " + customDisguises.size() + " custom disguise" +
|
2018-05-18 05:27:05 +02:00
|
|
|
(customDisguises.size() == 1 ? "" : "s"));
|
2016-11-30 18:38:43 +01:00
|
|
|
}
|
|
|
|
|
2019-12-28 01:10:52 +01:00
|
|
|
public static void addCustomDisguise(String disguiseName, String toParse) throws DisguiseParseException {
|
|
|
|
if (getRawCustomDisguise(toParse) != null) {
|
2020-01-02 05:10:36 +01:00
|
|
|
throw new DisguiseParseException(LibsMsg.CUSTOM_DISGUISE_NAME_CONFLICT, disguiseName);
|
2019-12-28 01:10:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
String[] disguiseArgs = DisguiseUtilities.split(toParse);
|
|
|
|
|
|
|
|
Disguise disguise = DisguiseParser.parseTestDisguise(Bukkit.getConsoleSender(), "disguise", disguiseArgs,
|
|
|
|
DisguiseParser.getPermissions(Bukkit.getConsoleSender(), "disguise"));
|
|
|
|
|
|
|
|
DisguisePerm perm = new DisguisePerm(disguise.getType(), disguiseName);
|
|
|
|
|
|
|
|
customDisguises.put(perm, toParse);
|
|
|
|
|
|
|
|
DisguiseUtilities.getLogger().info("Loaded custom disguise " + disguiseName);
|
|
|
|
}
|
|
|
|
catch (DisguiseParseException e) {
|
2020-01-02 05:10:36 +01:00
|
|
|
throw new DisguiseParseException(LibsMsg.ERROR_LOADING_CUSTOM_DISGUISE, disguiseName,
|
|
|
|
(e.getMessage() == null ? "" : ": " + e.getMessage()));
|
2019-12-28 01:10:52 +01:00
|
|
|
}
|
2020-01-02 05:10:36 +01:00
|
|
|
catch (IllegalAccessException | InvocationTargetException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
throw new DisguiseParseException(LibsMsg.ERROR_LOADING_CUSTOM_DISGUISE, disguiseName, "");
|
2019-12-28 01:10:52 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isAnimationPacketsEnabled() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return animationEnabled;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isCollectPacketsEnabled() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return collectEnabled;
|
|
|
|
}
|
|
|
|
|
2016-11-30 18:56:11 +01:00
|
|
|
public static boolean isDisabledInvisibility() {
|
|
|
|
return disableInvisibility;
|
|
|
|
}
|
|
|
|
|
2017-06-22 13:58:48 +02:00
|
|
|
public static boolean isDisguiseBlownWhenAttacking() {
|
|
|
|
return blowDisguisesWhenAttacking;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isDisguiseBlownWhenAttacked() {
|
|
|
|
return blowDisguisesWhenAttacked;
|
2016-05-12 13:30:22 +02:00
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isEntityAnimationsAdded() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return entityAnimationsAdded;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isEntityStatusPacketsEnabled() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return entityStatusEnabled;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isEquipmentPacketsEnabled() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return equipmentEnabled;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:37 +01:00
|
|
|
public static boolean isHideDisguisedPlayers() {
|
|
|
|
return hideDisguisedPlayers;
|
|
|
|
}
|
|
|
|
|
2016-05-12 13:30:22 +02:00
|
|
|
/**
|
2018-05-18 05:27:05 +02:00
|
|
|
* Is the plugin modifying the inventory packets so that players when self disguised, do not see their armor
|
|
|
|
* floating around
|
2016-05-12 13:30:22 +02:00
|
|
|
*/
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isHidingArmorFromSelf() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return hidingArmor;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-05-18 05:27:05 +02:00
|
|
|
* Does the plugin appear to remove the item they are holding, to prevent a floating sword when they are viewing
|
|
|
|
* self disguise
|
2016-05-12 13:30:22 +02:00
|
|
|
*/
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isHidingHeldItemFromSelf() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return hidingHeldItem;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isKeepDisguiseOnPlayerDeath() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return keepDisguisePlayerDeath;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isMaxHealthDeterminedByDisguisedEntity() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return maxHealthIsDisguisedEntity;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isMetadataPacketsEnabled() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return sendsEntityMetadata;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isMiscDisguisesForLivingEnabled() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return miscDisguisesForLivingEnabled;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isModifyBoundingBox() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return modifyBoundingBox;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isMonstersIgnoreDisguises() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return targetDisguises;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isMovementPacketsEnabled() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return movementEnabled;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isNameAboveHeadAlwaysVisible() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return showNameAboveHeadAlwaysVisible;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isNameOfPlayerShownAboveDisguise() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return showNameAboveHead;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isSelfDisguisesSoundsReplaced() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return hearSelfDisguise;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isSheepDyeable() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return colorizeSheep;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:37 +01:00
|
|
|
public static boolean isShowDisguisedPlayersInTab() {
|
|
|
|
return displayPlayerDisguisesInTab;
|
|
|
|
}
|
|
|
|
|
2016-05-12 13:30:22 +02:00
|
|
|
/**
|
|
|
|
* Is the sound packets caught and modified
|
|
|
|
*/
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isSoundEnabled() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return PacketsManager.isHearDisguisesEnabled();
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:37 +01:00
|
|
|
public static boolean isStopShulkerDisguisesFromMoving() {
|
|
|
|
return stopShulkerDisguisesFromMoving;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isUndisguiseOnWorldChange() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return undisguiseSwitchWorlds;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is the velocity packets sent
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isVelocitySent() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return sendVelocity;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The default value if a player views his own disguise
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isViewDisguises() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return viewSelfDisguise;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isWitherSkullPacketsEnabled() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return witherSkullEnabled;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isWolfDyeable() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return colorizeWolf;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setAddEntityAnimations(boolean isEntityAnimationsAdded) {
|
2016-05-12 13:30:22 +02:00
|
|
|
entityAnimationsAdded = isEntityAnimationsAdded;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setAnimationPacketsEnabled(boolean enabled) {
|
|
|
|
if (enabled != isAnimationPacketsEnabled()) {
|
2016-05-12 13:30:22 +02:00
|
|
|
animationEnabled = enabled;
|
|
|
|
|
|
|
|
PacketsManager.setupMainPacketsListener();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setCollectPacketsEnabled(boolean enabled) {
|
|
|
|
if (enabled != isCollectPacketsEnabled()) {
|
2016-05-12 13:30:22 +02:00
|
|
|
collectEnabled = enabled;
|
|
|
|
|
|
|
|
PacketsManager.setupMainPacketsListener();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-30 18:56:11 +01:00
|
|
|
public static void setDisabledInvisibility(boolean disableInvis) {
|
|
|
|
disableInvisibility = disableInvis;
|
|
|
|
}
|
|
|
|
|
2017-06-22 13:58:48 +02:00
|
|
|
public static void setDisguiseBlownWhenAttacking(boolean blowDisguise) {
|
|
|
|
blowDisguisesWhenAttacking = blowDisguise;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setDisguiseBlownWhenAttacked(boolean blowDisguise) {
|
|
|
|
blowDisguisesWhenAttacked = blowDisguise;
|
2016-05-12 13:30:22 +02:00
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setDisguiseCloneExpire(int newExpires) {
|
2016-05-12 13:30:22 +02:00
|
|
|
disguiseCloneExpire = newExpires;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setDisguiseEntityExpire(int newExpires) {
|
2016-05-12 13:30:22 +02:00
|
|
|
disguiseEntityExpire = newExpires;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setEntityStatusPacketsEnabled(boolean enabled) {
|
|
|
|
if (enabled != isEntityStatusPacketsEnabled()) {
|
2016-05-12 13:30:22 +02:00
|
|
|
entityStatusEnabled = enabled;
|
|
|
|
|
|
|
|
PacketsManager.setupMainPacketsListener();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setEquipmentPacketsEnabled(boolean enabled) {
|
|
|
|
if (enabled != isEquipmentPacketsEnabled()) {
|
2016-05-12 13:30:22 +02:00
|
|
|
equipmentEnabled = enabled;
|
|
|
|
|
|
|
|
PacketsManager.setupMainPacketsListener();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Can players hear their own disguises
|
|
|
|
*/
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setHearSelfDisguise(boolean replaceSound) {
|
|
|
|
if (hearSelfDisguise != replaceSound) {
|
2016-05-12 13:30:22 +02:00
|
|
|
hearSelfDisguise = replaceSound;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the plugin to hide self disguises armor from theirselves
|
|
|
|
*/
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setHideArmorFromSelf(boolean hideArmor) {
|
|
|
|
if (hidingArmor != hideArmor) {
|
2016-05-12 13:30:22 +02:00
|
|
|
hidingArmor = hideArmor;
|
|
|
|
|
|
|
|
PacketsManager.setInventoryListenerEnabled(isHidingHeldItemFromSelf() || isHidingArmorFromSelf());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:37 +01:00
|
|
|
public static void setHideDisguisedPlayers(boolean hideDisguisedPlayersInTab) {
|
|
|
|
hideDisguisedPlayers = hideDisguisedPlayersInTab;
|
|
|
|
}
|
|
|
|
|
2016-05-12 13:30:22 +02:00
|
|
|
/**
|
2018-05-18 05:27:05 +02:00
|
|
|
* Does the plugin appear to remove the item they are holding, to prevent a floating sword when they are viewing
|
|
|
|
* self disguise
|
2016-05-12 13:30:22 +02:00
|
|
|
*/
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setHideHeldItemFromSelf(boolean hideHelditem) {
|
|
|
|
if (hidingHeldItem != hideHelditem) {
|
2016-05-12 13:30:22 +02:00
|
|
|
hidingHeldItem = hideHelditem;
|
|
|
|
|
|
|
|
PacketsManager.setInventoryListenerEnabled(isHidingHeldItemFromSelf() || isHidingArmorFromSelf());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setKeepDisguiseOnPlayerDeath(boolean keepDisguise) {
|
2016-05-12 13:30:22 +02:00
|
|
|
keepDisguisePlayerDeath = keepDisguise;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setMaxClonedDisguises(int newMax) {
|
2016-05-12 13:30:22 +02:00
|
|
|
maxClonedDisguises = newMax;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setMaxHealthDeterminedByDisguisedEntity(boolean isDetermined) {
|
2016-05-12 13:30:22 +02:00
|
|
|
maxHealthIsDisguisedEntity = isDetermined;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setMetadataPacketsEnabled(boolean enabled) {
|
2016-05-12 13:30:22 +02:00
|
|
|
sendsEntityMetadata = enabled;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setMiscDisguisesForLivingEnabled(boolean enabled) {
|
|
|
|
if (enabled != isMiscDisguisesForLivingEnabled()) {
|
2016-05-12 13:30:22 +02:00
|
|
|
miscDisguisesForLivingEnabled = enabled;
|
|
|
|
|
|
|
|
PacketsManager.setupMainPacketsListener();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setModifyBoundingBox(boolean modifyBounding) {
|
2016-05-12 13:30:22 +02:00
|
|
|
modifyBoundingBox = modifyBounding;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setMonstersIgnoreDisguises(boolean ignore) {
|
2016-05-12 13:30:22 +02:00
|
|
|
targetDisguises = ignore;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setMovementPacketsEnabled(boolean enabled) {
|
|
|
|
if (enabled != isMovementPacketsEnabled()) {
|
2016-05-12 13:30:22 +02:00
|
|
|
movementEnabled = enabled;
|
|
|
|
|
|
|
|
PacketsManager.setupMainPacketsListener();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setNameAboveHeadAlwaysVisible(boolean alwaysVisible) {
|
2016-05-12 13:30:22 +02:00
|
|
|
showNameAboveHeadAlwaysVisible = alwaysVisible;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setNameOfPlayerShownAboveDisguise(boolean showNames) {
|
2016-05-12 13:30:22 +02:00
|
|
|
showNameAboveHead = showNames;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setSheepDyeable(boolean color) {
|
2016-05-12 13:30:22 +02:00
|
|
|
colorizeSheep = color;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:37 +01:00
|
|
|
public static void setShowDisguisedPlayersInTab(boolean displayPlayerDisguisesInTablist) {
|
|
|
|
displayPlayerDisguisesInTab = displayPlayerDisguisesInTablist;
|
|
|
|
}
|
|
|
|
|
2016-05-12 13:30:22 +02:00
|
|
|
/**
|
|
|
|
* Set if the disguises play sounds when hurt
|
|
|
|
*/
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setSoundsEnabled(boolean isSoundsEnabled) {
|
2016-05-12 13:30:22 +02:00
|
|
|
PacketsManager.setHearDisguisesListener(isSoundsEnabled);
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:37 +01:00
|
|
|
public static void setStopShulkerDisguisesFromMoving(boolean stopShulkerDisguisesFromMoving) {
|
|
|
|
DisguiseConfig.stopShulkerDisguisesFromMoving = stopShulkerDisguisesFromMoving;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setUndisguiseOnWorldChange(boolean isUndisguise) {
|
2016-05-12 13:30:22 +02:00
|
|
|
undisguiseSwitchWorlds = isUndisguise;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setUpdateNotificationPermission(String newPermission) {
|
2016-05-12 13:30:22 +02:00
|
|
|
updateNotificationPermission = newPermission;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Disable velocity packets being sent for w/e reason. Maybe you want every ounce of performance you can get?
|
|
|
|
*
|
|
|
|
* @param sendVelocityPackets
|
|
|
|
*/
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setVelocitySent(boolean sendVelocityPackets) {
|
2016-05-12 13:30:22 +02:00
|
|
|
sendVelocity = sendVelocityPackets;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setViewDisguises(boolean seeOwnDisguise) {
|
2016-05-12 13:30:22 +02:00
|
|
|
viewSelfDisguise = seeOwnDisguise;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setWitherSkullPacketsEnabled(boolean enabled) {
|
2016-05-12 13:30:22 +02:00
|
|
|
witherSkullEnabled = enabled;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void setWolfDyeable(boolean color) {
|
2016-05-12 13:30:22 +02:00
|
|
|
colorizeWolf = color;
|
|
|
|
}
|
|
|
|
|
2019-11-14 02:42:32 +01:00
|
|
|
public static void setCatDyeable(boolean color) {
|
|
|
|
colorizeCat = color;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isCatDyeable() {
|
|
|
|
return colorizeCat;
|
|
|
|
}
|
|
|
|
|
2019-11-14 03:25:26 +01:00
|
|
|
public static void setHorseSaddleable(boolean saddle) {
|
|
|
|
saddleableHorse = saddle;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isHorseSaddleable() {
|
|
|
|
return saddleableHorse;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setLlamaCarpetable(boolean carpet) {
|
|
|
|
carpetableLlama = carpet;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isLlamaCarpetable() {
|
|
|
|
return carpetableLlama;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
private DisguiseConfig() {
|
2016-05-12 13:30:22 +02:00
|
|
|
}
|
|
|
|
}
|