2014-01-20 18:01:49 +01:00
|
|
|
package me.libraryaddict.disguise;
|
|
|
|
|
|
|
|
import me.libraryaddict.disguise.utilities.PacketsManager;
|
2014-06-04 02:42:13 +02:00
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.configuration.ConfigurationSection;
|
2014-01-20 18:01:49 +01:00
|
|
|
|
|
|
|
public class DisguiseConfig {
|
2014-05-22 22:14:46 +02:00
|
|
|
private static boolean animationEnabled;
|
|
|
|
private static boolean bedEnabled;
|
2014-01-20 18:01:49 +01:00
|
|
|
private static boolean blowDisguisesOnAttack;
|
2014-05-22 22:14:46 +02:00
|
|
|
private static boolean collectEnabled;
|
2014-06-04 04:43:58 +02:00
|
|
|
private static boolean colorizeSheep;
|
|
|
|
private static boolean colorizeWolf;
|
2014-01-21 02:05:32 +01:00
|
|
|
private static String disguiseBlownMessage;
|
2014-06-01 18:14:35 +02:00
|
|
|
private static int disguiseCloneExpire;
|
|
|
|
private static int disguiseEntityExpire;
|
2014-05-22 22:14:46 +02:00
|
|
|
private static boolean enquipmentEnabled;
|
2014-01-20 18:01:49 +01:00
|
|
|
private static boolean entityAnimationsAdded;
|
2014-05-22 22:14:46 +02:00
|
|
|
private static boolean entityStatusEnabled;
|
2014-01-20 18:01:49 +01:00
|
|
|
private static boolean hearSelfDisguise;
|
|
|
|
private static boolean hidingArmor;
|
|
|
|
private static boolean hidingHeldItem;
|
2014-04-02 15:39:52 +02:00
|
|
|
private static boolean keepDisguiseEntityDespawn;
|
|
|
|
private static boolean keepDisguisePlayerDeath;
|
|
|
|
private static boolean keepDisguisePlayerLogout;
|
2014-06-02 00:03:59 +02:00
|
|
|
private static int maxClonedDisguises;
|
2014-05-23 04:52:21 +02:00
|
|
|
private static boolean maxHealthIsDisguisedEntity;
|
2014-05-22 22:14:46 +02:00
|
|
|
private static boolean miscDisguisesForLivingEnabled;
|
2014-01-20 18:01:49 +01:00
|
|
|
private static boolean modifyBoundingBox;
|
2014-05-22 22:14:46 +02:00
|
|
|
private static boolean movementEnabled;
|
|
|
|
private static boolean ridingEnabled;
|
2014-05-23 03:58:21 +02:00
|
|
|
private static boolean sendsEntityMetadata;
|
2014-01-20 18:01:49 +01:00
|
|
|
private static boolean sendVelocity;
|
|
|
|
private static boolean showNameAboveHead;
|
|
|
|
private static boolean showNameAboveHeadAlwaysVisible;
|
|
|
|
private static boolean targetDisguises;
|
2014-06-14 10:27:48 +02:00
|
|
|
private static boolean undisguiseSwitchWorlds;
|
2014-05-22 22:14:46 +02:00
|
|
|
private static boolean witherSkullEnabled;
|
2014-01-20 18:01:49 +01:00
|
|
|
|
2014-01-21 02:05:32 +01:00
|
|
|
public static String getDisguiseBlownMessage() {
|
|
|
|
return disguiseBlownMessage;
|
|
|
|
}
|
|
|
|
|
2014-06-01 18:14:35 +02:00
|
|
|
public static int getDisguiseCloneExpire() {
|
|
|
|
return disguiseCloneExpire;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static int getDisguiseEntityExpire() {
|
|
|
|
return disguiseEntityExpire;
|
|
|
|
}
|
|
|
|
|
2014-06-02 00:03:59 +02:00
|
|
|
public static int getMaxClonedDisguises() {
|
|
|
|
return maxClonedDisguises;
|
|
|
|
}
|
|
|
|
|
2014-06-04 02:47:52 +02:00
|
|
|
public static void initConfig(ConfigurationSection config) {
|
|
|
|
setSoundsEnabled(config.getBoolean("DisguiseSounds"));
|
|
|
|
setVelocitySent(config.getBoolean("SendVelocity"));
|
|
|
|
setViewDisguises(config.getBoolean("ViewSelfDisguises"));
|
|
|
|
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"));
|
|
|
|
setDisguiseBlownOnAttack(config.getBoolean("BlowDisguises"));
|
2014-06-04 03:58:16 +02:00
|
|
|
setDisguiseBlownMessage(ChatColor.translateAlternateColorCodes('&', config.getString("BlownDisguiseMessage")));
|
2014-06-04 02:47:52 +02:00
|
|
|
setKeepDisguiseOnPlayerDeath(config.getBoolean("KeepDisguises.PlayerDeath"));
|
|
|
|
setKeepDisguiseOnPlayerLogout(config.getBoolean("KeepDisguises.PlayerLogout"));
|
|
|
|
setKeepDisguiseOnEntityDespawn(config.getBoolean("KeepDisguises.EntityDespawn"));
|
|
|
|
setMiscDisguisesForLivingEnabled(config.getBoolean("MiscDisguisesForLiving"));
|
|
|
|
setMovementPacketsEnabled(config.getBoolean("PacketsEnabled.Movement"));
|
|
|
|
setWitherSkullPacketsEnabled(config.getBoolean("PacketsEnabled.WitherSkull"));
|
|
|
|
setEnquipmentPacketsEnabled(config.getBoolean("PacketsEnabled.Enquipment"));
|
|
|
|
setAnimationPacketsEnabled(config.getBoolean("PacketsEnabled.Animation"));
|
|
|
|
setBedPacketsEnabled(config.getBoolean("PacketsEnabled.Bed"));
|
|
|
|
setRidingPacketsEnabled(config.getBoolean("PacketsEnabled.Riding"));
|
|
|
|
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"));
|
2014-06-04 04:43:58 +02:00
|
|
|
setSheepDyeable(config.getBoolean("DyeableSheep"));
|
|
|
|
setWolfDyeable(config.getBoolean("DyeableWolf"));
|
2014-06-14 10:27:48 +02:00
|
|
|
setUndisguiseOnWorldChange(config.getBoolean("UndisguiseOnWorldChange"));
|
2014-06-04 02:47:52 +02:00
|
|
|
}
|
|
|
|
|
2014-05-22 22:14:46 +02:00
|
|
|
public static boolean isAnimationPacketsEnabled() {
|
|
|
|
return animationEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isBedPacketsEnabled() {
|
|
|
|
return bedEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isCollectPacketsEnabled() {
|
|
|
|
return collectEnabled;
|
|
|
|
}
|
|
|
|
|
2014-01-20 18:01:49 +01:00
|
|
|
public static boolean isDisguiseBlownOnAttack() {
|
|
|
|
return blowDisguisesOnAttack;
|
|
|
|
}
|
|
|
|
|
2014-05-22 22:14:46 +02:00
|
|
|
public static boolean isEnquipmentPacketsEnabled() {
|
|
|
|
return enquipmentEnabled;
|
|
|
|
}
|
|
|
|
|
2014-01-20 18:01:49 +01:00
|
|
|
public static boolean isEntityAnimationsAdded() {
|
|
|
|
return entityAnimationsAdded;
|
|
|
|
}
|
|
|
|
|
2014-05-22 22:14:46 +02:00
|
|
|
public static boolean isEntityStatusPacketsEnabled() {
|
|
|
|
return entityStatusEnabled;
|
|
|
|
}
|
|
|
|
|
2014-01-20 18:01:49 +01:00
|
|
|
/**
|
|
|
|
* Is the plugin modifying the inventory packets so that players when self disguised, do not see their armor floating around
|
|
|
|
*/
|
|
|
|
public static boolean isHidingArmorFromSelf() {
|
|
|
|
return hidingArmor;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Does the plugin appear to remove the item they are holding, to prevent a floating sword when they are viewing self disguise
|
|
|
|
*/
|
|
|
|
public static boolean isHidingHeldItemFromSelf() {
|
|
|
|
return hidingHeldItem;
|
|
|
|
}
|
|
|
|
|
2014-04-02 15:39:52 +02:00
|
|
|
public static boolean isKeepDisguiseOnEntityDespawn() {
|
|
|
|
return keepDisguiseEntityDespawn;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isKeepDisguiseOnPlayerDeath() {
|
|
|
|
return keepDisguisePlayerDeath;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isKeepDisguiseOnPlayerLogout() {
|
|
|
|
return keepDisguisePlayerLogout;
|
|
|
|
}
|
|
|
|
|
2014-05-23 04:52:21 +02:00
|
|
|
public static boolean isMaxHealthDeterminedByDisguisedEntity() {
|
|
|
|
return maxHealthIsDisguisedEntity;
|
|
|
|
}
|
|
|
|
|
2014-05-23 03:58:21 +02:00
|
|
|
public static boolean isMetadataPacketsEnabled() {
|
|
|
|
return sendsEntityMetadata;
|
|
|
|
}
|
|
|
|
|
2014-05-22 22:14:46 +02:00
|
|
|
public static boolean isMiscDisguisesForLivingEnabled() {
|
|
|
|
return miscDisguisesForLivingEnabled;
|
|
|
|
}
|
|
|
|
|
2014-01-20 18:01:49 +01:00
|
|
|
public static boolean isModifyBoundingBox() {
|
|
|
|
return modifyBoundingBox;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isMonstersIgnoreDisguises() {
|
|
|
|
return targetDisguises;
|
|
|
|
}
|
|
|
|
|
2014-05-22 22:14:46 +02:00
|
|
|
public static boolean isMovementPacketsEnabled() {
|
|
|
|
return movementEnabled;
|
|
|
|
}
|
|
|
|
|
2014-01-20 18:01:49 +01:00
|
|
|
public static boolean isNameAboveHeadAlwaysVisible() {
|
|
|
|
return showNameAboveHeadAlwaysVisible;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isNameOfPlayerShownAboveDisguise() {
|
|
|
|
return showNameAboveHead;
|
|
|
|
}
|
|
|
|
|
2014-05-22 22:14:46 +02:00
|
|
|
public static boolean isRidingPacketsEnabled() {
|
|
|
|
return ridingEnabled;
|
|
|
|
}
|
|
|
|
|
2014-01-20 18:01:49 +01:00
|
|
|
public static boolean isSelfDisguisesSoundsReplaced() {
|
|
|
|
return hearSelfDisguise;
|
|
|
|
}
|
|
|
|
|
2014-06-04 04:43:58 +02:00
|
|
|
public static boolean isSheepDyeable() {
|
|
|
|
return colorizeSheep;
|
|
|
|
}
|
|
|
|
|
2014-01-20 18:01:49 +01:00
|
|
|
/**
|
|
|
|
* Is the sound packets caught and modified
|
|
|
|
*/
|
|
|
|
public static boolean isSoundEnabled() {
|
|
|
|
return PacketsManager.isHearDisguisesEnabled();
|
|
|
|
}
|
|
|
|
|
2014-06-14 10:27:48 +02:00
|
|
|
public static boolean isUndisguiseOnWorldChange() {
|
|
|
|
return undisguiseSwitchWorlds;
|
|
|
|
}
|
|
|
|
|
2014-01-20 18:01:49 +01:00
|
|
|
/**
|
|
|
|
* Is the velocity packets sent
|
|
|
|
*/
|
|
|
|
public static boolean isVelocitySent() {
|
|
|
|
return sendVelocity;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The default value if a player views his own disguise
|
|
|
|
*/
|
|
|
|
public static boolean isViewDisguises() {
|
|
|
|
return PacketsManager.isViewDisguisesListenerEnabled();
|
|
|
|
}
|
|
|
|
|
2014-05-22 22:14:46 +02:00
|
|
|
public static boolean isWitherSkullPacketsEnabled() {
|
|
|
|
return witherSkullEnabled;
|
|
|
|
}
|
|
|
|
|
2014-06-04 04:43:58 +02:00
|
|
|
public static boolean isWolfDyeable() {
|
|
|
|
return colorizeWolf;
|
|
|
|
}
|
|
|
|
|
2014-01-20 18:01:49 +01:00
|
|
|
public static void setAddEntityAnimations(boolean isEntityAnimationsAdded) {
|
|
|
|
entityAnimationsAdded = isEntityAnimationsAdded;
|
|
|
|
}
|
|
|
|
|
2014-05-22 22:14:46 +02:00
|
|
|
public static void setAnimationPacketsEnabled(boolean enabled) {
|
|
|
|
if (enabled != isAnimationPacketsEnabled()) {
|
|
|
|
animationEnabled = enabled;
|
|
|
|
PacketsManager.setupMainPacketsListener();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setBedPacketsEnabled(boolean enabled) {
|
|
|
|
if (enabled != isBedPacketsEnabled()) {
|
|
|
|
bedEnabled = enabled;
|
|
|
|
PacketsManager.setupMainPacketsListener();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setCollectPacketsEnabled(boolean enabled) {
|
|
|
|
if (enabled != isCollectPacketsEnabled()) {
|
|
|
|
collectEnabled = enabled;
|
|
|
|
PacketsManager.setupMainPacketsListener();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-21 02:05:32 +01:00
|
|
|
public static void setDisguiseBlownMessage(String newMessage) {
|
|
|
|
disguiseBlownMessage = newMessage;
|
|
|
|
}
|
|
|
|
|
2014-01-20 18:01:49 +01:00
|
|
|
public static void setDisguiseBlownOnAttack(boolean blowDisguise) {
|
|
|
|
blowDisguisesOnAttack = blowDisguise;
|
|
|
|
}
|
|
|
|
|
2014-06-01 18:14:35 +02:00
|
|
|
public static void setDisguiseCloneExpire(int newExpires) {
|
|
|
|
disguiseCloneExpire = newExpires;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setDisguiseEntityExpire(int newExpires) {
|
|
|
|
disguiseEntityExpire = newExpires;
|
|
|
|
}
|
|
|
|
|
2014-05-22 22:14:46 +02:00
|
|
|
public static void setEnquipmentPacketsEnabled(boolean enabled) {
|
|
|
|
if (enabled != isEnquipmentPacketsEnabled()) {
|
|
|
|
enquipmentEnabled = enabled;
|
|
|
|
PacketsManager.setupMainPacketsListener();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setEntityStatusPacketsEnabled(boolean enabled) {
|
|
|
|
if (enabled != isEntityStatusPacketsEnabled()) {
|
|
|
|
entityStatusEnabled = enabled;
|
|
|
|
PacketsManager.setupMainPacketsListener();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-20 18:01:49 +01:00
|
|
|
/**
|
|
|
|
* Can players hear their own disguises
|
|
|
|
*/
|
|
|
|
public static void setHearSelfDisguise(boolean replaceSound) {
|
|
|
|
if (hearSelfDisguise != replaceSound) {
|
|
|
|
hearSelfDisguise = replaceSound;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the plugin to hide self disguises armor from theirselves
|
|
|
|
*/
|
|
|
|
public static void setHideArmorFromSelf(boolean hideArmor) {
|
|
|
|
if (hidingArmor != hideArmor) {
|
|
|
|
hidingArmor = hideArmor;
|
|
|
|
PacketsManager.setInventoryListenerEnabled(isHidingHeldItemFromSelf() || isHidingArmorFromSelf());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Does the plugin appear to remove the item they are holding, to prevent a floating sword when they are viewing self disguise
|
|
|
|
*/
|
|
|
|
public static void setHideHeldItemFromSelf(boolean hideHelditem) {
|
|
|
|
if (hidingHeldItem != hideHelditem) {
|
|
|
|
hidingHeldItem = hideHelditem;
|
|
|
|
PacketsManager.setInventoryListenerEnabled(isHidingHeldItemFromSelf() || isHidingArmorFromSelf());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-02 15:39:52 +02:00
|
|
|
public static void setKeepDisguiseOnEntityDespawn(boolean keepDisguise) {
|
|
|
|
keepDisguiseEntityDespawn = keepDisguise;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setKeepDisguiseOnPlayerDeath(boolean keepDisguise) {
|
|
|
|
keepDisguisePlayerDeath = keepDisguise;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setKeepDisguiseOnPlayerLogout(boolean keepDisguise) {
|
|
|
|
keepDisguisePlayerLogout = keepDisguise;
|
|
|
|
}
|
|
|
|
|
2014-06-02 00:03:59 +02:00
|
|
|
public static void setMaxClonedDisguises(int newMax) {
|
|
|
|
maxClonedDisguises = newMax;
|
|
|
|
}
|
|
|
|
|
2014-05-23 04:52:21 +02:00
|
|
|
public static void setMaxHealthDeterminedByDisguisedEntity(boolean isDetermined) {
|
|
|
|
maxHealthIsDisguisedEntity = isDetermined;
|
|
|
|
}
|
|
|
|
|
2014-05-23 03:58:21 +02:00
|
|
|
public static void setMetadataPacketsEnabled(boolean enabled) {
|
|
|
|
sendsEntityMetadata = enabled;
|
|
|
|
}
|
|
|
|
|
2014-05-22 22:14:46 +02:00
|
|
|
public static void setMiscDisguisesForLivingEnabled(boolean enabled) {
|
|
|
|
if (enabled != isMiscDisguisesForLivingEnabled()) {
|
|
|
|
miscDisguisesForLivingEnabled = enabled;
|
|
|
|
PacketsManager.setupMainPacketsListener();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-20 18:01:49 +01:00
|
|
|
public static void setModifyBoundingBox(boolean modifyBounding) {
|
|
|
|
modifyBoundingBox = modifyBounding;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setMonstersIgnoreDisguises(boolean ignore) {
|
|
|
|
targetDisguises = ignore;
|
|
|
|
}
|
|
|
|
|
2014-05-22 22:14:46 +02:00
|
|
|
public static void setMovementPacketsEnabled(boolean enabled) {
|
|
|
|
if (enabled != isMovementPacketsEnabled()) {
|
|
|
|
movementEnabled = enabled;
|
|
|
|
PacketsManager.setupMainPacketsListener();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-20 18:01:49 +01:00
|
|
|
public static void setNameAboveHeadAlwaysVisible(boolean alwaysVisible) {
|
|
|
|
showNameAboveHeadAlwaysVisible = alwaysVisible;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setNameOfPlayerShownAboveDisguise(boolean showNames) {
|
|
|
|
showNameAboveHead = showNames;
|
|
|
|
}
|
|
|
|
|
2014-05-22 22:14:46 +02:00
|
|
|
public static void setRidingPacketsEnabled(boolean enabled) {
|
|
|
|
if (enabled != isRidingPacketsEnabled()) {
|
|
|
|
ridingEnabled = enabled;
|
|
|
|
PacketsManager.setupMainPacketsListener();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-04 04:43:58 +02:00
|
|
|
public static void setSheepDyeable(boolean color) {
|
|
|
|
colorizeSheep = color;
|
|
|
|
}
|
|
|
|
|
2014-01-20 18:01:49 +01:00
|
|
|
/**
|
|
|
|
* Set if the disguises play sounds when hurt
|
|
|
|
*/
|
|
|
|
public static void setSoundsEnabled(boolean isSoundsEnabled) {
|
|
|
|
PacketsManager.setHearDisguisesListener(isSoundsEnabled);
|
|
|
|
}
|
|
|
|
|
2014-06-14 10:27:48 +02:00
|
|
|
public static void setUndisguiseOnWorldChange(boolean isUndisguise) {
|
|
|
|
undisguiseSwitchWorlds = isUndisguise;
|
|
|
|
}
|
|
|
|
|
2014-01-20 18:01:49 +01:00
|
|
|
/**
|
|
|
|
* Disable velocity packets being sent for w/e reason. Maybe you want every ounce of performance you can get?
|
|
|
|
*/
|
|
|
|
public static void setVelocitySent(boolean sendVelocityPackets) {
|
|
|
|
sendVelocity = sendVelocityPackets;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setViewDisguises(boolean seeOwnDisguise) {
|
|
|
|
PacketsManager.setViewDisguisesListener(seeOwnDisguise);
|
|
|
|
}
|
|
|
|
|
2014-05-22 22:14:46 +02:00
|
|
|
public static void setWitherSkullPacketsEnabled(boolean enabled) {
|
|
|
|
witherSkullEnabled = enabled;
|
|
|
|
}
|
|
|
|
|
2014-06-04 04:43:58 +02:00
|
|
|
public static void setWolfDyeable(boolean color) {
|
|
|
|
colorizeWolf = color;
|
|
|
|
}
|
|
|
|
|
2014-01-20 18:01:49 +01:00
|
|
|
private DisguiseConfig() {
|
|
|
|
}
|
|
|
|
}
|