From 6fa69799169d3766377a36886853c08f6fc7e3f9 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 24 Feb 2017 01:28:37 +1300 Subject: [PATCH] Fixed some bad naming and configuration for scoreboards --- src/me/libraryaddict/disguise/DisguiseConfig.java | 12 ++++++++---- .../disguise/utilities/DisguiseUtilities.java | 10 +++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/me/libraryaddict/disguise/DisguiseConfig.java b/src/me/libraryaddict/disguise/DisguiseConfig.java index 3a89a637..fd898e89 100644 --- a/src/me/libraryaddict/disguise/DisguiseConfig.java +++ b/src/me/libraryaddict/disguise/DisguiseConfig.java @@ -16,7 +16,7 @@ import me.libraryaddict.disguise.utilities.PacketsManager; public class DisguiseConfig { public static enum DisguisePushing { - MODIFY, IGNORE, CREATE; + MODIFY_SCOREBOARD, IGNORE_SCOREBOARD, CREATE_SCOREBOARD; } private static boolean animationEnabled; @@ -146,11 +146,15 @@ public class DisguiseConfig { setDisabledInvisibility(config.getBoolean("DisableInvisibility")); try { - disablePushing = DisguisePushing - .valueOf(config.getString("DisablePushing", DisguisePushing.MODIFY.name()).toUpperCase()); + String option = config.getString("SelfDisguisesScoreboard", DisguisePushing.MODIFY_SCOREBOARD.name()).toUpperCase(); + + if (!option.endsWith("_SCOREBOARD")) + option += "_SCOREBOARD"; + + disablePushing = DisguisePushing.valueOf(option); } catch (Exception ex) { - System.out.println("[LibsDisguises] Cannot parse '" + config.getString("SelfDisguisesTeams") + System.out.println("[LibsDisguises] Cannot parse '" + config.getString("SelfDisguisesScoreboard") + "' to a valid option for SelfDisguisesTeam"); } diff --git a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java index 322393ce..d0f083e4 100644 --- a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java +++ b/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java @@ -1033,7 +1033,7 @@ public class DisguiseUtilities { String prevTeam = previousTeam.remove(player.getUniqueId()); - if (DisguiseConfig.getPushingOption() != DisguisePushing.IGNORE) { + if (DisguiseConfig.getPushingOption() != DisguisePushing.IGNORE_SCOREBOARD) { // Code to stop player pushing in 1.9 Scoreboard scoreboard = player.getScoreboard(); Team team = prevTeam == null ? null : scoreboard.getTeam(prevTeam); @@ -1133,19 +1133,19 @@ public class DisguiseUtilities { DisguisePushing pOption = DisguiseConfig.getPushingOption(); - if (pOption != DisguisePushing.IGNORE) { + if (pOption != DisguisePushing.IGNORE_SCOREBOARD) { // Code to stop player pushing Scoreboard scoreboard = player.getScoreboard(); Team prevTeam = scoreboard.getEntryTeam(player.getName()); - if (prevTeam != null && pOption == DisguisePushing.CREATE) { + if (prevTeam != null && pOption == DisguisePushing.CREATE_SCOREBOARD) { previousTeam.put(player.getUniqueId(), prevTeam.getName()); } Team t; String createName = null; - if (pOption == DisguisePushing.CREATE) { + if (pOption == DisguisePushing.CREATE_SCOREBOARD) { createName = (prevTeam == null ? "No Team" : prevTeam.getName()); createName = createName.substring(0, Math.min(12, createName.length())); @@ -1169,7 +1169,7 @@ public class DisguiseUtilities { if (!t.hasEntry(player.getName())) t.addEntry(player.getName()); - if (pOption == DisguisePushing.CREATE && prevTeam != null) { + if (pOption == DisguisePushing.CREATE_SCOREBOARD && prevTeam != null) { t.setAllowFriendlyFire(prevTeam.allowFriendlyFire()); t.setCanSeeFriendlyInvisibles(prevTeam.canSeeFriendlyInvisibles()); t.setDisplayName(prevTeam.getDisplayName());