Added new config option for blown disguises
This commit is contained in:
parent
0546566686
commit
27230d5148
10
config.yml
10
config.yml
@ -106,11 +106,11 @@ ModifyBoundingBox: false
|
|||||||
# They will just ignore you unless provoked.
|
# They will just ignore you unless provoked.
|
||||||
MonstersIgnoreDisguises: false
|
MonstersIgnoreDisguises: false
|
||||||
|
|
||||||
# Sigh. People are going to want this.
|
# This works only for players, disguised monsters and the like will not be undisguised
|
||||||
# So lets make your disguise blown if you are attacked..
|
# Should the player's disguises be removed if he attacks something?
|
||||||
# Works only for disguised players when attacked by a entity (arrow, monster. etc)
|
BlowDisguisesWhenAttacking: false
|
||||||
# This will blow all disguises he has on him
|
# Should the player's disguises be removed if he's attacked by something?
|
||||||
BlowDisguises: false
|
BlowDisguisesWhenAttacked: false
|
||||||
|
|
||||||
#Stop shulker disguises from moving, they're weird. This option only effects PLAYERS that are disguised, other entities disguised as shulkers will NOT be effected!
|
#Stop shulker disguises from moving, they're weird. This option only effects PLAYERS that are disguised, other entities disguised as shulkers will NOT be effected!
|
||||||
StopShulkerDisguisesFromMoving: true
|
StopShulkerDisguisesFromMoving: true
|
||||||
|
@ -6,7 +6,6 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
import me.libraryaddict.disguise.utilities.TranslateType;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
@ -17,12 +16,15 @@ import me.libraryaddict.disguise.utilities.PacketsManager;
|
|||||||
|
|
||||||
public class DisguiseConfig {
|
public class DisguiseConfig {
|
||||||
public static enum DisguisePushing { // This enum has a really bad name..
|
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 animationEnabled;
|
||||||
private static boolean bedEnabled;
|
private static boolean bedEnabled;
|
||||||
private static boolean blowDisguisesOnAttack;
|
private static boolean blowDisguisesWhenAttacking;
|
||||||
|
private static boolean blowDisguisesWhenAttacked;
|
||||||
private static boolean collectEnabled;
|
private static boolean collectEnabled;
|
||||||
private static boolean colorizeSheep;
|
private static boolean colorizeSheep;
|
||||||
private static boolean colorizeWolf;
|
private static boolean colorizeWolf;
|
||||||
@ -154,7 +156,8 @@ public class DisguiseConfig {
|
|||||||
setNameAboveHeadAlwaysVisible(config.getBoolean("NameAboveHeadAlwaysVisible"));
|
setNameAboveHeadAlwaysVisible(config.getBoolean("NameAboveHeadAlwaysVisible"));
|
||||||
setModifyBoundingBox(config.getBoolean("ModifyBoundingBox"));
|
setModifyBoundingBox(config.getBoolean("ModifyBoundingBox"));
|
||||||
setMonstersIgnoreDisguises(config.getBoolean("MonstersIgnoreDisguises"));
|
setMonstersIgnoreDisguises(config.getBoolean("MonstersIgnoreDisguises"));
|
||||||
setDisguiseBlownOnAttack(config.getBoolean("BlowDisguises"));
|
setDisguiseBlownWhenAttacking(config.getBoolean("BlowDisguises", config.getBoolean("BlowDisguisesWhenAttacking")));
|
||||||
|
setDisguiseBlownWhenAttacked(config.getBoolean("BlowDisguisesWhenAttacked"));
|
||||||
setKeepDisguiseOnPlayerDeath(config.getBoolean("KeepDisguises.PlayerDeath"));
|
setKeepDisguiseOnPlayerDeath(config.getBoolean("KeepDisguises.PlayerDeath"));
|
||||||
setMiscDisguisesForLivingEnabled(config.getBoolean("MiscDisguisesForLiving"));
|
setMiscDisguisesForLivingEnabled(config.getBoolean("MiscDisguisesForLiving"));
|
||||||
setMovementPacketsEnabled(config.getBoolean("PacketsEnabled.Movement"));
|
setMovementPacketsEnabled(config.getBoolean("PacketsEnabled.Movement"));
|
||||||
@ -264,8 +267,12 @@ public class DisguiseConfig {
|
|||||||
return disableInvisibility;
|
return disableInvisibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDisguiseBlownOnAttack() {
|
public static boolean isDisguiseBlownWhenAttacking() {
|
||||||
return blowDisguisesOnAttack;
|
return blowDisguisesWhenAttacking;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isDisguiseBlownWhenAttacked() {
|
||||||
|
return blowDisguisesWhenAttacked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEntityAnimationsAdded() {
|
public static boolean isEntityAnimationsAdded() {
|
||||||
@ -419,8 +426,12 @@ public class DisguiseConfig {
|
|||||||
disableInvisibility = disableInvis;
|
disableInvisibility = disableInvis;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDisguiseBlownOnAttack(boolean blowDisguise) {
|
public static void setDisguiseBlownWhenAttacking(boolean blowDisguise) {
|
||||||
blowDisguisesOnAttack = blowDisguise;
|
blowDisguisesWhenAttacking = blowDisguise;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDisguiseBlownWhenAttacked(boolean blowDisguise) {
|
||||||
|
blowDisguisesWhenAttacked = blowDisguise;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDisguiseCloneExpire(int newExpires) {
|
public static void setDisguiseCloneExpire(int newExpires) {
|
||||||
|
@ -132,16 +132,16 @@ public class DisguiseListener implements Listener {
|
|||||||
updaterTask.cancel();
|
updaterTask.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkPlayerCanBlowDisguise(Player entity) {
|
private void checkPlayerCanBlowDisguise(Player player) {
|
||||||
Disguise[] disguises = DisguiseAPI.getDisguises(entity);
|
Disguise[] disguises = DisguiseAPI.getDisguises(player);
|
||||||
|
|
||||||
if (disguises.length > 0) {
|
if (disguises.length > 0) {
|
||||||
DisguiseAPI.undisguiseToAll(entity);
|
DisguiseAPI.undisguiseToAll(player);
|
||||||
|
|
||||||
String blown = LibsMsg.BLOWN_DISGUISE.get();
|
String blown = LibsMsg.BLOWN_DISGUISE.get();
|
||||||
|
|
||||||
if (blown.length() > 0) {
|
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)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void onAttack(EntityDamageByEntityEvent event) {
|
public void onAttack(EntityDamageByEntityEvent event) {
|
||||||
if (DisguiseConfig.isDisguiseBlownOnAttack()) {
|
if (DisguiseConfig.isDisguiseBlownWhenAttacked() && event.getEntity() instanceof Player) {
|
||||||
if (event.getEntity() instanceof Player) {
|
checkPlayerCanBlowDisguise((Player) event.getEntity());
|
||||||
checkPlayerCanBlowDisguise((Player) event.getEntity());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (event.getDamager() instanceof Player) {
|
if (DisguiseConfig.isDisguiseBlownWhenAttacking() && event.getDamager() instanceof Player) {
|
||||||
checkPlayerCanBlowDisguise((Player) event.getDamager());
|
checkPlayerCanBlowDisguise((Player) event.getDamager());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import org.bukkit.Art;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
@ -758,23 +759,23 @@ public class DisguiseParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
value = items;
|
value = items;
|
||||||
} else if (param.getSimpleName().equals("Color")) {
|
} else if (param == Horse.Color.class) {
|
||||||
// Parse to horse color
|
// Parse to horse color
|
||||||
value = callValueOf(param, valueString, methodName);
|
value = callValueOf(param, valueString, methodName);
|
||||||
} else if (param.getSimpleName().equals("Style")) {
|
} else if (param == Horse.Style.class) {
|
||||||
// Parse to horse style
|
// Parse to horse style
|
||||||
value = callValueOf(param, valueString, methodName);
|
value = callValueOf(param, valueString, methodName);
|
||||||
} else if (param.getSimpleName().equals("Profession")) {
|
} else if (param == Villager.Profession.class) {
|
||||||
// Parse to villager profession
|
// Parse to villager profession
|
||||||
value = callValueOf(param, valueString, methodName);
|
value = callValueOf(param, valueString, methodName);
|
||||||
} else if (param.getSimpleName().equals("Art")) {
|
} else if (param == Art.class) {
|
||||||
// Parse to art type
|
// Parse to art type
|
||||||
value = callValueOf(param, valueString, methodName);
|
value = callValueOf(param, valueString, methodName);
|
||||||
} else if (param.getSimpleName().equals("Type")) {
|
} else if (param == Ocelot.Type.class) {
|
||||||
// Parse to ocelot type
|
// Parse to ocelot type
|
||||||
value = callValueOf(param, valueString, methodName);
|
value = callValueOf(param, valueString, methodName);
|
||||||
} else if (param.getSimpleName().equals("TreeSpecies")) {
|
} else if (param.getSimpleName().equals("TreeSpecies")) {
|
||||||
// Parse to ocelot type
|
// Parse to tree species
|
||||||
value = callValueOf(param, valueString, methodName);
|
value = callValueOf(param, valueString, methodName);
|
||||||
} else if (param == PotionEffectType.class) {
|
} else if (param == PotionEffectType.class) {
|
||||||
// Parse to potion effect
|
// Parse to potion effect
|
||||||
|
Loading…
Reference in New Issue
Block a user