Revert "Revert matt's changes"

This reverts commit bfcc6184ad.
This commit is contained in:
IronApollo
2020-06-13 14:41:36 -04:00
parent bfcc6184ad
commit 238c56a3c6
75 changed files with 980 additions and 687 deletions

View File

@ -20,11 +20,6 @@
package com.sk89q.bukkit.util;
import com.sk89q.util.ReflectionUtil;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@ -33,6 +28,12 @@ import org.bukkit.command.PluginIdentifiableCommand;
import org.bukkit.command.SimpleCommandMap;
import org.bukkit.plugin.Plugin;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class CommandRegistration {
static {
@ -61,6 +62,7 @@ public class CommandRegistration {
}
return null;
}
public boolean register(List<CommandInfo> registered) {
CommandMap commandMap = getCommandMap();
if (registered == null || commandMap == null) {
@ -82,12 +84,13 @@ public class CommandRegistration {
if (fallbackCommands != null) {
return fallbackCommands;
}
CommandMap commandMap = ReflectionUtil.getField(plugin.getServer().getPluginManager(), "commandMap");
if (commandMap == null) {
Bukkit.getServer().getLogger().severe(plugin.getDescription().getName() +
": Could not retrieve server CommandMap, using fallback instead!");
fallbackCommands = commandMap = new SimpleCommandMap(Bukkit.getServer());
Bukkit.getServer().getPluginManager().registerEvents(new FallbackRegistrationListener(fallbackCommands), plugin);
Bukkit.getServer().getLogger().severe(plugin.getDescription().getName() +
": Could not retrieve server CommandMap, using fallback instead!");
fallbackCommands = commandMap = new SimpleCommandMap(Bukkit.getServer());
Bukkit.getServer().getPluginManager().registerEvents(new FallbackRegistrationListener(fallbackCommands), plugin);
} else {
serverCommandMap = commandMap;
}

View File

@ -31,7 +31,7 @@ import java.nio.charset.StandardCharsets;
*/
public class CUIChannelListener implements PluginMessageListener {
public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8");
public static final Charset UTF_8_CHARSET = StandardCharsets.UTF_8;
private final WorldEditPlugin plugin;
public CUIChannelListener(WorldEditPlugin plugin) {