Skip to content

Commit

Permalink
Speculative fix for case sensitivity in InjectedPlayers
Browse files Browse the repository at this point in the history
  • Loading branch information
LadyCailin committed Jun 13, 2020
1 parent 067118a commit cc39b8f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/main/java/com/laytonsmith/core/Static.java
Expand Up @@ -198,7 +198,7 @@ public static double getDouble(Mixed c, Target t) {
}

/**
*
*
* @param c
* @param t
* @return
Expand Down Expand Up @@ -877,8 +877,8 @@ public static MCPlayer GetPlayer(Mixed player, Target t) throws ConfigRuntimeExc
*/
public static MCCommandSender GetCommandSender(String player, Target t) throws ConfigRuntimeException {
MCCommandSender m = null;
if(INJECTED_PLAYERS.containsKey(player)) {
m = INJECTED_PLAYERS.get(player);
if(INJECTED_PLAYERS.containsKey(player.toLowerCase())) {
m = INJECTED_PLAYERS.get(player.toLowerCase());
} else if(CONSOLE_NAME.equals(player)) {
m = Static.getServer().getConsole();
} else {
Expand All @@ -890,7 +890,8 @@ public static MCCommandSender GetCommandSender(String player, Target t) throws C
//throw a CRE instead.
}
}
if(m == null || (m instanceof MCPlayer && (!((MCPlayer) m).isOnline() && !INJECTED_PLAYERS.containsKey(player)))) {
if(m == null || (m instanceof MCPlayer && (!((MCPlayer) m).isOnline()
&& !INJECTED_PLAYERS.containsKey(player.toLowerCase())))) {
throw new CREPlayerOfflineException("The specified player (" + player + ") is not online", t);
}
return m;
Expand Down Expand Up @@ -1232,15 +1233,15 @@ public static String MCToANSIColors(String mes) {
}

public static MCCommandSender GetInjectedPlayer(String name) {
return INJECTED_PLAYERS.get(name);
return INJECTED_PLAYERS.get(name.toLowerCase());
}

public static void InjectPlayer(MCCommandSender player) {
String name = player.getName();
if("CONSOLE".equals(name)) {
name = "~console";
}
INJECTED_PLAYERS.put(name, player);
INJECTED_PLAYERS.put(name.toLowerCase(), player);
}

/**
Expand All @@ -1254,7 +1255,7 @@ public static MCCommandSender UninjectPlayer(MCCommandSender player) {
if("CONSOLE".equals(name)) {
name = "~console";
}
return INJECTED_PLAYERS.remove(name);
return INJECTED_PLAYERS.remove(name.toLowerCase());
}

public static void InjectEntity(MCEntity entity) {
Expand Down

0 comments on commit cc39b8f

Please sign in to comment.