Fixed the disguise blown message not being used

This commit is contained in:
libraryaddict 2014-01-21 14:05:32 +13:00
parent ad109b0cda
commit 85077227a2
4 changed files with 27 additions and 14 deletions

View File

@ -4,6 +4,7 @@ import me.libraryaddict.disguise.utilities.PacketsManager;
public class DisguiseConfig {
private static boolean blowDisguisesOnAttack;
private static String disguiseBlownMessage;
private static boolean entityAnimationsAdded;
private static boolean hearSelfDisguise;
private static boolean hidingArmor;
@ -20,6 +21,10 @@ public class DisguiseConfig {
return hearSelfDisguise;
}
public static String getDisguiseBlownMessage() {
return disguiseBlownMessage;
}
public static boolean isDisguiseBlownOnAttack() {
return blowDisguisesOnAttack;
}
@ -91,6 +96,10 @@ public class DisguiseConfig {
entityAnimationsAdded = isEntityAnimationsAdded;
}
public static void setDisguiseBlownMessage(String newMessage) {
disguiseBlownMessage = newMessage;
}
public static void setDisguiseBlownOnAttack(boolean blowDisguise) {
blowDisguisesOnAttack = blowDisguise;
}

View File

@ -72,7 +72,7 @@ public class DisguiseListener implements Listener {
DisguiseAPI.undisguiseToAll(event.getEntity());
for (Disguise disguise : disguises) {
if (DisguiseUtilities.isDisguiseInUse(disguise)) {
((Player) event.getEntity()).sendMessage(ChatColor.RED + "Your disguise was blown!");
((Player) event.getEntity()).sendMessage(DisguiseConfig.getDisguiseBlownMessage());
break;
}
}

View File

@ -3,6 +3,7 @@ package me.libraryaddict.disguise;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import me.libraryaddict.disguise.commands.*;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
@ -20,6 +21,7 @@ import me.libraryaddict.disguise.utilities.ReflectionManager;
import me.libraryaddict.disguise.utilities.DisguiseValues;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Ageable;
@ -70,6 +72,8 @@ public class LibsDisguises extends JavaPlugin {
DisguiseConfig.setModifyBoundingBox(getConfig().getBoolean("ModifyBoundingBox"));
DisguiseConfig.setMonstersIgnoreDisguises(getConfig().getBoolean("MonstersIgnoreDisguises"));
DisguiseConfig.setDisguiseBlownOnAttack(getConfig().getBoolean("BlowDisguises"));
DisguiseConfig.setDisguiseBlownMessage(ChatColor.translateAlternateColorCodes('&',
getConfig().getString("BlownDisguiseMessage")));
try {
// 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.

View File

@ -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) {
if (getDisguises().containsKey(entityId)) {
for (TargetedDisguise disguise : getDisguises().get(entityId)) {
@ -196,6 +183,19 @@ public class DisguiseUtilities {
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.
*/