geforkt von Mirrors/FastAsyncWorldEdit
Disable BetterBrushes
BetterBrushes is a neat addition for builders, unfortunately it's outdated, therefore the few features have been migrated into FAVS.
Dieser Commit ist enthalten in:
Ursprung
5f037df326
Commit
82107d0bc8
@ -1,5 +1,6 @@
|
|||||||
package com.thevoxelbox.voxelsniper;
|
package com.thevoxelbox.voxelsniper;
|
||||||
|
|
||||||
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.bukkit.BukkitCommand;
|
import com.boydti.fawe.bukkit.BukkitCommand;
|
||||||
import com.boydti.fawe.object.FaweCommand;
|
import com.boydti.fawe.object.FaweCommand;
|
||||||
import com.boydti.fawe.object.FawePlayer;
|
import com.boydti.fawe.object.FawePlayer;
|
||||||
@ -8,9 +9,17 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bukkit extension point.
|
* Bukkit extension point.
|
||||||
*/
|
*/
|
||||||
@ -55,6 +64,41 @@ public class VoxelSniper extends JavaPlugin {
|
|||||||
return sniperManager;
|
return sniperManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Map<String, Plugin> lookupNames;
|
||||||
|
static {
|
||||||
|
{ // Disable BetterBrushes - FAVS includes the features and BetterBrushes is outdated
|
||||||
|
PluginManager manager = Bukkit.getPluginManager();
|
||||||
|
try {
|
||||||
|
Field pluginsField = manager.getClass().getDeclaredField("plugins");
|
||||||
|
Field lookupNamesField = manager.getClass().getDeclaredField("lookupNames");
|
||||||
|
pluginsField.setAccessible(true);
|
||||||
|
lookupNamesField.setAccessible(true);
|
||||||
|
List<Plugin> plugins = (List<Plugin>) pluginsField.get(manager);
|
||||||
|
lookupNames = (Map<String, Plugin>) lookupNamesField.get(manager);
|
||||||
|
pluginsField.set(manager, new ArrayList<Plugin>(plugins) {
|
||||||
|
@Override
|
||||||
|
public boolean add(Plugin plugin) {
|
||||||
|
if (plugin.getName().startsWith("BetterBrushes")) {
|
||||||
|
Fawe.debug("Disabling `" + plugin.getName() + "`. FastAsyncVoxelSniper includes all the features.");
|
||||||
|
} else {
|
||||||
|
return super.add(plugin);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
lookupNamesField.set(manager, lookupNames = new ConcurrentHashMap<String, Plugin>(lookupNames) {
|
||||||
|
@Override
|
||||||
|
public Plugin put(@NotNull String key, @NotNull Plugin plugin) {
|
||||||
|
if (plugin.getName().startsWith("BetterBrushes")) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return super.put(key, plugin);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Throwable ignore) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, String commandLabel, @NotNull String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, String commandLabel, @NotNull String[] args) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren