mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-09-11 01:38:07 +02:00
Fixed some bad naming and configuration for scoreboards
This commit is contained in:
parent
82db8d190b
commit
6fa6979916
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user