Fix SWCommandUtils.knownCommandMap
Dieser Commit ist enthalten in:
Ursprung
a1651e896f
Commit
b08855f000
@ -24,6 +24,7 @@ import org.bukkit.GameMode;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandMap;
|
import org.bukkit.command.CommandMap;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.SimpleCommandMap;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
@ -89,7 +90,7 @@ public class SWCommandUtils {
|
|||||||
throw new SecurityException("Oh shit. Commands cannot be registered.", exception);
|
throw new SecurityException("Oh shit. Commands cannot be registered.", exception);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
final Field knownCommandsField = commandMap.getClass().getDeclaredField("knownCommands");
|
final Field knownCommandsField = SimpleCommandMap.class.getDeclaredField("knownCommands");
|
||||||
knownCommandsField.setAccessible(true);
|
knownCommandsField.setAccessible(true);
|
||||||
knownCommandMap = (Map<String, Command>) knownCommandsField.get(commandMap);
|
knownCommandMap = (Map<String, Command>) knownCommandsField.get(commandMap);
|
||||||
} catch (NoSuchFieldException | IllegalAccessException exception) {
|
} catch (NoSuchFieldException | IllegalAccessException exception) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren