mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-11-08 09:42:56 +01:00
Make a default option for disguise pushing if errors
This commit is contained in:
parent
86e0a4c58a
commit
230d73813d
@ -53,17 +53,16 @@ public class DisguiseConfig {
|
|||||||
private static boolean stopShulkerDisguisesFromMoving;
|
private static boolean stopShulkerDisguisesFromMoving;
|
||||||
private static boolean targetDisguises;
|
private static boolean targetDisguises;
|
||||||
private static boolean undisguiseSwitchWorlds;
|
private static boolean undisguiseSwitchWorlds;
|
||||||
private static String updateMessage = ChatColor.RED + "[LibsDisguises] " + ChatColor.DARK_RED
|
private static String updateMessage = ChatColor.RED + "[LibsDisguises] " + ChatColor.DARK_RED + "There is a update ready to be downloaded! You are using " + ChatColor.RED + "v%s" + ChatColor.DARK_RED + ", the new version is " + ChatColor.RED + "%s" + ChatColor.DARK_RED + "!";
|
||||||
+ "There is a update ready to be downloaded! You are using " + ChatColor.RED + "v%s" + ChatColor.DARK_RED
|
|
||||||
+ ", the new version is " + ChatColor.RED + "%s" + ChatColor.DARK_RED + "!";
|
|
||||||
private static String updateNotificationPermission;
|
private static String updateNotificationPermission;
|
||||||
private static boolean viewSelfDisguise;
|
private static boolean viewSelfDisguise;
|
||||||
private static boolean witherSkullEnabled;
|
private static boolean witherSkullEnabled;
|
||||||
private static DisguisePushing disablePushing;
|
private static DisguisePushing disablePushing = DisguisePushing.MODIFY_SCOREBOARD;
|
||||||
|
|
||||||
public static Entry<String, Disguise> getCustomDisguise(String disguise) {
|
public static Entry<String, Disguise> getCustomDisguise(String disguise) {
|
||||||
for (Entry<String, Disguise> entry : customDisguises.entrySet()) {
|
for (Entry<String, Disguise> entry : customDisguises.entrySet()) {
|
||||||
if (!entry.getKey().equalsIgnoreCase(disguise) && !entry.getKey().replaceAll("_", "").equalsIgnoreCase(disguise))
|
if (!entry.getKey().equalsIgnoreCase(disguise) && !entry.getKey().replaceAll("_", "").equalsIgnoreCase(
|
||||||
|
disguise))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
@ -107,7 +106,8 @@ public class DisguiseConfig {
|
|||||||
public static void initConfig(ConfigurationSection config) {
|
public static void initConfig(ConfigurationSection config) {
|
||||||
setSoundsEnabled(config.getBoolean("DisguiseSounds"));
|
setSoundsEnabled(config.getBoolean("DisguiseSounds"));
|
||||||
setVelocitySent(config.getBoolean("SendVelocity"));
|
setVelocitySent(config.getBoolean("SendVelocity"));
|
||||||
setViewDisguises(config.getBoolean("ViewSelfDisguises")); // Since we can now toggle, the view disguises listener must
|
setViewDisguises(
|
||||||
|
config.getBoolean("ViewSelfDisguises")); // Since we can now toggle, the view disguises listener must
|
||||||
// always be on
|
// always be on
|
||||||
PacketsManager.setViewDisguisesListener(true);
|
PacketsManager.setViewDisguisesListener(true);
|
||||||
setHearSelfDisguise(config.getBoolean("HearSelfDisguise"));
|
setHearSelfDisguise(config.getBoolean("HearSelfDisguise"));
|
||||||
@ -146,7 +146,8 @@ public class DisguiseConfig {
|
|||||||
setDisabledInvisibility(config.getBoolean("DisableInvisibility"));
|
setDisabledInvisibility(config.getBoolean("DisableInvisibility"));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String option = config.getString("SelfDisguisesScoreboard", DisguisePushing.MODIFY_SCOREBOARD.name()).toUpperCase();
|
String option = config.getString("SelfDisguisesScoreboard",
|
||||||
|
DisguisePushing.MODIFY_SCOREBOARD.name()).toUpperCase();
|
||||||
|
|
||||||
if (!option.endsWith("_SCOREBOARD"))
|
if (!option.endsWith("_SCOREBOARD"))
|
||||||
option += "_SCOREBOARD";
|
option += "_SCOREBOARD";
|
||||||
@ -154,8 +155,8 @@ public class DisguiseConfig {
|
|||||||
disablePushing = DisguisePushing.valueOf(option);
|
disablePushing = DisguisePushing.valueOf(option);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
System.out.println("[LibsDisguises] Cannot parse '" + config.getString("SelfDisguisesScoreboard")
|
System.out.println("[LibsDisguises] Cannot parse '" + config.getString(
|
||||||
+ "' to a valid option for SelfDisguisesTeam");
|
"SelfDisguisesScoreboard") + "' to a valid option for SelfDisguisesTeam");
|
||||||
}
|
}
|
||||||
|
|
||||||
customDisguises.clear();
|
customDisguises.clear();
|
||||||
@ -177,22 +178,22 @@ public class DisguiseConfig {
|
|||||||
String toParse = section.getString(key);
|
String toParse = section.getString(key);
|
||||||
|
|
||||||
if (getCustomDisguise(toParse) != null) {
|
if (getCustomDisguise(toParse) != null) {
|
||||||
System.err
|
System.err.println(
|
||||||
.println("[LibsDisguises] Cannot create the custom disguise '" + key + "' as there is a name conflict!");
|
"[LibsDisguises] Cannot create the custom disguise '" + key + "' as there is a name conflict!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Disguise disguise = DisguiseParser.parseDisguise(Bukkit.getConsoleSender(), "disguise", toParse.split(" "),
|
Disguise disguise = DisguiseParser.parseDisguise(Bukkit.getConsoleSender(), "disguise",
|
||||||
DisguiseParser.getPermissions(Bukkit.getConsoleSender(), "disguise"));
|
toParse.split(" "), DisguiseParser.getPermissions(Bukkit.getConsoleSender(), "disguise"));
|
||||||
|
|
||||||
customDisguises.put(key, disguise);
|
customDisguises.put(key, disguise);
|
||||||
|
|
||||||
System.out.println("[LibsDisguises] Loaded custom disguise " + key);
|
System.out.println("[LibsDisguises] Loaded custom disguise " + key);
|
||||||
}
|
}
|
||||||
catch (DisguiseParseException e) {
|
catch (DisguiseParseException e) {
|
||||||
System.err.println("[LibsDisguises] Error while loading custom disguise '" + key + "'"
|
System.err.println(
|
||||||
+ (e.getMessage() == null ? "" : ": " + e.getMessage()));
|
"[LibsDisguises] Error while loading custom disguise '" + key + "'" + (e.getMessage() == null ? "" : ": " + e.getMessage()));
|
||||||
|
|
||||||
if (e.getMessage() == null)
|
if (e.getMessage() == null)
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -202,8 +203,8 @@ public class DisguiseConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("[LibsDisguises] Loaded " + customDisguises.size() + " custom disguise"
|
System.out.println(
|
||||||
+ (customDisguises.size() == 1 ? "" : "s"));
|
"[LibsDisguises] Loaded " + customDisguises.size() + " custom disguise" + (customDisguises.size() == 1 ? "" : "s"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAnimationPacketsEnabled() {
|
public static boolean isAnimationPacketsEnabled() {
|
||||||
|
Loading…
Reference in New Issue
Block a user