Fixed the disguise blown message not being used
This commit is contained in:
parent
ad109b0cda
commit
85077227a2
@ -4,6 +4,7 @@ import me.libraryaddict.disguise.utilities.PacketsManager;
|
|||||||
|
|
||||||
public class DisguiseConfig {
|
public class DisguiseConfig {
|
||||||
private static boolean blowDisguisesOnAttack;
|
private static boolean blowDisguisesOnAttack;
|
||||||
|
private static String disguiseBlownMessage;
|
||||||
private static boolean entityAnimationsAdded;
|
private static boolean entityAnimationsAdded;
|
||||||
private static boolean hearSelfDisguise;
|
private static boolean hearSelfDisguise;
|
||||||
private static boolean hidingArmor;
|
private static boolean hidingArmor;
|
||||||
@ -20,6 +21,10 @@ public class DisguiseConfig {
|
|||||||
return hearSelfDisguise;
|
return hearSelfDisguise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getDisguiseBlownMessage() {
|
||||||
|
return disguiseBlownMessage;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isDisguiseBlownOnAttack() {
|
public static boolean isDisguiseBlownOnAttack() {
|
||||||
return blowDisguisesOnAttack;
|
return blowDisguisesOnAttack;
|
||||||
}
|
}
|
||||||
@ -91,6 +96,10 @@ public class DisguiseConfig {
|
|||||||
entityAnimationsAdded = isEntityAnimationsAdded;
|
entityAnimationsAdded = isEntityAnimationsAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setDisguiseBlownMessage(String newMessage) {
|
||||||
|
disguiseBlownMessage = newMessage;
|
||||||
|
}
|
||||||
|
|
||||||
public static void setDisguiseBlownOnAttack(boolean blowDisguise) {
|
public static void setDisguiseBlownOnAttack(boolean blowDisguise) {
|
||||||
blowDisguisesOnAttack = blowDisguise;
|
blowDisguisesOnAttack = blowDisguise;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ public class DisguiseListener implements Listener {
|
|||||||
DisguiseAPI.undisguiseToAll(event.getEntity());
|
DisguiseAPI.undisguiseToAll(event.getEntity());
|
||||||
for (Disguise disguise : disguises) {
|
for (Disguise disguise : disguises) {
|
||||||
if (DisguiseUtilities.isDisguiseInUse(disguise)) {
|
if (DisguiseUtilities.isDisguiseInUse(disguise)) {
|
||||||
((Player) event.getEntity()).sendMessage(ChatColor.RED + "Your disguise was blown!");
|
((Player) event.getEntity()).sendMessage(DisguiseConfig.getDisguiseBlownMessage());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package me.libraryaddict.disguise;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
import me.libraryaddict.disguise.commands.*;
|
import me.libraryaddict.disguise.commands.*;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
@ -20,6 +21,7 @@ import me.libraryaddict.disguise.utilities.ReflectionManager;
|
|||||||
import me.libraryaddict.disguise.utilities.DisguiseValues;
|
import me.libraryaddict.disguise.utilities.DisguiseValues;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Ageable;
|
import org.bukkit.entity.Ageable;
|
||||||
@ -70,6 +72,8 @@ public class LibsDisguises extends JavaPlugin {
|
|||||||
DisguiseConfig.setModifyBoundingBox(getConfig().getBoolean("ModifyBoundingBox"));
|
DisguiseConfig.setModifyBoundingBox(getConfig().getBoolean("ModifyBoundingBox"));
|
||||||
DisguiseConfig.setMonstersIgnoreDisguises(getConfig().getBoolean("MonstersIgnoreDisguises"));
|
DisguiseConfig.setMonstersIgnoreDisguises(getConfig().getBoolean("MonstersIgnoreDisguises"));
|
||||||
DisguiseConfig.setDisguiseBlownOnAttack(getConfig().getBoolean("BlowDisguises"));
|
DisguiseConfig.setDisguiseBlownOnAttack(getConfig().getBoolean("BlowDisguises"));
|
||||||
|
DisguiseConfig.setDisguiseBlownMessage(ChatColor.translateAlternateColorCodes('&',
|
||||||
|
getConfig().getString("BlownDisguiseMessage")));
|
||||||
try {
|
try {
|
||||||
// Here I use reflection to set the plugin for Disguise..
|
// Here I use reflection to set the plugin for Disguise..
|
||||||
// Kind of stupid but I don't want open API calls for a commonly used object.
|
// Kind of stupid but I don't want open API calls for a commonly used object.
|
||||||
|
@ -161,19 +161,6 @@ public class DisguiseUtilities {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TargetedDisguise getMainDisguise(int entityId) {
|
|
||||||
TargetedDisguise toReturn = null;
|
|
||||||
if (getDisguises().containsKey(entityId)) {
|
|
||||||
for (TargetedDisguise disguise : getDisguises().get(entityId)) {
|
|
||||||
if (disguise.getDisguiseTarget() == TargetType.SHOW_TO_EVERYONE_BUT_THESE_PLAYERS) {
|
|
||||||
return disguise;
|
|
||||||
}
|
|
||||||
toReturn = disguise;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return toReturn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TargetedDisguise getDisguise(Player observer, int entityId) {
|
public static TargetedDisguise getDisguise(Player observer, int entityId) {
|
||||||
if (getDisguises().containsKey(entityId)) {
|
if (getDisguises().containsKey(entityId)) {
|
||||||
for (TargetedDisguise disguise : getDisguises().get(entityId)) {
|
for (TargetedDisguise disguise : getDisguises().get(entityId)) {
|
||||||
@ -196,6 +183,19 @@ public class DisguiseUtilities {
|
|||||||
return new TargetedDisguise[0];
|
return new TargetedDisguise[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TargetedDisguise getMainDisguise(int entityId) {
|
||||||
|
TargetedDisguise toReturn = null;
|
||||||
|
if (getDisguises().containsKey(entityId)) {
|
||||||
|
for (TargetedDisguise disguise : getDisguises().get(entityId)) {
|
||||||
|
if (disguise.getDisguiseTarget() == TargetType.SHOW_TO_EVERYONE_BUT_THESE_PLAYERS) {
|
||||||
|
return disguise;
|
||||||
|
}
|
||||||
|
toReturn = disguise;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all EntityPlayers who have this entity in their Entity Tracker And they are in the targetted disguise.
|
* Get all EntityPlayers who have this entity in their Entity Tracker And they are in the targetted disguise.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user