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;
|
|
|
|
import me.libraryaddict.disguise.utilities.PacketsManager;
|
|
|
|
import me.libraryaddict.disguise.utilities.TranslateType;
|
|
|
|
import me.libraryaddict.disguise.utilities.parser.DisguiseParseException;
|
|
|
|
import me.libraryaddict.disguise.utilities.parser.DisguiseParser;
|
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
|
|
|
|
2018-05-18 05:27:05 +02:00
|
|
|
import java.io.File;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map.Entry;
|
2016-05-12 13:30:22 +02:00
|
|
|
|
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;
|
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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
|
|
|
public static Entry<String, Disguise> getCustomDisguise(String disguise) {
|
|
|
|
for (Entry<String, Disguise> entry : customDisguises.entrySet()) {
|
2018-05-18 05:27:05 +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;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
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"));
|
|
|
|
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"));
|
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");
|
|
|
|
setExplicitDisguisePermissions(config.getBoolean("Permissions.ExplictDisguises"));
|
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
|
|
|
}
|
|
|
|
|
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-08-14 02:42:35 +02:00
|
|
|
DisguiseUtilities.getLogger().info("Cannot parse '" + config.getString("SelfDisguisesScoreboard") +
|
2018-05-18 05:27:05 +02:00
|
|
|
"' to a valid option for SelfDisguisesTeam");
|
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();
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
if (getCustomDisguise(toParse) != null) {
|
2018-08-14 02:42:35 +02:00
|
|
|
DisguiseUtilities.getLogger()
|
|
|
|
.severe("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
|
2018-10-25 15:03:00 +02:00
|
|
|
.parseDisguise(Bukkit.getConsoleSender(), "disguise", DisguiseUtilities.split(toParse),
|
2017-06-19 19:06:35 +02:00
|
|
|
DisguiseParser.getPermissions(Bukkit.getConsoleSender(), "disguise"));
|
2016-11-30 18:38:43 +01:00
|
|
|
|
|
|
|
customDisguises.put(key, disguise);
|
|
|
|
|
2018-08-14 02:42:35 +02:00
|
|
|
DisguiseUtilities.getLogger().info("Loaded custom disguise " + key);
|
2016-11-30 18:38:43 +01:00
|
|
|
}
|
|
|
|
catch (DisguiseParseException e) {
|
2018-08-14 02:42:35 +02:00
|
|
|
DisguiseUtilities.getLogger().severe("Error while loading custom disguise '" + key + "'" +
|
2018-05-18 05:27:05 +02:00
|
|
|
(e.getMessage() == null ? "" : ": " + e.getMessage()));
|
2016-11-30 18:38:43 +01:00
|
|
|
|
|
|
|
if (e.getMessage() == null)
|
|
|
|
e.printStackTrace();
|
2018-08-14 02:42:35 +02:00
|
|
|
|
|
|
|
failedCustomDisguises++;
|
2016-11-30 18:38:43 +01:00
|
|
|
}
|
|
|
|
catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
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
|
|
|
/**
|
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 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
|
|
|
/**
|
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;
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:08:12 +01:00
|
|
|
private DisguiseConfig() {
|
2016-05-12 13:30:22 +02:00
|
|
|
}
|
|
|
|
}
|