mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-12 20:43:54 +00:00
Merge remote-tracking branch 'upstream/1.16' into fixEntities
This commit is contained in:
@ -23,7 +23,6 @@ repositories {
|
||||
name = "ProtocolLib Repo"
|
||||
url = uri("https://repo.dmulloy2.net/nexus/repository/public/")
|
||||
}
|
||||
maven { url = uri("https://repo.inventivetalent.org/content/groups/public/")}
|
||||
flatDir {dir(File("src/main/resources"))}
|
||||
}
|
||||
|
||||
@ -34,32 +33,36 @@ configurations.all {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile("com.github.MilkBowl:VaultAPI:1.7") { isTransitive = false }
|
||||
compileOnly("com.github.MilkBowl:VaultAPI:1.7") {
|
||||
isTransitive = false
|
||||
}
|
||||
"api"(project(":worldedit-core"))
|
||||
"api"(project(":worldedit-libs:bukkit"))
|
||||
"compile"(":worldedit-adapters:")
|
||||
"compile"("org.spigotmcv1_14_r1:spigotmcv1_14_r1:1_14_r1")
|
||||
"compile"("org.spigotmcv1_15_r1:spigotmcv1_15_r1:1_15_r1")
|
||||
"compile"("it.unimi.dsi:fastutil:8.2.1")
|
||||
"implementation"("it.unimi.dsi:fastutil:${Versions.FAST_UTIL}")
|
||||
"api"("com.destroystokyo.paper:paper-api:1.16.1-R0.1-SNAPSHOT") {
|
||||
exclude("junit", "junit")
|
||||
isTransitive = false
|
||||
}
|
||||
"compileOnly"("org.jetbrains:annotations:20.0.0")
|
||||
"compileOnly"("org.spigotmc:spigot:1.14.4-R0.1-SNAPSHOT")
|
||||
"compileOnly"("org.spigotmc:spigot:1.15.2-R0.1-SNAPSHOT")
|
||||
"compileOnly"("org.spigotmc:spigot:1.16.1-R0.1-SNAPSHOT")
|
||||
"implementation"("io.papermc:paperlib:1.0.2")
|
||||
"compileOnly"("com.sk89q:dummypermscompat:1.10")
|
||||
"implementation"("io.papermc:paperlib:1.0.+")
|
||||
"compileOnly"("com.sk89q:dummypermscompat:1.10") {
|
||||
exclude("com.github.MilkBowl", "VaultAPI")
|
||||
}
|
||||
"implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1")
|
||||
"testCompile"("org.mockito:mockito-core:1.9.0-rc1")
|
||||
"testImplementation"("org.mockito:mockito-core:1.9.0-rc1")
|
||||
"compileOnly"("com.sk89q.worldguard:worldguard-bukkit:7.+") {
|
||||
exclude("com.sk89q.worldedit", "worldedit-bukkit")
|
||||
exclude("com.sk89q.worldedit", "worldedit-core")
|
||||
exclude("com.sk89q.worldedit.worldedit-libs", "bukkit")
|
||||
exclude("com.sk89q.worldedit.worldedit-libs", "core")
|
||||
}
|
||||
"implementation"("org.inventivetalent:mapmanager:1.7.3-SNAPSHOT") { isTransitive = false }
|
||||
|
||||
"implementation"("com.github.InventivetalentDev:MapManager:1.7.+") { isTransitive = false }
|
||||
"implementation"("com.github.TechFortress:GriefPrevention:16.+") { isTransitive = false }
|
||||
"implementation"("com.massivecraft:mcore:7.0.1") { isTransitive = false }
|
||||
"implementation"("com.bekvon.bukkit.residence:Residence:4.5._13.1") { isTransitive = false }
|
||||
@ -100,7 +103,7 @@ tasks.named<ShadowJar>("shadowJar") {
|
||||
include(dependency("org.bstats:bstats-bukkit:1.7"))
|
||||
}
|
||||
relocate("io.papermc.lib", "com.sk89q.worldedit.bukkit.paperlib") {
|
||||
include(dependency("io.papermc:paperlib:1.0.2"))
|
||||
include(dependency("io.papermc:paperlib:1.+"))
|
||||
}
|
||||
relocate("it.unimi.dsi.fastutil", "com.sk89q.worldedit.bukkit.fastutil") {
|
||||
include(dependency("it.unimi.dsi:fastutil"))
|
||||
|
@ -88,7 +88,7 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
Integer.parseInt(Bukkit.getBukkitVersion().split("-")[0].split("\\.")[1]) >= 16;
|
||||
|
||||
//Vault is Spigot/Paper only so this needs to be done in the Bukkit module
|
||||
setupVault();
|
||||
TaskManager.IMP.later(this::setupVault, 0);
|
||||
|
||||
//PlotSquared support is limited to Spigot/Paper as of 02/20/2020
|
||||
TaskManager.IMP.later(this::setupPlotSquared, 0);
|
||||
|
@ -22,7 +22,7 @@ package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
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.google.common.base.Joiner;
|
||||
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.BukkitImplAdapter;
|
||||
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_16_R1;
|
||||
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.Platform;
|
||||
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.command.CommandUtil;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||
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.weather.WeatherTypes;
|
||||
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.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@ -75,22 +73,25 @@ import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.plugin.java.JavaPluginLoader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
@ -112,6 +113,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
private BukkitConfiguration config;
|
||||
|
||||
private static Map<String, Plugin> lookupNames;
|
||||
|
||||
static {
|
||||
// Disable AWE as otherwise both fail to load
|
||||
PluginManager manager = Bukkit.getPluginManager();
|
||||
@ -142,7 +144,8 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
return super.put(key, plugin);
|
||||
}
|
||||
});
|
||||
} catch (Throwable ignore) {}
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
public WorldEditPlugin() {
|
||||
@ -167,7 +170,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
if (INSTANCE != null) return;
|
||||
if (INSTANCE != null) {
|
||||
return;
|
||||
}
|
||||
rename();
|
||||
INSTANCE = this;
|
||||
FaweBukkit imp = new FaweBukkit(this);
|
||||
@ -185,8 +190,8 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
if (Files.exists(delChunks)) {
|
||||
ChunkDeleter.runFromFile(delChunks, true);
|
||||
}
|
||||
|
||||
fail(() -> PermissionsResolverManager.initialize(INSTANCE), "Failed to initialize permissions resolver");
|
||||
|
||||
fail(() -> PermissionsResolverManager.initialize(INSTANCE), "Failed to initialize permissions resolver");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -194,15 +199,17 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
*/
|
||||
@Override
|
||||
public void onEnable() {
|
||||
if (INSTANCE != null) return;
|
||||
if (INSTANCE != null) {
|
||||
return;
|
||||
}
|
||||
onLoad();
|
||||
|
||||
PermissionsResolverManager.initialize(this); // Setup permission resolver
|
||||
|
||||
// Register CUI
|
||||
fail(() -> {
|
||||
getServer().getMessenger().registerIncomingPluginChannel(this, CUI_PLUGIN_CHANNEL, new CUIChannelListener(this));
|
||||
getServer().getMessenger().registerOutgoingPluginChannel(this, CUI_PLUGIN_CHANNEL);
|
||||
getServer().getMessenger().registerIncomingPluginChannel(this, CUI_PLUGIN_CHANNEL, new CUIChannelListener(this));
|
||||
getServer().getMessenger().registerOutgoingPluginChannel(this, CUI_PLUGIN_CHANNEL);
|
||||
}, "Failed to register CUI");
|
||||
|
||||
// Now we can register events
|
||||
@ -227,8 +234,15 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
}
|
||||
}
|
||||
|
||||
// Enable metrics
|
||||
new Metrics(this, BSTATS_PLUGIN_ID);
|
||||
// Setup metrics
|
||||
if (Settings.IMP.ENABLED_COMPONENTS.BSTATS) {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -248,8 +262,11 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
// Biome
|
||||
for (Biome biome : Biome.values()) {
|
||||
String lowerCaseBiomeName = biome.name().toLowerCase(Locale.ROOT);
|
||||
BiomeType biomeType = BiomeType.REGISTRY.register("minecraft:" + lowerCaseBiomeName, new BiomeType("minecraft:" + lowerCaseBiomeName));
|
||||
if (bukkitAdapter != null) biomeType.setLegacyId(bukkitAdapter.getInternalBiomeId(biomeType));
|
||||
BiomeType biomeType = BiomeType.REGISTRY.register(
|
||||
"minecraft:" + lowerCaseBiomeName, new BiomeType("minecraft:" + lowerCaseBiomeName));
|
||||
if (bukkitAdapter != null) {
|
||||
biomeType.setLegacyId(bukkitAdapter.getInternalBiomeId(biomeType));
|
||||
}
|
||||
}
|
||||
// Block & Item
|
||||
/*for (Material material : Material.values()) {
|
||||
@ -321,7 +338,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
File pluginsFolder = MainUtil.getJarFile().getParentFile();
|
||||
|
||||
for (File file : pluginsFolder.listFiles()) {
|
||||
if (file.length() == 2052) return;
|
||||
if (file.length() == 2052) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Plugin plugin = Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit");
|
||||
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) {
|
||||
log.warn(e.getMessage());
|
||||
} else {
|
||||
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() + ") " +
|
||||
"that handles the world editing.");
|
||||
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() + ") "
|
||||
+ "that handles the world editing.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -439,7 +458,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
File actual = new File(getDataFolder(), name);
|
||||
if (!actual.exists()) {
|
||||
try (InputStream stream = getResource("defaults/" + name)) {
|
||||
if (stream == null) throw new FileNotFoundException();
|
||||
if (stream == null) {
|
||||
throw new FileNotFoundException();
|
||||
}
|
||||
copyDefaultConfig(stream, actual, name);
|
||||
} catch (IOException e) {
|
||||
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 boolean loaded = false;
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onWorldInit(@SuppressWarnings("unused") WorldInitEvent event) {
|
||||
if (loaded) return;
|
||||
if (loaded) {
|
||||
return;
|
||||
}
|
||||
loaded = true;
|
||||
setupWorldData();
|
||||
}
|
||||
@ -645,17 +669,23 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
@SuppressWarnings("UnnecessaryFullyQualifiedName")
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onAsyncTabComplete(com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event) {
|
||||
if (!event.isCommand()) return;
|
||||
if (!event.isCommand()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String buffer = event.getBuffer();
|
||||
int firstSpace = buffer.indexOf(' ');
|
||||
if (firstSpace < 0) return;
|
||||
if (firstSpace < 0) {
|
||||
return;
|
||||
}
|
||||
String label = buffer.substring(0, firstSpace);
|
||||
// Strip leading slash, if present.
|
||||
label = label.startsWith("/") ? label.substring(1) : label;
|
||||
final Optional<org.enginehub.piston.Command> command
|
||||
= WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().getCommand(label);
|
||||
if (!command.isPresent()) return;
|
||||
if (!command.isPresent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandSuggestionEvent suggestEvent = new CommandSuggestionEvent(wrapCommandSender(event.getSender()), buffer);
|
||||
getWorldEdit().getEventBus().post(suggestEvent);
|
||||
|
Reference in New Issue
Block a user