Added new config option for blown disguises
This commit is contained in:
@@ -6,7 +6,6 @@ import java.util.Map.Entry;
|
||||
|
||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
@@ -17,12 +16,15 @@ import me.libraryaddict.disguise.utilities.PacketsManager;
|
||||
|
||||
public class DisguiseConfig {
|
||||
public static enum DisguisePushing { // This enum has a really bad name..
|
||||
MODIFY_SCOREBOARD, IGNORE_SCOREBOARD, CREATE_SCOREBOARD;
|
||||
MODIFY_SCOREBOARD,
|
||||
IGNORE_SCOREBOARD,
|
||||
CREATE_SCOREBOARD;
|
||||
}
|
||||
|
||||
private static boolean animationEnabled;
|
||||
private static boolean bedEnabled;
|
||||
private static boolean blowDisguisesOnAttack;
|
||||
private static boolean blowDisguisesWhenAttacking;
|
||||
private static boolean blowDisguisesWhenAttacked;
|
||||
private static boolean collectEnabled;
|
||||
private static boolean colorizeSheep;
|
||||
private static boolean colorizeWolf;
|
||||
@@ -154,7 +156,8 @@ public class DisguiseConfig {
|
||||
setNameAboveHeadAlwaysVisible(config.getBoolean("NameAboveHeadAlwaysVisible"));
|
||||
setModifyBoundingBox(config.getBoolean("ModifyBoundingBox"));
|
||||
setMonstersIgnoreDisguises(config.getBoolean("MonstersIgnoreDisguises"));
|
||||
setDisguiseBlownOnAttack(config.getBoolean("BlowDisguises"));
|
||||
setDisguiseBlownWhenAttacking(config.getBoolean("BlowDisguises", config.getBoolean("BlowDisguisesWhenAttacking")));
|
||||
setDisguiseBlownWhenAttacked(config.getBoolean("BlowDisguisesWhenAttacked"));
|
||||
setKeepDisguiseOnPlayerDeath(config.getBoolean("KeepDisguises.PlayerDeath"));
|
||||
setMiscDisguisesForLivingEnabled(config.getBoolean("MiscDisguisesForLiving"));
|
||||
setMovementPacketsEnabled(config.getBoolean("PacketsEnabled.Movement"));
|
||||
@@ -264,8 +267,12 @@ public class DisguiseConfig {
|
||||
return disableInvisibility;
|
||||
}
|
||||
|
||||
public static boolean isDisguiseBlownOnAttack() {
|
||||
return blowDisguisesOnAttack;
|
||||
public static boolean isDisguiseBlownWhenAttacking() {
|
||||
return blowDisguisesWhenAttacking;
|
||||
}
|
||||
|
||||
public static boolean isDisguiseBlownWhenAttacked() {
|
||||
return blowDisguisesWhenAttacked;
|
||||
}
|
||||
|
||||
public static boolean isEntityAnimationsAdded() {
|
||||
@@ -419,8 +426,12 @@ public class DisguiseConfig {
|
||||
disableInvisibility = disableInvis;
|
||||
}
|
||||
|
||||
public static void setDisguiseBlownOnAttack(boolean blowDisguise) {
|
||||
blowDisguisesOnAttack = blowDisguise;
|
||||
public static void setDisguiseBlownWhenAttacking(boolean blowDisguise) {
|
||||
blowDisguisesWhenAttacking = blowDisguise;
|
||||
}
|
||||
|
||||
public static void setDisguiseBlownWhenAttacked(boolean blowDisguise) {
|
||||
blowDisguisesWhenAttacked = blowDisguise;
|
||||
}
|
||||
|
||||
public static void setDisguiseCloneExpire(int newExpires) {
|
||||
|
@@ -132,16 +132,16 @@ public class DisguiseListener implements Listener {
|
||||
updaterTask.cancel();
|
||||
}
|
||||
|
||||
private void checkPlayerCanBlowDisguise(Player entity) {
|
||||
Disguise[] disguises = DisguiseAPI.getDisguises(entity);
|
||||
private void checkPlayerCanBlowDisguise(Player player) {
|
||||
Disguise[] disguises = DisguiseAPI.getDisguises(player);
|
||||
|
||||
if (disguises.length > 0) {
|
||||
DisguiseAPI.undisguiseToAll(entity);
|
||||
DisguiseAPI.undisguiseToAll(player);
|
||||
|
||||
String blown = LibsMsg.BLOWN_DISGUISE.get();
|
||||
|
||||
if (blown.length() > 0) {
|
||||
entity.sendMessage(blown);
|
||||
player.sendMessage(blown);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,14 +195,12 @@ public class DisguiseListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onAttack(EntityDamageByEntityEvent event) {
|
||||
if (DisguiseConfig.isDisguiseBlownOnAttack()) {
|
||||
if (event.getEntity() instanceof Player) {
|
||||
checkPlayerCanBlowDisguise((Player) event.getEntity());
|
||||
}
|
||||
if (DisguiseConfig.isDisguiseBlownWhenAttacked() && event.getEntity() instanceof Player) {
|
||||
checkPlayerCanBlowDisguise((Player) event.getEntity());
|
||||
}
|
||||
|
||||
if (event.getDamager() instanceof Player) {
|
||||
checkPlayerCanBlowDisguise((Player) event.getDamager());
|
||||
}
|
||||
if (DisguiseConfig.isDisguiseBlownWhenAttacking() && event.getDamager() instanceof Player) {
|
||||
checkPlayerCanBlowDisguise((Player) event.getDamager());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,7 @@ import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import org.bukkit.Art;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@@ -758,23 +759,23 @@ public class DisguiseParser {
|
||||
}
|
||||
|
||||
value = items;
|
||||
} else if (param.getSimpleName().equals("Color")) {
|
||||
} else if (param == Horse.Color.class) {
|
||||
// Parse to horse color
|
||||
value = callValueOf(param, valueString, methodName);
|
||||
} else if (param.getSimpleName().equals("Style")) {
|
||||
} else if (param == Horse.Style.class) {
|
||||
// Parse to horse style
|
||||
value = callValueOf(param, valueString, methodName);
|
||||
} else if (param.getSimpleName().equals("Profession")) {
|
||||
} else if (param == Villager.Profession.class) {
|
||||
// Parse to villager profession
|
||||
value = callValueOf(param, valueString, methodName);
|
||||
} else if (param.getSimpleName().equals("Art")) {
|
||||
} else if (param == Art.class) {
|
||||
// Parse to art type
|
||||
value = callValueOf(param, valueString, methodName);
|
||||
} else if (param.getSimpleName().equals("Type")) {
|
||||
} else if (param == Ocelot.Type.class) {
|
||||
// Parse to ocelot type
|
||||
value = callValueOf(param, valueString, methodName);
|
||||
} else if (param.getSimpleName().equals("TreeSpecies")) {
|
||||
// Parse to ocelot type
|
||||
// Parse to tree species
|
||||
value = callValueOf(param, valueString, methodName);
|
||||
} else if (param == PotionEffectType.class) {
|
||||
// Parse to potion effect
|
||||
|
Reference in New Issue
Block a user