2016-05-12 13:30:22 +02:00
|
|
|
package me.libraryaddict.disguise;
|
|
|
|
|
2016-11-30 18:38:43 +01:00
|
|
|
import java.io.File;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map.Entry;
|
|
|
|
|
2017-06-19 11:23:02 +02:00
|
|
|
import me.libraryaddict.disguise.utilities.TranslateType;
|
2016-11-30 18:38:43 +01:00
|
|
|
import org.bukkit.Bukkit;
|
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;
|
2016-05-12 13:30:22 +02:00
|
|
|
|
2016-11-30 18:38:43 +01:00
|
|
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
|
|
|
import me.libraryaddict.disguise.utilities.DisguiseParser;
|
|
|
|
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguiseParseException;
|
2016-05-12 13:30:22 +02:00
|
|
|
import me.libraryaddict.disguise.utilities.PacketsManager;
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public class DisguiseConfig {
|
2017-02-23 13:42:13 +01:00
|
|
|
public static enum DisguisePushing { // This enum has a really bad name..
|
2017-06-22 13:58:48 +02:00
|
|
|
MODIFY_SCOREBOARD,
|
|
|
|
IGNORE_SCOREBOARD,
|
|
|
|
CREATE_SCOREBOARD;
|
2016-12-21 04:25:28 +01:00
|
|
|
}
|
2016-05-12 13:30:22 +02:00
|
|
|
|
|
|
|
private static boolean animationEnabled;
|
|
|
|
private static boolean bedEnabled;
|
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;
|
2017-06-19 19:06:35 +02:00
|
|
|
private static HashMap<String, Disguise> 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;
|
2016-11-30 18:56:11 +01:00
|
|
|
|
|
|
|
public static Entry<String, Disguise> getCustomDisguise(String disguise) {
|
|
|
|
for (Entry<String, Disguise> entry : customDisguises.entrySet()) {
|
2017-06-19 19:06:35 +02:00
|
|
|
if (!entry.getKey().equalsIgnoreCase(disguise) && !entry.getKey().replaceAll("_", "")
|
|
|
|
.equalsIgnoreCase(disguise))
|
2016-11-30 18:56:11 +01:00
|
|
|
continue;
|
|
|
|
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
TranslateType.reloadTranslations();
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-11-30 18:56:11 +01:00
|
|
|
public static HashMap<String, Disguise> getCustomDisguises() {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
public static void initConfig(ConfigurationSection config) {
|
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 13:58:48 +02:00
|
|
|
setDisguiseBlownWhenAttacking(config.getBoolean("BlowDisguises", config.getBoolean("BlowDisguisesWhenAttacking")));
|
|
|
|
setDisguiseBlownWhenAttacked(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"));
|
|
|
|
setBedPacketsEnabled(config.getBoolean("PacketsEnabled.Bed"));
|
|
|
|
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"));
|
|
|
|
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"));
|
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) {
|
2017-06-19 19:06:35 +02:00
|
|
|
System.out.println("[LibsDisguises] Cannot parse '" + config
|
|
|
|
.getString("SelfDisguisesScoreboard") + "' to a valid option for SelfDisguisesTeam");
|
2016-12-21 04:25:28 +01:00
|
|
|
}
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (String key : section.getKeys(false)) {
|
|
|
|
String toParse = section.getString(key);
|
|
|
|
|
|
|
|
if (getCustomDisguise(toParse) != null) {
|
2017-03-26 14:40:51 +02:00
|
|
|
System.err.println(
|
|
|
|
"[LibsDisguises] Cannot create the custom disguise '" + key + "' as there is a name conflict!");
|
2016-11-30 18:38:43 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2017-06-19 19:06:35 +02:00
|
|
|
Disguise disguise = DisguiseParser
|
|
|
|
.parseDisguise(Bukkit.getConsoleSender(), "disguise", toParse.split(" "),
|
|
|
|
DisguiseParser.getPermissions(Bukkit.getConsoleSender(), "disguise"));
|
2016-11-30 18:38:43 +01:00
|
|
|
|
|
|
|
customDisguises.put(key, disguise);
|
|
|
|
|
|
|
|
System.out.println("[LibsDisguises] Loaded custom disguise " + key);
|
|
|
|
}
|
|
|
|
catch (DisguiseParseException e) {
|
2017-03-26 14:40:51 +02:00
|
|
|
System.err.println(
|
2017-05-28 00:23:15 +02:00
|
|
|
"[LibsDisguises] Error while loading custom disguise '" + key + "'" + (e.getMessage() == null ?
|
|
|
|
"" : ": " + e.getMessage()));
|
2016-11-30 18:38:43 +01:00
|
|
|
|
|
|
|
if (e.getMessage() == null)
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-26 14:40:51 +02:00
|
|
|
System.out.println(
|
2017-05-28 00:23:15 +02:00
|
|
|
"[LibsDisguises] Loaded " + customDisguises.size() + " custom disguise" + (customDisguises.size() == 1 ?
|
|
|
|
"" : "s"));
|
2016-11-30 18:38:43 +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 isBedPacketsEnabled() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return bedEnabled;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Is the plugin modifying the inventory packets so that players when self disguised, do not see their armor floating around
|
|
|
|
*/
|
2016-11-30 05:08:12 +01:00
|
|
|
public static boolean isHidingArmorFromSelf() {
|
2016-05-12 13:30:22 +02:00
|
|
|
return hidingArmor;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Does the plugin appear to remove the item they are holding, to prevent a floating sword when they are viewing self disguise
|
|
|
|
*/
|
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 setBedPacketsEnabled(boolean enabled) {
|
|
|
|
if (enabled != isBedPacketsEnabled()) {
|
2016-05-12 13:30:22 +02:00
|
|
|
bedEnabled = 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
|
|
|
/**
|
|
|
|
* Does the plugin appear to remove the item they are holding, to prevent a floating sword when they are viewing self disguise
|
|
|
|
*/
|
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;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
private DisguiseConfig() {
|
2016-05-12 13:30:22 +02:00
|
|
|
}
|
|
|
|
}
|