geforkt von Mirrors/FastAsyncWorldEdit
Fix metrics
Dieser Commit ist enthalten in:
Ursprung
cfb1510503
Commit
bbff5c60b2
@ -22,7 +22,7 @@ package com.sk89q.worldedit.bukkit;
|
|||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.bukkit.FaweBukkit;
|
import com.boydti.fawe.bukkit.FaweBukkit;
|
||||||
import com.sk89q.worldedit.bukkit.adapter.impl.FAWE_Spigot_v1_14_R4;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.sk89q.util.yaml.YAMLProcessor;
|
import com.sk89q.util.yaml.YAMLProcessor;
|
||||||
@ -33,6 +33,7 @@ import com.sk89q.worldedit.WorldEdit;
|
|||||||
import com.sk89q.worldedit.bukkit.adapter.AdapterLoadException;
|
import com.sk89q.worldedit.bukkit.adapter.AdapterLoadException;
|
||||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplLoader;
|
import com.sk89q.worldedit.bukkit.adapter.BukkitImplLoader;
|
||||||
|
import com.sk89q.worldedit.bukkit.adapter.impl.FAWE_Spigot_v1_14_R4;
|
||||||
import com.sk89q.worldedit.bukkit.adapter.impl.FAWE_Spigot_v1_15_R2;
|
import com.sk89q.worldedit.bukkit.adapter.impl.FAWE_Spigot_v1_15_R2;
|
||||||
import com.sk89q.worldedit.bukkit.adapter.impl.FAWE_Spigot_v1_16_R1;
|
import com.sk89q.worldedit.bukkit.adapter.impl.FAWE_Spigot_v1_16_R1;
|
||||||
import com.sk89q.worldedit.event.platform.CommandEvent;
|
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||||
@ -42,8 +43,8 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
|||||||
import com.sk89q.worldedit.extension.platform.Capability;
|
import com.sk89q.worldedit.extension.platform.Capability;
|
||||||
import com.sk89q.worldedit.extension.platform.Platform;
|
import com.sk89q.worldedit.extension.platform.Platform;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
import com.sk89q.worldedit.internal.command.CommandUtil;
|
|
||||||
import com.sk89q.worldedit.internal.anvil.ChunkDeleter;
|
import com.sk89q.worldedit.internal.anvil.ChunkDeleter;
|
||||||
|
import com.sk89q.worldedit.internal.command.CommandUtil;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||||
import com.sk89q.worldedit.world.entity.EntityType;
|
import com.sk89q.worldedit.world.entity.EntityType;
|
||||||
@ -51,9 +52,6 @@ import com.sk89q.worldedit.world.gamemode.GameModes;
|
|||||||
import com.sk89q.worldedit.world.item.ItemCategory;
|
import com.sk89q.worldedit.world.item.ItemCategory;
|
||||||
import com.sk89q.worldedit.world.weather.WeatherTypes;
|
import com.sk89q.worldedit.world.weather.WeatherTypes;
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -75,22 +73,25 @@ import org.bukkit.plugin.PluginManager;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.plugin.java.JavaPluginLoader;
|
import org.bukkit.plugin.java.JavaPluginLoader;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
@ -112,6 +113,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
|||||||
private BukkitConfiguration config;
|
private BukkitConfiguration config;
|
||||||
|
|
||||||
private static Map<String, Plugin> lookupNames;
|
private static Map<String, Plugin> lookupNames;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Disable AWE as otherwise both fail to load
|
// Disable AWE as otherwise both fail to load
|
||||||
PluginManager manager = Bukkit.getPluginManager();
|
PluginManager manager = Bukkit.getPluginManager();
|
||||||
@ -142,7 +144,8 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
|||||||
return super.put(key, plugin);
|
return super.put(key, plugin);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Throwable ignore) {}
|
} catch (Throwable ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldEditPlugin() {
|
public WorldEditPlugin() {
|
||||||
@ -167,7 +170,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
if (INSTANCE != null) return;
|
if (INSTANCE != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
rename();
|
rename();
|
||||||
INSTANCE = this;
|
INSTANCE = this;
|
||||||
FaweBukkit imp = new FaweBukkit(this);
|
FaweBukkit imp = new FaweBukkit(this);
|
||||||
@ -194,7 +199,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
if (INSTANCE != null) return;
|
if (INSTANCE != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
onLoad();
|
onLoad();
|
||||||
|
|
||||||
PermissionsResolverManager.initialize(this); // Setup permission resolver
|
PermissionsResolverManager.initialize(this); // Setup permission resolver
|
||||||
@ -227,8 +234,15 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable metrics
|
// Setup metrics
|
||||||
|
if (Settings.IMP.ENABLED_COMPONENTS.BSTATS) {
|
||||||
new Metrics(this, BSTATS_PLUGIN_ID);
|
new Metrics(this, BSTATS_PLUGIN_ID);
|
||||||
|
} else {
|
||||||
|
getLogger().warning("bStats is disabled. Please enable it in /plugins/FastAsyncWorldEdit/config.yml. It helps the developers to identify the features most used");
|
||||||
|
getLogger().warning("and organize future updates better. Cheers.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Suggest PaperMC
|
||||||
PaperLib.suggestPaper(this);
|
PaperLib.suggestPaper(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,8 +262,11 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
|||||||
// Biome
|
// Biome
|
||||||
for (Biome biome : Biome.values()) {
|
for (Biome biome : Biome.values()) {
|
||||||
String lowerCaseBiomeName = biome.name().toLowerCase(Locale.ROOT);
|
String lowerCaseBiomeName = biome.name().toLowerCase(Locale.ROOT);
|
||||||
BiomeType biomeType = BiomeType.REGISTRY.register("minecraft:" + lowerCaseBiomeName, new BiomeType("minecraft:" + lowerCaseBiomeName));
|
BiomeType biomeType = BiomeType.REGISTRY.register(
|
||||||
if (bukkitAdapter != null) biomeType.setLegacyId(bukkitAdapter.getInternalBiomeId(biomeType));
|
"minecraft:" + lowerCaseBiomeName, new BiomeType("minecraft:" + lowerCaseBiomeName));
|
||||||
|
if (bukkitAdapter != null) {
|
||||||
|
biomeType.setLegacyId(bukkitAdapter.getInternalBiomeId(biomeType));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Block & Item
|
// Block & Item
|
||||||
/*for (Material material : Material.values()) {
|
/*for (Material material : Material.values()) {
|
||||||
@ -321,7 +338,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
|||||||
File pluginsFolder = MainUtil.getJarFile().getParentFile();
|
File pluginsFolder = MainUtil.getJarFile().getParentFile();
|
||||||
|
|
||||||
for (File file : pluginsFolder.listFiles()) {
|
for (File file : pluginsFolder.listFiles()) {
|
||||||
if (file.length() == 2052) return;
|
if (file.length() == 2052) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Plugin plugin = Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit");
|
Plugin plugin = Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit");
|
||||||
File dummy = MainUtil.copyFile(MainUtil.getJarFile(), "DummyFawe.src", pluginsFolder, "DummyFawe.jar");
|
File dummy = MainUtil.copyFile(MainUtil.getJarFile(), "DummyFawe.src", pluginsFolder, "DummyFawe.jar");
|
||||||
@ -396,9 +415,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
|||||||
if (platform instanceof BukkitServerInterface) {
|
if (platform instanceof BukkitServerInterface) {
|
||||||
log.warn(e.getMessage());
|
log.warn(e.getMessage());
|
||||||
} else {
|
} else {
|
||||||
log.info("WorldEdit could not find a Bukkit adapter for this MC version, " +
|
log.info("WorldEdit could not find a Bukkit adapter for this MC version, "
|
||||||
"but it seems that you have another implementation of WorldEdit installed (" + platform.getPlatformName() + ") " +
|
+ "but it seems that you have another implementation of WorldEdit installed (" + platform.getPlatformName() + ") "
|
||||||
"that handles the world editing.");
|
+ "that handles the world editing.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -439,7 +458,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
|||||||
File actual = new File(getDataFolder(), name);
|
File actual = new File(getDataFolder(), name);
|
||||||
if (!actual.exists()) {
|
if (!actual.exists()) {
|
||||||
try (InputStream stream = getResource("defaults/" + name)) {
|
try (InputStream stream = getResource("defaults/" + name)) {
|
||||||
if (stream == null) throw new FileNotFoundException();
|
if (stream == null) {
|
||||||
|
throw new FileNotFoundException();
|
||||||
|
}
|
||||||
copyDefaultConfig(stream, actual, name);
|
copyDefaultConfig(stream, actual, name);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
getLogger().severe("Unable to read default configuration: " + name);
|
getLogger().severe("Unable to read default configuration: " + name);
|
||||||
@ -630,9 +651,12 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
|||||||
|
|
||||||
private class WorldInitListener implements Listener {
|
private class WorldInitListener implements Listener {
|
||||||
private boolean loaded = false;
|
private boolean loaded = false;
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onWorldInit(@SuppressWarnings("unused") WorldInitEvent event) {
|
public void onWorldInit(@SuppressWarnings("unused") WorldInitEvent event) {
|
||||||
if (loaded) return;
|
if (loaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
loaded = true;
|
loaded = true;
|
||||||
setupWorldData();
|
setupWorldData();
|
||||||
}
|
}
|
||||||
@ -645,17 +669,23 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
|||||||
@SuppressWarnings("UnnecessaryFullyQualifiedName")
|
@SuppressWarnings("UnnecessaryFullyQualifiedName")
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onAsyncTabComplete(com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event) {
|
public void onAsyncTabComplete(com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event) {
|
||||||
if (!event.isCommand()) return;
|
if (!event.isCommand()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String buffer = event.getBuffer();
|
String buffer = event.getBuffer();
|
||||||
int firstSpace = buffer.indexOf(' ');
|
int firstSpace = buffer.indexOf(' ');
|
||||||
if (firstSpace < 0) return;
|
if (firstSpace < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String label = buffer.substring(0, firstSpace);
|
String label = buffer.substring(0, firstSpace);
|
||||||
// Strip leading slash, if present.
|
// Strip leading slash, if present.
|
||||||
label = label.startsWith("/") ? label.substring(1) : label;
|
label = label.startsWith("/") ? label.substring(1) : label;
|
||||||
final Optional<org.enginehub.piston.Command> command
|
final Optional<org.enginehub.piston.Command> command
|
||||||
= WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().getCommand(label);
|
= WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().getCommand(label);
|
||||||
if (!command.isPresent()) return;
|
if (!command.isPresent()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CommandSuggestionEvent suggestEvent = new CommandSuggestionEvent(wrapCommandSender(event.getSender()), buffer);
|
CommandSuggestionEvent suggestEvent = new CommandSuggestionEvent(wrapCommandSender(event.getSender()), buffer);
|
||||||
getWorldEdit().getEventBus().post(suggestEvent);
|
getWorldEdit().getEventBus().post(suggestEvent);
|
||||||
|
@ -80,6 +80,9 @@ public class Settings extends Config {
|
|||||||
"Specific aspects can be turned on and off further below"
|
"Specific aspects can be turned on and off further below"
|
||||||
})
|
})
|
||||||
public boolean PLOTSQUARED_HOOK = true;
|
public boolean PLOTSQUARED_HOOK = true;
|
||||||
|
@Comment({"Send anonymous FAWE statistics to https://bstats.org/.",
|
||||||
|
"Please keep this setting enabled. It helps us identifying which parts of FAWE are used the most to organize future updates better."})
|
||||||
|
public boolean BSTATS = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Comment("Paths for various directories")
|
@Comment("Paths for various directories")
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren