mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Add and apply .editorconfig from P2 (#1195)
* Consistenty use javax annotations. - Unfortunately jetbrains annotations seem to be exposed transitively via core somewhere, but with the correct IDE settings, annotations can be defaulted to javax - Cleaning up of import order in #1195 - Must be merged before #1195 * Add and apply .editorconfig from P2 - Does not rearrange entries * Address some comments * add back some javadoc comments * Address final comments Co-authored-by: NotMyFault <mc.cache@web.de>
This commit is contained in:
parent
3b4beba7d6
commit
8c0195970b
1013
.editorconfig
Normal file
1013
.editorconfig
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,13 @@
|
|||||||
package com.fastasyncworldedit.bukkit;
|
package com.fastasyncworldedit.bukkit;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.permissions.PermissionAttachment;
|
import org.bukkit.permissions.PermissionAttachment;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class BukkitPermissionAttachmentManager {
|
public class BukkitPermissionAttachmentManager {
|
||||||
|
|
||||||
private final WorldEditPlugin plugin;
|
private final WorldEditPlugin plugin;
|
||||||
@ -33,4 +33,5 @@ public class BukkitPermissionAttachmentManager {
|
|||||||
p.removeAttachment(attach);
|
p.removeAttachment(attach);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,27 @@
|
|||||||
package com.fastasyncworldedit.bukkit;
|
package com.fastasyncworldedit.bukkit;
|
||||||
|
|
||||||
import com.fastasyncworldedit.bukkit.util.image.BukkitImageViewer;
|
|
||||||
import com.fastasyncworldedit.core.FAWEPlatformAdapterImpl;
|
|
||||||
import com.fastasyncworldedit.core.Fawe;
|
|
||||||
import com.fastasyncworldedit.core.IFawe;
|
|
||||||
import com.fastasyncworldedit.core.queue.implementation.preloader.AsyncPreloader;
|
|
||||||
import com.fastasyncworldedit.core.queue.implementation.preloader.Preloader;
|
|
||||||
import com.fastasyncworldedit.core.queue.implementation.QueueHandler;
|
|
||||||
import com.fastasyncworldedit.bukkit.adapter.BukkitQueueHandler;
|
import com.fastasyncworldedit.bukkit.adapter.BukkitQueueHandler;
|
||||||
import com.fastasyncworldedit.bukkit.adapter.NMSAdapter;
|
import com.fastasyncworldedit.bukkit.adapter.NMSAdapter;
|
||||||
import com.fastasyncworldedit.bukkit.listener.BrushListener;
|
import com.fastasyncworldedit.bukkit.listener.BrushListener;
|
||||||
import com.fastasyncworldedit.bukkit.listener.ChunkListener9;
|
import com.fastasyncworldedit.bukkit.listener.ChunkListener9;
|
||||||
import com.fastasyncworldedit.bukkit.listener.RenderListener;
|
import com.fastasyncworldedit.bukkit.listener.RenderListener;
|
||||||
import com.fastasyncworldedit.bukkit.regions.GriefPreventionFeature;
|
|
||||||
import com.fastasyncworldedit.bukkit.regions.GriefDefenderFeature;
|
import com.fastasyncworldedit.bukkit.regions.GriefDefenderFeature;
|
||||||
|
import com.fastasyncworldedit.bukkit.regions.GriefPreventionFeature;
|
||||||
import com.fastasyncworldedit.bukkit.regions.ResidenceFeature;
|
import com.fastasyncworldedit.bukkit.regions.ResidenceFeature;
|
||||||
import com.fastasyncworldedit.bukkit.regions.TownyFeature;
|
import com.fastasyncworldedit.bukkit.regions.TownyFeature;
|
||||||
import com.fastasyncworldedit.bukkit.regions.WorldGuardFeature;
|
import com.fastasyncworldedit.bukkit.regions.WorldGuardFeature;
|
||||||
import com.fastasyncworldedit.bukkit.util.BukkitTaskManager;
|
import com.fastasyncworldedit.bukkit.util.BukkitTaskManager;
|
||||||
import com.fastasyncworldedit.bukkit.util.ItemUtil;
|
import com.fastasyncworldedit.bukkit.util.ItemUtil;
|
||||||
import com.fastasyncworldedit.bukkit.util.MinecraftVersion;
|
import com.fastasyncworldedit.bukkit.util.MinecraftVersion;
|
||||||
//import com.fastasyncworldedit.bukkit.util.image.BukkitImageViewer;
|
import com.fastasyncworldedit.bukkit.util.image.BukkitImageViewer;
|
||||||
|
import com.fastasyncworldedit.core.FAWEPlatformAdapterImpl;
|
||||||
|
import com.fastasyncworldedit.core.Fawe;
|
||||||
|
import com.fastasyncworldedit.core.IFawe;
|
||||||
import com.fastasyncworldedit.core.configuration.Settings;
|
import com.fastasyncworldedit.core.configuration.Settings;
|
||||||
|
import com.fastasyncworldedit.core.queue.implementation.QueueHandler;
|
||||||
|
import com.fastasyncworldedit.core.queue.implementation.preloader.AsyncPreloader;
|
||||||
|
import com.fastasyncworldedit.core.queue.implementation.preloader.Preloader;
|
||||||
import com.fastasyncworldedit.core.regions.FaweMaskManager;
|
import com.fastasyncworldedit.core.regions.FaweMaskManager;
|
||||||
import com.fastasyncworldedit.core.util.ThirdPartyManager;
|
|
||||||
import com.fastasyncworldedit.core.util.TaskManager;
|
import com.fastasyncworldedit.core.util.TaskManager;
|
||||||
import com.fastasyncworldedit.core.util.WEManager;
|
import com.fastasyncworldedit.core.util.WEManager;
|
||||||
import com.fastasyncworldedit.core.util.image.ImageViewer;
|
import com.fastasyncworldedit.core.util.image.ImageViewer;
|
||||||
@ -44,7 +42,6 @@ import org.bukkit.plugin.Plugin;
|
|||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -91,7 +88,7 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
TaskManager.IMP.task(() -> {
|
TaskManager.IMP.task(() -> {
|
||||||
// Fix for ProtocolSupport
|
// Fix for ProtocolSupport
|
||||||
Settings.IMP.PROTOCOL_SUPPORT_FIX =
|
Settings.IMP.PROTOCOL_SUPPORT_FIX =
|
||||||
Bukkit.getPluginManager().isPluginEnabled("ProtocolSupport");
|
Bukkit.getPluginManager().isPluginEnabled("ProtocolSupport");
|
||||||
|
|
||||||
// This class
|
// This class
|
||||||
Bukkit.getPluginManager().registerEvents(FaweBukkit.this, FaweBukkit.this.plugin);
|
Bukkit.getPluginManager().registerEvents(FaweBukkit.this, FaweBukkit.this.plugin);
|
||||||
@ -101,7 +98,8 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public QueueHandler getQueueHandler() {
|
@Override
|
||||||
|
public QueueHandler getQueueHandler() {
|
||||||
return new BukkitQueueHandler();
|
return new BukkitQueueHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,20 +110,12 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
PluginManager manager = Bukkit.getPluginManager();
|
PluginManager manager = Bukkit.getPluginManager();
|
||||||
|
|
||||||
if (manager.getPlugin("PacketListenerApi") == null) {
|
if (manager.getPlugin("PacketListenerApi") == null) {
|
||||||
File output = new File(plugin.getDataFolder().getParentFile(),
|
LOGGER.error("PacketListener not found! Please install PacketListenerAPI v3.7.6 or above before attempting to " +
|
||||||
"PacketListenerAPI_v3.7.6-SNAPSHOT.jar");
|
"complete image-related edits");
|
||||||
byte[] jarData = ThirdPartyManager.PacketListenerAPI.download();
|
|
||||||
try (FileOutputStream fos = new FileOutputStream(output)) {
|
|
||||||
fos.write(jarData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (manager.getPlugin("MapManager") == null) {
|
if (manager.getPlugin("MapManager") == null) {
|
||||||
File output = new File(plugin.getDataFolder().getParentFile(),
|
LOGGER.error("MapManager not found! Please install PacketListenerAPI v1.7.8 or above before attempting to " +
|
||||||
"MapManager_v1.7.8-SNAPSHOT.jar");
|
"complete image-related edits");
|
||||||
byte[] jarData = ThirdPartyManager.MapManager.download();
|
|
||||||
try (FileOutputStream fos = new FileOutputStream(output)) {
|
|
||||||
fos.write(jarData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return new BukkitImageViewer(BukkitAdapter.adapt(player));
|
return new BukkitImageViewer(BukkitAdapter.adapt(player));
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
@ -133,7 +123,8 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public File getDirectory() {
|
@Override
|
||||||
|
public File getDirectory() {
|
||||||
return plugin.getDataFolder();
|
return plugin.getDataFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,21 +142,22 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String getDebugInfo() {
|
@Override
|
||||||
|
public String getDebugInfo() {
|
||||||
StringBuilder msg = new StringBuilder();
|
StringBuilder msg = new StringBuilder();
|
||||||
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
|
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
|
||||||
msg.append("Server Version: ").append(Bukkit.getVersion()).append("\n");
|
msg.append("Server Version: ").append(Bukkit.getVersion()).append("\n");
|
||||||
msg.append("Plugins (").append(plugins.length).append("): \n");
|
msg.append("Plugins (").append(plugins.length).append("): \n");
|
||||||
for (Plugin p : plugins) {
|
for (Plugin p : plugins) {
|
||||||
msg.append(" - ").append(p.getName()).append(":").append("\n")
|
msg.append(" - ").append(p.getName()).append(":").append("\n")
|
||||||
.append(" • Version: ").append(p.getDescription().getVersion()).append("\n")
|
.append(" • Version: ").append(p.getDescription().getVersion()).append("\n")
|
||||||
.append(" • Enabled: ").append(p.isEnabled()).append("\n")
|
.append(" • Enabled: ").append(p.isEnabled()).append("\n")
|
||||||
.append(" • Main: ").append(p.getDescription().getMain()).append("\n")
|
.append(" • Main: ").append(p.getDescription().getMain()).append("\n")
|
||||||
.append(" • Authors: ").append(p.getDescription().getAuthors()).append("\n")
|
.append(" • Authors: ").append(p.getDescription().getAuthors()).append("\n")
|
||||||
.append(" • Load Before: ").append(p.getDescription().getLoadBefore()).append("\n")
|
.append(" • Load Before: ").append(p.getDescription().getLoadBefore()).append("\n")
|
||||||
.append(" • Dependencies: ").append(p.getDescription().getDepend()).append("\n")
|
.append(" • Dependencies: ").append(p.getDescription().getDepend()).append("\n")
|
||||||
.append(" • Soft Dependencies: ").append(p.getDescription().getSoftDepend()).append("\n")
|
.append(" • Soft Dependencies: ").append(p.getDescription().getSoftDepend()).append("\n")
|
||||||
.append(" • Provides: ").append(p.getDescription().getProvides()).append("\n");
|
.append(" • Provides: ").append(p.getDescription().getProvides()).append("\n");
|
||||||
}
|
}
|
||||||
return msg.toString();
|
return msg.toString();
|
||||||
}
|
}
|
||||||
@ -173,7 +165,8 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
/**
|
/**
|
||||||
* The task manager handles sync/async tasks.
|
* The task manager handles sync/async tasks.
|
||||||
*/
|
*/
|
||||||
@Override public TaskManager getTaskManager() {
|
@Override
|
||||||
|
public TaskManager getTaskManager() {
|
||||||
return new BukkitTaskManager(plugin);
|
return new BukkitTaskManager(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,9 +177,10 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
/**
|
/**
|
||||||
* A mask manager handles region restrictions e.g., PlotSquared plots / WorldGuard regions
|
* A mask manager handles region restrictions e.g., PlotSquared plots / WorldGuard regions
|
||||||
*/
|
*/
|
||||||
@Override public Collection<FaweMaskManager> getMaskManagers() {
|
@Override
|
||||||
|
public Collection<FaweMaskManager> getMaskManagers() {
|
||||||
final Plugin worldguardPlugin =
|
final Plugin worldguardPlugin =
|
||||||
Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
|
Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
|
||||||
final ArrayList<FaweMaskManager> managers = new ArrayList<>();
|
final ArrayList<FaweMaskManager> managers = new ArrayList<>();
|
||||||
if (worldguardPlugin != null && worldguardPlugin.isEnabled()) {
|
if (worldguardPlugin != null && worldguardPlugin.isEnabled()) {
|
||||||
try {
|
try {
|
||||||
@ -212,7 +206,7 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Plugin griefpreventionPlugin =
|
final Plugin griefpreventionPlugin =
|
||||||
Bukkit.getServer().getPluginManager().getPlugin("GriefPrevention");
|
Bukkit.getServer().getPluginManager().getPlugin("GriefPrevention");
|
||||||
if (griefpreventionPlugin != null && griefpreventionPlugin.isEnabled()) {
|
if (griefpreventionPlugin != null && griefpreventionPlugin.isEnabled()) {
|
||||||
try {
|
try {
|
||||||
managers.add(new GriefPreventionFeature(griefpreventionPlugin));
|
managers.add(new GriefPreventionFeature(griefpreventionPlugin));
|
||||||
@ -259,26 +253,31 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
wePlayer.unregister();
|
wePlayer.unregister();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String getPlatform() {
|
@Override
|
||||||
|
public String getPlatform() {
|
||||||
return "Bukkit";
|
return "Bukkit";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public UUID getUUID(String name) {
|
@Override
|
||||||
|
public UUID getUUID(String name) {
|
||||||
return Bukkit.getOfflinePlayer(name).getUniqueId();
|
return Bukkit.getOfflinePlayer(name).getUniqueId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String getName(UUID uuid) {
|
@Override
|
||||||
|
public String getName(UUID uuid) {
|
||||||
return Bukkit.getOfflinePlayer(uuid).getName();
|
return Bukkit.getOfflinePlayer(uuid).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public Preloader getPreloader() {
|
@Override
|
||||||
|
public Preloader getPreloader() {
|
||||||
if (PaperLib.isPaper()) {
|
if (PaperLib.isPaper()) {
|
||||||
return new AsyncPreloader();
|
return new AsyncPreloader();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean isChunksStretched() {
|
@Override
|
||||||
|
public boolean isChunksStretched() {
|
||||||
return chunksStretched;
|
return chunksStretched;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,11 +294,12 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
if (plotSquared.getClass().getPackage().toString().contains("intellectualsites")) {
|
if (plotSquared.getClass().getPackage().toString().contains("intellectualsites")) {
|
||||||
WEManager.IMP.managers.add(new com.fastasyncworldedit.bukkit.regions.plotsquaredv4.PlotSquaredFeature());
|
WEManager.IMP.managers.add(new com.fastasyncworldedit.bukkit.regions.plotsquaredv4.PlotSquaredFeature());
|
||||||
LOGGER.info("Plugin 'PlotSquared' found. Using it now.");
|
LOGGER.info("Plugin 'PlotSquared' found. Using it now.");
|
||||||
} else if (PlotSquared.get().getVersion().version[0] == 6){
|
} else if (PlotSquared.get().getVersion().version[0] == 6) {
|
||||||
WEManager.IMP.managers.add(new com.fastasyncworldedit.bukkit.regions.plotsquared.PlotSquaredFeature());
|
WEManager.IMP.managers.add(new com.fastasyncworldedit.bukkit.regions.plotsquared.PlotSquaredFeature());
|
||||||
LOGGER.info("Plugin 'PlotSquared' found. Using it now.");
|
LOGGER.info("Plugin 'PlotSquared' found. Using it now.");
|
||||||
} else {
|
} else {
|
||||||
LOGGER.error("Incompatible version of PlotSquared found. Please use PlotSquared v6.");
|
LOGGER.error("Incompatible version of PlotSquared found. Please use PlotSquared v6.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.fastasyncworldedit.bukkit.adapter;
|
package com.fastasyncworldedit.bukkit.adapter;
|
||||||
|
|
||||||
import co.aikar.timings.Timings;
|
import co.aikar.timings.Timings;
|
||||||
import com.fastasyncworldedit.core.queue.implementation.QueueHandler;
|
|
||||||
import com.fastasyncworldedit.bukkit.listener.ChunkListener;
|
import com.fastasyncworldedit.bukkit.listener.ChunkListener;
|
||||||
|
import com.fastasyncworldedit.core.queue.implementation.QueueHandler;
|
||||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.spigotmc.AsyncCatcher;
|
import org.spigotmc.AsyncCatcher;
|
||||||
@ -17,6 +17,7 @@ public class BukkitQueueHandler extends QueueHandler {
|
|||||||
private static boolean alertTimingsChange = true;
|
private static boolean alertTimingsChange = true;
|
||||||
|
|
||||||
private static Method methodCheck;
|
private static Method methodCheck;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
methodCheck = Class.forName("co.aikar.timings.TimingsManager").getDeclaredMethod("recheckEnabled");
|
methodCheck = Class.forName("co.aikar.timings.TimingsManager").getDeclaredMethod("recheckEnabled");
|
||||||
@ -61,4 +62,5 @@ public class BukkitQueueHandler extends QueueHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import java.util.List;
|
|||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public abstract class CachedBukkitAdapter implements IBukkitAdapter {
|
public abstract class CachedBukkitAdapter implements IBukkitAdapter {
|
||||||
|
|
||||||
private int[] itemTypes;
|
private int[] itemTypes;
|
||||||
private int[] blockTypes;
|
private int[] blockTypes;
|
||||||
|
|
||||||
@ -98,4 +99,5 @@ public abstract class CachedBukkitAdapter implements IBukkitAdapter {
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
package com.fastasyncworldedit.bukkit.adapter;
|
package com.fastasyncworldedit.bukkit.adapter;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.concurrent.locks.Condition;
|
import java.util.concurrent.locks.Condition;
|
||||||
import java.util.concurrent.locks.Lock;
|
import java.util.concurrent.locks.Lock;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
public class DelegateLock extends ReentrantLockWithGetOwner {
|
public class DelegateLock extends ReentrantLockWithGetOwner {
|
||||||
|
|
||||||
private final ReentrantLock parent;
|
private final ReentrantLock parent;
|
||||||
private volatile boolean modified;
|
private volatile boolean modified;
|
||||||
private final AtomicInteger count;
|
private final AtomicInteger count;
|
||||||
@ -106,4 +107,5 @@ public class DelegateLock extends ReentrantLockWithGetOwner {
|
|||||||
public synchronized String toString() {
|
public synchronized String toString() {
|
||||||
return parent.toString();
|
return parent.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.fastasyncworldedit.bukkit.adapter;
|
|||||||
import java.util.concurrent.Semaphore;
|
import java.util.concurrent.Semaphore;
|
||||||
|
|
||||||
public class DelegateSemaphore extends Semaphore {
|
public class DelegateSemaphore extends Semaphore {
|
||||||
|
|
||||||
private final Semaphore delegate;
|
private final Semaphore delegate;
|
||||||
|
|
||||||
public DelegateSemaphore(int permits, Semaphore delegate) {
|
public DelegateSemaphore(int permits, Semaphore delegate) {
|
||||||
@ -30,4 +31,5 @@ public class DelegateSemaphore extends Semaphore {
|
|||||||
public synchronized void release() {
|
public synchronized void release() {
|
||||||
this.delegate.release();
|
this.delegate.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
package com.fastasyncworldedit.bukkit.adapter;
|
package com.fastasyncworldedit.bukkit.adapter;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import com.fastasyncworldedit.bukkit.util.BukkitItemStack;
|
||||||
|
|
||||||
import com.sk89q.worldedit.NotABlockException;
|
import com.sk89q.worldedit.NotABlockException;
|
||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitEntity;
|
import com.sk89q.worldedit.bukkit.BukkitEntity;
|
||||||
import com.fastasyncworldedit.bukkit.util.BukkitItemStack;
|
|
||||||
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
@ -25,8 +23,6 @@ import com.sk89q.worldedit.world.entity.EntityTypes;
|
|||||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||||
import com.sk89q.worldedit.world.item.ItemType;
|
import com.sk89q.worldedit.world.item.ItemType;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -35,6 +31,10 @@ import org.bukkit.block.data.BlockData;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public interface IBukkitAdapter {
|
public interface IBukkitAdapter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,7 +81,7 @@ public interface IBukkitAdapter {
|
|||||||
/**
|
/**
|
||||||
* Create a Bukkit location from a WorldEdit position with a Bukkit world.
|
* Create a Bukkit location from a WorldEdit position with a Bukkit world.
|
||||||
*
|
*
|
||||||
* @param world the Bukkit world
|
* @param world the Bukkit world
|
||||||
* @param position the WorldEdit position
|
* @param position the WorldEdit position
|
||||||
* @return a Bukkit location
|
* @return a Bukkit location
|
||||||
*/
|
*/
|
||||||
@ -90,7 +90,8 @@ public interface IBukkitAdapter {
|
|||||||
checkNotNull(position);
|
checkNotNull(position);
|
||||||
return new org.bukkit.Location(
|
return new org.bukkit.Location(
|
||||||
world,
|
world,
|
||||||
position.getX(), position.getY(), position.getZ());
|
position.getX(), position.getY(), position.getZ()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
default org.bukkit.Location adapt(org.bukkit.World world, BlockVector3 position) {
|
default org.bukkit.Location adapt(org.bukkit.World world, BlockVector3 position) {
|
||||||
@ -100,7 +101,7 @@ public interface IBukkitAdapter {
|
|||||||
/**
|
/**
|
||||||
* Create a Bukkit location from a WorldEdit location with a Bukkit world.
|
* Create a Bukkit location from a WorldEdit location with a Bukkit world.
|
||||||
*
|
*
|
||||||
* @param world the Bukkit world
|
* @param world the Bukkit world
|
||||||
* @param location the WorldEdit location
|
* @param location the WorldEdit location
|
||||||
* @return a Bukkit location
|
* @return a Bukkit location
|
||||||
*/
|
*/
|
||||||
@ -111,7 +112,8 @@ public interface IBukkitAdapter {
|
|||||||
world,
|
world,
|
||||||
location.getX(), location.getY(), location.getZ(),
|
location.getX(), location.getY(), location.getZ(),
|
||||||
location.getYaw(),
|
location.getYaw(),
|
||||||
location.getPitch());
|
location.getPitch()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -192,7 +194,7 @@ public interface IBukkitAdapter {
|
|||||||
default BlockType asBlockType(Material material) {
|
default BlockType asBlockType(Material material) {
|
||||||
checkNotNull(material);
|
checkNotNull(material);
|
||||||
if (!material.isBlock()) {
|
if (!material.isBlock()) {
|
||||||
throw new IllegalArgumentException(material.getKey().toString() + " is not a block!") {
|
throw new IllegalArgumentException(material.getKey() + " is not a block!") {
|
||||||
@Override
|
@Override
|
||||||
public synchronized Throwable fillInStackTrace() {
|
public synchronized Throwable fillInStackTrace() {
|
||||||
return this;
|
return this;
|
||||||
@ -203,7 +205,6 @@ public interface IBukkitAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a Material to a ItemType
|
* Converts a Material to a ItemType
|
||||||
*
|
*
|
||||||
@ -269,6 +270,7 @@ public interface IBukkitAdapter {
|
|||||||
default BukkitPlayer adapt(Player player) {
|
default BukkitPlayer adapt(Player player) {
|
||||||
return WorldEditPlugin.getInstance().wrapPlayer(player);
|
return WorldEditPlugin.getInstance().wrapPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Bukkit Player from a WorldEdit Player.
|
* Create a Bukkit Player from a WorldEdit Player.
|
||||||
*
|
*
|
||||||
@ -298,7 +300,7 @@ public interface IBukkitAdapter {
|
|||||||
* Checks equality between a WorldEdit BlockType and a Bukkit Material
|
* Checks equality between a WorldEdit BlockType and a Bukkit Material
|
||||||
*
|
*
|
||||||
* @param blockType The WorldEdit BlockType
|
* @param blockType The WorldEdit BlockType
|
||||||
* @param type The Bukkit Material
|
* @param type The Bukkit Material
|
||||||
* @return If they are equal
|
* @return If they are equal
|
||||||
*/
|
*/
|
||||||
default boolean equals(BlockType blockType, Material type) {
|
default boolean equals(BlockType blockType, Material type) {
|
||||||
@ -351,4 +353,5 @@ public interface IBukkitAdapter {
|
|||||||
throw new NotABlockException();
|
throw new NotABlockException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.registry.state.Property;
|
import com.sk89q.worldedit.registry.state.Property;
|
||||||
import com.sk89q.worldedit.util.Direction;
|
import com.sk89q.worldedit.util.Direction;
|
||||||
|
import com.sk89q.worldedit.util.nbt.CompoundBinaryTag;
|
||||||
import com.sk89q.worldedit.world.DataFixer;
|
import com.sk89q.worldedit.world.DataFixer;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
@ -21,7 +22,6 @@ import com.sk89q.worldedit.world.block.BlockType;
|
|||||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||||
import com.sk89q.worldedit.world.item.ItemType;
|
import com.sk89q.worldedit.world.item.ItemType;
|
||||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||||
import com.sk89q.worldedit.util.nbt.CompoundBinaryTag;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -38,6 +38,7 @@ import java.util.Map;
|
|||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
|
|
||||||
public interface IDelegateBukkitImplAdapter<T> extends BukkitImplAdapter<T> {
|
public interface IDelegateBukkitImplAdapter<T> extends BukkitImplAdapter<T> {
|
||||||
|
|
||||||
BukkitImplAdapter<T> getParent();
|
BukkitImplAdapter<T> getParent();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -262,4 +263,5 @@ public interface IDelegateBukkitImplAdapter<T> extends BukkitImplAdapter<T> {
|
|||||||
default BlockState asBlockState(ItemStack itemStack) {
|
default BlockState asBlockState(ItemStack itemStack) {
|
||||||
return getParent().asBlockState(itemStack);
|
return getParent().asBlockState(itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public abstract class MapChunkUtil<T> {
|
public abstract class MapChunkUtil<T> {
|
||||||
|
|
||||||
protected Field fieldX;
|
protected Field fieldX;
|
||||||
protected Field fieldZ;
|
protected Field fieldZ;
|
||||||
protected Field fieldHeightMap;
|
protected Field fieldHeightMap;
|
||||||
@ -50,4 +51,5 @@ public abstract class MapChunkUtil<T> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package com.fastasyncworldedit.bukkit.adapter;
|
package com.fastasyncworldedit.bukkit.adapter;
|
||||||
|
|
||||||
import com.fastasyncworldedit.core.FAWEPlatformAdapterImpl;
|
import com.fastasyncworldedit.core.FAWEPlatformAdapterImpl;
|
||||||
import com.fastasyncworldedit.core.queue.IChunkGet;
|
|
||||||
import com.fastasyncworldedit.core.configuration.Settings;
|
import com.fastasyncworldedit.core.configuration.Settings;
|
||||||
|
import com.fastasyncworldedit.core.queue.IChunkGet;
|
||||||
|
import com.fastasyncworldedit.core.world.block.BlockID;
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.fastasyncworldedit.core.world.block.BlockID;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||||
|
|
||||||
@ -13,8 +13,11 @@ import java.util.Map;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
public class NMSAdapter implements FAWEPlatformAdapterImpl {
|
public class NMSAdapter implements FAWEPlatformAdapterImpl {
|
||||||
public static int createPalette(int[] blockToPalette, int[] paletteToBlock, int[] blocksCopy,
|
|
||||||
int[] num_palette_buffer, char[] set, Map<BlockVector3, Integer> ticking_blocks, boolean fastmode) {
|
public static int createPalette(
|
||||||
|
int[] blockToPalette, int[] paletteToBlock, int[] blocksCopy,
|
||||||
|
int[] num_palette_buffer, char[] set, Map<BlockVector3, Integer> ticking_blocks, boolean fastmode
|
||||||
|
) {
|
||||||
int air = 0;
|
int air = 0;
|
||||||
int num_palette = 0;
|
int num_palette = 0;
|
||||||
char lastOrdinal = BlockID.__RESERVED__;
|
char lastOrdinal = BlockID.__RESERVED__;
|
||||||
@ -43,9 +46,11 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl {
|
|||||||
if (ticking) {
|
if (ticking) {
|
||||||
BlockState state = BlockState.getFromOrdinal(ordinal);
|
BlockState state = BlockState.getFromOrdinal(ordinal);
|
||||||
ticking_blocks
|
ticking_blocks
|
||||||
.put(BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
|
.put(
|
||||||
WorldEditPlugin.getInstance().getBukkitImplAdapter()
|
BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
|
||||||
.getInternalBlockStateId(state).orElse(0));
|
WorldEditPlugin.getInstance().getBukkitImplAdapter()
|
||||||
|
.getInternalBlockStateId(state).orElse(0)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,9 +66,11 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl {
|
|||||||
return air;
|
return air;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int createPalette(int layer, int[] blockToPalette, int[] paletteToBlock,
|
public static int createPalette(
|
||||||
int[] blocksCopy, int[] num_palette_buffer, Function<Integer, char[]> get, char[] set,
|
int layer, int[] blockToPalette, int[] paletteToBlock,
|
||||||
Map<BlockVector3, Integer> ticking_blocks, boolean fastmode) {
|
int[] blocksCopy, int[] num_palette_buffer, Function<Integer, char[]> get, char[] set,
|
||||||
|
Map<BlockVector3, Integer> ticking_blocks, boolean fastmode
|
||||||
|
) {
|
||||||
int air = 0;
|
int air = 0;
|
||||||
int num_palette = 0;
|
int num_palette = 0;
|
||||||
char[] getArr = null;
|
char[] getArr = null;
|
||||||
@ -100,9 +107,11 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl {
|
|||||||
if (ticking) {
|
if (ticking) {
|
||||||
BlockState state = BlockState.getFromOrdinal(ordinal);
|
BlockState state = BlockState.getFromOrdinal(ordinal);
|
||||||
ticking_blocks
|
ticking_blocks
|
||||||
.put(BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
|
.put(
|
||||||
WorldEditPlugin.getInstance().getBukkitImplAdapter()
|
BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
|
||||||
.getInternalBlockStateId(state).orElse(0));
|
WorldEditPlugin.getInstance().getBukkitImplAdapter()
|
||||||
|
.getInternalBlockStateId(state).orElse(0)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,9 +135,11 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl {
|
|||||||
}
|
}
|
||||||
if (ticking) {
|
if (ticking) {
|
||||||
BlockState state = BlockState.getFromOrdinal(ordinal);
|
BlockState state = BlockState.getFromOrdinal(ordinal);
|
||||||
ticking_blocks.put(BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
|
ticking_blocks.put(
|
||||||
WorldEditPlugin.getInstance().getBukkitImplAdapter()
|
BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
|
||||||
.getInternalBlockStateId(state).orElse(0));
|
WorldEditPlugin.getInstance().getBukkitImplAdapter()
|
||||||
|
.getInternalBlockStateId(state).orElse(0)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int palette = blockToPalette[ordinal];
|
int palette = blockToPalette[ordinal];
|
||||||
@ -192,4 +203,5 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl {
|
|||||||
}
|
}
|
||||||
((BukkitGetBlocks) chunk).send(mask, lighting);
|
((BukkitGetBlocks) chunk).send(mask, lighting);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,25 @@
|
|||||||
package com.fastasyncworldedit.bukkit.adapter;
|
package com.fastasyncworldedit.bukkit.adapter;
|
||||||
|
|
||||||
import com.fastasyncworldedit.core.queue.IQueueChunk;
|
import com.fastasyncworldedit.core.configuration.Settings;
|
||||||
import com.fastasyncworldedit.core.queue.IQueueExtent;
|
|
||||||
import com.fastasyncworldedit.core.extent.processor.lighting.NMSRelighter;
|
import com.fastasyncworldedit.core.extent.processor.lighting.NMSRelighter;
|
||||||
|
import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode;
|
||||||
import com.fastasyncworldedit.core.extent.processor.lighting.Relighter;
|
import com.fastasyncworldedit.core.extent.processor.lighting.Relighter;
|
||||||
import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory;
|
import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory;
|
||||||
import com.fastasyncworldedit.core.configuration.Settings;
|
import com.fastasyncworldedit.core.queue.IQueueChunk;
|
||||||
import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode;
|
import com.fastasyncworldedit.core.queue.IQueueExtent;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class NMSRelighterFactory implements RelighterFactory {
|
public class NMSRelighterFactory implements RelighterFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nonnull Relighter createRelighter(RelightMode relightMode, World world, IQueueExtent<IQueueChunk> queue) {
|
public @Nonnull
|
||||||
return new NMSRelighter(queue,
|
Relighter createRelighter(RelightMode relightMode, World world, IQueueExtent<IQueueChunk> queue) {
|
||||||
relightMode != null ? relightMode : RelightMode.valueOf(Settings.IMP.LIGHTING.MODE));
|
return new NMSRelighter(
|
||||||
|
queue,
|
||||||
|
relightMode != null ? relightMode : RelightMode.valueOf(Settings.IMP.LIGHTING.MODE)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,4 +8,5 @@ public class ReentrantLockWithGetOwner extends ReentrantLock {
|
|||||||
public Thread getOwner() {
|
public Thread getOwner() {
|
||||||
return super.getOwner();
|
return super.getOwner();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.fastasyncworldedit.bukkit.adapter;
|
package com.fastasyncworldedit.bukkit.adapter;
|
||||||
|
|
||||||
|
import com.fastasyncworldedit.core.configuration.Settings;
|
||||||
import com.fastasyncworldedit.core.queue.IChunkCache;
|
import com.fastasyncworldedit.core.queue.IChunkCache;
|
||||||
import com.fastasyncworldedit.core.queue.IChunkGet;
|
import com.fastasyncworldedit.core.queue.IChunkGet;
|
||||||
import com.fastasyncworldedit.core.queue.implementation.SingleThreadQueueExtent;
|
import com.fastasyncworldedit.core.queue.implementation.SingleThreadQueueExtent;
|
||||||
import com.fastasyncworldedit.core.configuration.Settings;
|
|
||||||
import com.fastasyncworldedit.core.util.MathMan;
|
import com.fastasyncworldedit.core.util.MathMan;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||||
@ -16,6 +16,9 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
|||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.bukkit.generator.BlockPopulator;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@ -30,20 +33,18 @@ import java.util.concurrent.Executors;
|
|||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.bukkit.generator.BlockPopulator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an abstract regeneration handler.
|
* Represents an abstract regeneration handler.
|
||||||
|
*
|
||||||
* @param <IChunkAccess> the type of the {@Code IChunkAccess} of the current Minecraft implementation
|
* @param <IChunkAccess> the type of the {@Code IChunkAccess} of the current Minecraft implementation
|
||||||
* @param <ProtoChunk> the type of the {@Code ProtoChunk} of the current Minecraft implementation
|
* @param <ProtoChunk> the type of the {@Code ProtoChunk} of the current Minecraft implementation
|
||||||
* @param <Chunk> the type of the {@Code Chunk} of the current Minecraft implementation
|
* @param <Chunk> the type of the {@Code Chunk} of the current Minecraft implementation
|
||||||
* @param <ChunkStatus> the type of the {@Code ChunkStatusWrapper} wrapping the {@Code ChunkStatus} enum
|
* @param <ChunkStatus> the type of the {@Code ChunkStatusWrapper} wrapping the {@Code ChunkStatus} enum
|
||||||
*/
|
*/
|
||||||
public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess, Chunk extends IChunkAccess, ChunkStatus extends Regenerator.ChunkStatusWrapper<IChunkAccess>> {
|
public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess, Chunk extends IChunkAccess, ChunkStatus extends Regenerator.ChunkStatusWrapper<IChunkAccess>> {
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||||
|
|
||||||
protected final org.bukkit.World originalBukkitWorld;
|
protected final org.bukkit.World originalBukkitWorld;
|
||||||
protected final Region region;
|
protected final Region region;
|
||||||
protected final Extent target;
|
protected final Extent target;
|
||||||
@ -53,7 +54,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
protected final Map<ChunkStatus, Concurrency> chunkStati = new LinkedHashMap<>();
|
protected final Map<ChunkStatus, Concurrency> chunkStati = new LinkedHashMap<>();
|
||||||
protected boolean generateConcurrent = true;
|
protected boolean generateConcurrent = true;
|
||||||
protected long seed;
|
protected long seed;
|
||||||
|
|
||||||
private final Long2ObjectLinkedOpenHashMap<ProtoChunk> protoChunks = new Long2ObjectLinkedOpenHashMap<>();
|
private final Long2ObjectLinkedOpenHashMap<ProtoChunk> protoChunks = new Long2ObjectLinkedOpenHashMap<>();
|
||||||
private final Long2ObjectOpenHashMap<Chunk> chunks = new Long2ObjectOpenHashMap<>();
|
private final Long2ObjectOpenHashMap<Chunk> chunks = new Long2ObjectOpenHashMap<>();
|
||||||
private ExecutorService executor;
|
private ExecutorService executor;
|
||||||
@ -61,10 +62,11 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes an abstract regeneration handler.
|
* Initializes an abstract regeneration handler.
|
||||||
|
*
|
||||||
* @param originalBukkitWorld the Bukkit world containing all the information on how to regenerate the {code Region}
|
* @param originalBukkitWorld the Bukkit world containing all the information on how to regenerate the {code Region}
|
||||||
* @param region the selection to regenerate
|
* @param region the selection to regenerate
|
||||||
* @param target the target {@code Extent} to paste the regenerated blocks into
|
* @param target the target {@code Extent} to paste the regenerated blocks into
|
||||||
* @param options the options to used while regenerating and pasting into the target {@code Extent}
|
* @param options the options to used while regenerating and pasting into the target {@code Extent}
|
||||||
*/
|
*/
|
||||||
public Regenerator(org.bukkit.World originalBukkitWorld, Region region, Extent target, RegenOptions options) {
|
public Regenerator(org.bukkit.World originalBukkitWorld, Region region, Extent target, RegenOptions options) {
|
||||||
this.originalBukkitWorld = originalBukkitWorld;
|
this.originalBukkitWorld = originalBukkitWorld;
|
||||||
@ -75,6 +77,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Regenerates the selected {@code Region}.
|
* Regenerates the selected {@code Region}.
|
||||||
|
*
|
||||||
* @return whether or not the regeneration process was successful
|
* @return whether or not the regeneration process was successful
|
||||||
* @throws Exception when something goes terribly wrong
|
* @throws Exception when something goes terribly wrong
|
||||||
*/
|
*/
|
||||||
@ -116,6 +119,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@code ProtoChunk} at the given chunk coordinates.
|
* Returns the {@code ProtoChunk} at the given chunk coordinates.
|
||||||
|
*
|
||||||
* @param x the chunk x coordinate
|
* @param x the chunk x coordinate
|
||||||
* @param z the chunk z coordinate
|
* @param z the chunk z coordinate
|
||||||
* @return the {@code ProtoChunk} at the given chunk coordinates or null if it is not part of the regeneration process or has not been initialized yet.
|
* @return the {@code ProtoChunk} at the given chunk coordinates or null if it is not part of the regeneration process or has not been initialized yet.
|
||||||
@ -126,6 +130,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@code Chunk} at the given chunk coordinates.
|
* Returns the {@code Chunk} at the given chunk coordinates.
|
||||||
|
*
|
||||||
* @param x the chunk x coordinate
|
* @param x the chunk x coordinate
|
||||||
* @param z the chunk z coordinate
|
* @param z the chunk z coordinate
|
||||||
* @return the {@code Chunk} at the given chunk coordinates or null if it is not part of the regeneration process or has not been converted yet.
|
* @return the {@code Chunk} at the given chunk coordinates or null if it is not part of the regeneration process or has not been converted yet.
|
||||||
@ -142,12 +147,13 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
|
|
||||||
//TODO: can we get that required radius down without affecting chunk generation (e.g. strucures, features, ...)?
|
//TODO: can we get that required radius down without affecting chunk generation (e.g. strucures, features, ...)?
|
||||||
//for now it is working well and fast, if we are bored in the future we could do the research (a lot of it) to reduce the border radius
|
//for now it is working well and fast, if we are bored in the future we could do the research (a lot of it) to reduce the border radius
|
||||||
|
|
||||||
//generate chunk coords lists with a certain radius
|
//generate chunk coords lists with a certain radius
|
||||||
Int2ObjectOpenHashMap<List<Long>> chunkCoordsForRadius = new Int2ObjectOpenHashMap<>();
|
Int2ObjectOpenHashMap<List<Long>> chunkCoordsForRadius = new Int2ObjectOpenHashMap<>();
|
||||||
chunkStati.keySet().stream().map(ChunkStatusWrapper::requiredNeigborChunkRadius0).distinct().forEach(radius -> {
|
chunkStati.keySet().stream().map(ChunkStatusWrapper::requiredNeigborChunkRadius0).distinct().forEach(radius -> {
|
||||||
if (radius == -1) //ignore ChunkStatus.EMPTY
|
if (radius == -1) { //ignore ChunkStatus.EMPTY
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
int border = 16 - radius; //9 = 8 + 1, 8: max border radius used in chunk stages, 1: need 1 extra chunk for chunk features to generate at the border of the region
|
int border = 16 - radius; //9 = 8 + 1, 8: max border radius used in chunk stages, 1: need 1 extra chunk for chunk features to generate at the border of the region
|
||||||
chunkCoordsForRadius.put(radius, getChunkCoordsRegen(region, border));
|
chunkCoordsForRadius.put(radius, getChunkCoordsRegen(region, border));
|
||||||
});
|
});
|
||||||
@ -161,8 +167,9 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
//generate lists for RegionLimitedWorldAccess, need to be square with odd length (e.g. 17x17), 17 = 1 middle chunk + 8 border chunks * 2
|
//generate lists for RegionLimitedWorldAccess, need to be square with odd length (e.g. 17x17), 17 = 1 middle chunk + 8 border chunks * 2
|
||||||
Int2ObjectOpenHashMap<Long2ObjectOpenHashMap<List<IChunkAccess>>> worldlimits = new Int2ObjectOpenHashMap<>();
|
Int2ObjectOpenHashMap<Long2ObjectOpenHashMap<List<IChunkAccess>>> worldlimits = new Int2ObjectOpenHashMap<>();
|
||||||
chunkStati.keySet().stream().map(ChunkStatusWrapper::requiredNeigborChunkRadius0).distinct().forEach(radius -> {
|
chunkStati.keySet().stream().map(ChunkStatusWrapper::requiredNeigborChunkRadius0).distinct().forEach(radius -> {
|
||||||
if (radius == -1) //ignore ChunkStatus.EMPTY
|
if (radius == -1) { //ignore ChunkStatus.EMPTY
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
Long2ObjectOpenHashMap<List<IChunkAccess>> map = new Long2ObjectOpenHashMap<>();
|
Long2ObjectOpenHashMap<List<IChunkAccess>> map = new Long2ObjectOpenHashMap<>();
|
||||||
for (Long xz : chunkCoordsForRadius.get(radius)) {
|
for (Long xz : chunkCoordsForRadius.get(radius)) {
|
||||||
int x = MathMan.unpairIntX(xz);
|
int x = MathMan.unpairIntX(xz);
|
||||||
@ -281,19 +288,19 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
// realExtent.setBlockLight(vec, extent.getBrightness(vec));
|
// realExtent.setBlockLight(vec, extent.getBrightness(vec));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//functions to be implemented by sub class
|
||||||
private void cleanup0() {
|
private void cleanup0() {
|
||||||
if (executor != null) {
|
if (executor != null) {
|
||||||
executor.shutdownNow();
|
executor.shutdownNow();
|
||||||
}
|
}
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
//functions to be implemented by sub class
|
|
||||||
/**
|
/**
|
||||||
* <p>Implement the preparation process in here. DO NOT instanciate any variable here that require the cleanup function. This function is for gathering further information before initializing a new
|
* <p>Implement the preparation process in here. DO NOT instanciate any variable here that require the cleanup function. This function is for gathering further information before initializing a new
|
||||||
* world.</p>
|
* world.</p>
|
||||||
*
|
*
|
||||||
* <p>Fields required to be initialized: chunkStati, seed</p>
|
* <p>Fields required to be initialized: chunkStati, seed</p>
|
||||||
* <p>For chunkStati also see {code ChunkStatusWrapper}.</p>
|
* <p>For chunkStati also see {code ChunkStatusWrapper}.</p>
|
||||||
*
|
*
|
||||||
@ -303,20 +310,21 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement the creation of the seperate world in here.
|
* Implement the creation of the seperate world in here.
|
||||||
*
|
* <p>
|
||||||
* Fields required to be initialized: generateConcurrent
|
* Fields required to be initialized: generateConcurrent
|
||||||
*
|
*
|
||||||
* @return true if everything went fine, otherwise false. When false is returned the Regenerator halts the regeneration process and calls the cleanup function.
|
* @return true if everything went fine, otherwise false. When false is returned the Regenerator halts the regeneration process and calls the cleanup function.
|
||||||
* @throws java.lang.Exception When the implementation of this method throws and exception the Regenerator halts the regeneration process and calls the cleanup function.
|
* @throws java.lang.Exception When the implementation of this method throws and exception the Regenerator halts the regeneration process and calls the cleanup function.
|
||||||
*/
|
*/
|
||||||
protected abstract boolean initNewWorld() throws Exception;
|
protected abstract boolean initNewWorld() throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement the cleanup of all the mess that is created during the regeneration process (initNewWorld() and generate()).This function must not throw any exceptions.
|
* Implement the cleanup of all the mess that is created during the regeneration process (initNewWorld() and generate()).This function must not throw any exceptions.
|
||||||
*/
|
*/
|
||||||
protected abstract void cleanup();
|
protected abstract void cleanup();
|
||||||
|
|
||||||
//functions to implement by sub class - regenate related
|
//functions to implement by sub class - regenate related
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement the initialization of a {@code ProtoChunk} here.
|
* Implement the initialization of a {@code ProtoChunk} here.
|
||||||
*
|
*
|
||||||
@ -352,28 +360,39 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
/**
|
/**
|
||||||
* Implement the population of the {@code Chunk} with the given chunk random and {@code BlockPopulator} here.
|
* Implement the population of the {@code Chunk} with the given chunk random and {@code BlockPopulator} here.
|
||||||
*
|
*
|
||||||
* @param chunk the {@code Chunk} to populate
|
* @param chunk the {@code Chunk} to populate
|
||||||
* @param random the chunk random to use for population
|
* @param random the chunk random to use for population
|
||||||
* @param pop the {@code BlockPopulator} to use
|
* @param pop the {@code BlockPopulator} to use
|
||||||
*/
|
*/
|
||||||
protected abstract void populate(Chunk chunk, Random random, BlockPopulator pop);
|
protected abstract void populate(Chunk chunk, Random random, BlockPopulator pop);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement the initialization an {@code IChunkCache<IChunkGet>} here. Use will need the {@code getChunkAt} function
|
* Implement the initialization an {@code IChunkCache<IChunkGet>} here. Use will need the {@code getChunkAt} function
|
||||||
|
*
|
||||||
* @return an initialized {@code IChunkCache<IChunkGet>}
|
* @return an initialized {@code IChunkCache<IChunkGet>}
|
||||||
*/
|
*/
|
||||||
protected abstract IChunkCache<IChunkGet> initSourceQueueCache();
|
protected abstract IChunkCache<IChunkGet> initSourceQueueCache();
|
||||||
|
|
||||||
//algorithms
|
//algorithms
|
||||||
private List<Long> getChunkCoordsRegen(Region region, int border) { //needs to be square num of chunks
|
private List<Long> getChunkCoordsRegen(Region region, int border) { //needs to be square num of chunks
|
||||||
BlockVector3 oldMin = region.getMinimumPoint();
|
BlockVector3 oldMin = region.getMinimumPoint();
|
||||||
BlockVector3 newMin = BlockVector3.at((oldMin.getX() >> 4 << 4) - border * 16, oldMin.getY(), (oldMin.getZ() >> 4 << 4) - border * 16);
|
BlockVector3 newMin = BlockVector3.at(
|
||||||
|
(oldMin.getX() >> 4 << 4) - border * 16,
|
||||||
|
oldMin.getY(),
|
||||||
|
(oldMin.getZ() >> 4 << 4) - border * 16
|
||||||
|
);
|
||||||
BlockVector3 oldMax = region.getMaximumPoint();
|
BlockVector3 oldMax = region.getMaximumPoint();
|
||||||
BlockVector3 newMax = BlockVector3.at((oldMax.getX() >> 4 << 4) + (border + 1) * 16 - 1, oldMax.getY(), (oldMax.getZ() >> 4 << 4) + (border + 1) * 16 - 1);
|
BlockVector3 newMax = BlockVector3.at(
|
||||||
|
(oldMax.getX() >> 4 << 4) + (border + 1) * 16 - 1,
|
||||||
|
oldMax.getY(),
|
||||||
|
(oldMax.getZ() >> 4 << 4) + (border + 1) * 16 - 1
|
||||||
|
);
|
||||||
Region adjustedRegion = new CuboidRegion(newMin, newMax);
|
Region adjustedRegion = new CuboidRegion(newMin, newMax);
|
||||||
return adjustedRegion.getChunks().stream()
|
return adjustedRegion.getChunks().stream()
|
||||||
.map(c -> BlockVector2.at(c.getX(), c.getZ()))
|
.map(c -> BlockVector2.at(c.getX(), c.getZ()))
|
||||||
.sorted(Comparator.<BlockVector2>comparingInt(c -> c.getZ()).thenComparingInt(c -> c.getX())) //needed for RegionLimitedWorldAccess
|
.sorted(Comparator
|
||||||
|
.<BlockVector2>comparingInt(c -> c.getZ())
|
||||||
|
.thenComparingInt(c -> c.getX())) //needed for RegionLimitedWorldAccess
|
||||||
.map(c -> MathMan.pairInt(c.getX(), c.getZ()))
|
.map(c -> MathMan.pairInt(c.getX(), c.getZ()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
@ -381,11 +400,14 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
/**
|
/**
|
||||||
* Creates a list of chunkcoord rows that may be executed concurrently
|
* Creates a list of chunkcoord rows that may be executed concurrently
|
||||||
*
|
*
|
||||||
* @param allcoords the coords that should be sorted into rows, must be sorted by z and x
|
* @param allcoords the coords that should be sorted into rows, must be sorted by z and x
|
||||||
* @param requiredNeighborChunkRadius the radius of neighbor chunks that may not be written to conccurently (ChunkStatus.requiredNeighborRadius)
|
* @param requiredNeighborChunkRadius the radius of neighbor chunks that may not be written to conccurently (ChunkStatus.requiredNeighborRadius)
|
||||||
* @return a list of chunkcoords rows that may be executed concurrently
|
* @return a list of chunkcoords rows that may be executed concurrently
|
||||||
*/
|
*/
|
||||||
private SequentialTasks<ConcurrentTasks<SequentialTasks<Long>>> getChunkStatusTaskRows(List<Long> allcoords, int requiredNeighborChunkRadius) {
|
private SequentialTasks<ConcurrentTasks<SequentialTasks<Long>>> getChunkStatusTaskRows(
|
||||||
|
List<Long> allcoords,
|
||||||
|
int requiredNeighborChunkRadius
|
||||||
|
) {
|
||||||
int requiredneighbors = Math.max(0, requiredNeighborChunkRadius);
|
int requiredneighbors = Math.max(0, requiredNeighborChunkRadius);
|
||||||
|
|
||||||
int minx = allcoords.isEmpty() ? 0 : MathMan.unpairIntX(allcoords.get(0));
|
int minx = allcoords.isEmpty() ? 0 : MathMan.unpairIntX(allcoords.get(0));
|
||||||
@ -413,8 +435,9 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
tasks = new SequentialTasks(numlists);
|
tasks = new SequentialTasks(numlists);
|
||||||
for (int offset = 0; offset < numlists; offset++) {
|
for (int offset = 0; offset < numlists; offset++) {
|
||||||
ConcurrentTasks<SequentialTasks<Long>> para = new ConcurrentTasks((maxz - minz + 1) / numlists + 1);
|
ConcurrentTasks<SequentialTasks<Long>> para = new ConcurrentTasks((maxz - minz + 1) / numlists + 1);
|
||||||
for (int i = 0; minx + i * numlists + offset <= maxx; i++)
|
for (int i = 0; minx + i * numlists + offset <= maxx; i++) {
|
||||||
para.add(byx.get(minx + i * numlists + offset));
|
para.add(byx.get(minx + i * numlists + offset));
|
||||||
|
}
|
||||||
tasks.add(para);
|
tasks.add(para);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -437,8 +460,9 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
tasks = new SequentialTasks(numlists);
|
tasks = new SequentialTasks(numlists);
|
||||||
for (int offset = 0; offset < numlists; offset++) {
|
for (int offset = 0; offset < numlists; offset++) {
|
||||||
ConcurrentTasks<SequentialTasks<Long>> para = new ConcurrentTasks((maxx - minx + 1) / numlists + 1);
|
ConcurrentTasks<SequentialTasks<Long>> para = new ConcurrentTasks((maxx - minx + 1) / numlists + 1);
|
||||||
for (int i = 0; minz + i * numlists + offset <= maxz; i++)
|
for (int i = 0; minz + i * numlists + offset <= maxz; i++) {
|
||||||
para.add(byz.get(minz + i * numlists + offset));
|
para.add(byz.get(minz + i * numlists + offset));
|
||||||
|
}
|
||||||
tasks.add(para);
|
tasks.add(para);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -456,8 +480,10 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//classes
|
//classes
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used to wrap the ChunkStatus of the current Minecraft implementation and as the implementation to execute a chunk generation step.
|
* This class is used to wrap the ChunkStatus of the current Minecraft implementation and as the implementation to execute a chunk generation step.
|
||||||
|
*
|
||||||
* @param <IChunkAccess> the IChunkAccess class of the current Minecraft implementation
|
* @param <IChunkAccess> the IChunkAccess class of the current Minecraft implementation
|
||||||
*/
|
*/
|
||||||
public static abstract class ChunkStatusWrapper<IChunkAccess> {
|
public static abstract class ChunkStatusWrapper<IChunkAccess> {
|
||||||
@ -483,9 +509,9 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
/**
|
/**
|
||||||
* Return the name of the wrapped {@code ChunkStatus}.
|
* Return the name of the wrapped {@code ChunkStatus}.
|
||||||
*
|
*
|
||||||
* @param xz represents the chunk coordinates of the chunk to process as denoted by {@code MathMan}
|
* @param xz represents the chunk coordinates of the chunk to process as denoted by {@code MathMan}
|
||||||
* @param accessibleChunks a list of chunks that will be used during the execution of the wrapped {@code ChunkStatus}.
|
* @param accessibleChunks a list of chunks that will be used during the execution of the wrapped {@code ChunkStatus}.
|
||||||
* This list is order in the correct order required by the {@code ChunkStatus}, unless Mojang suddenly decides to do things differently.
|
* This list is order in the correct order required by the {@code ChunkStatus}, unless Mojang suddenly decides to do things differently.
|
||||||
*/
|
*/
|
||||||
public abstract void processChunk(Long xz, List<IChunkAccess> accessibleChunks);
|
public abstract void processChunk(Long xz, List<IChunkAccess> accessibleChunks);
|
||||||
|
|
||||||
@ -493,9 +519,13 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
try {
|
try {
|
||||||
processChunk(xz, accessibleChunks);
|
processChunk(xz, accessibleChunks);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Error while running " + name() + " on chunk " + MathMan.unpairIntX(xz) + "/" + MathMan.unpairIntY(xz), e);
|
LOGGER.error(
|
||||||
|
"Error while running " + name() + " on chunk " + MathMan.unpairIntX(xz) + "/" + MathMan.unpairIntY(xz),
|
||||||
|
e
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Concurrency {
|
public enum Concurrency {
|
||||||
@ -509,6 +539,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
public SequentialTasks(int expectedsize) {
|
public SequentialTasks(int expectedsize) {
|
||||||
super(expectedsize);
|
super(expectedsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ConcurrentTasks<T> extends Tasks<T> {
|
public static class ConcurrentTasks<T> extends Tasks<T> {
|
||||||
@ -516,6 +547,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
public ConcurrentTasks(int expectedsize) {
|
public ConcurrentTasks(int expectedsize) {
|
||||||
super(expectedsize);
|
super(expectedsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Tasks<T> implements Iterable<T> {
|
public static class Tasks<T> implements Iterable<T> {
|
||||||
@ -537,7 +569,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
public int size() {
|
public int size() {
|
||||||
return tasks.size();
|
return tasks.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<T> iterator() {
|
public Iterator<T> iterator() {
|
||||||
return tasks.iterator();
|
return tasks.iterator();
|
||||||
@ -547,5 +579,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return tasks.toString();
|
return tasks.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.fastasyncworldedit.bukkit.adapter;
|
package com.fastasyncworldedit.bukkit.adapter;
|
||||||
|
|
||||||
import com.fastasyncworldedit.bukkit.adapter.CachedBukkitAdapter;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
@ -11,6 +10,7 @@ import org.bukkit.block.data.BlockData;
|
|||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public class SimpleBukkitAdapter extends CachedBukkitAdapter {
|
public class SimpleBukkitAdapter extends CachedBukkitAdapter {
|
||||||
|
|
||||||
private BlockData[][] blockDataCache;
|
private BlockData[][] blockDataCache;
|
||||||
|
|
||||||
private boolean init() {
|
private boolean init() {
|
||||||
@ -18,7 +18,7 @@ public class SimpleBukkitAdapter extends CachedBukkitAdapter {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.blockDataCache = new BlockData[BlockTypes.size()][];
|
this.blockDataCache = new BlockData[BlockTypes.size()][];
|
||||||
blockDataCache[0] = new BlockData[] {Material.AIR.createBlockData()};
|
blockDataCache[0] = new BlockData[]{Material.AIR.createBlockData()};
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,4 +51,5 @@ public class SimpleBukkitAdapter extends CachedBukkitAdapter {
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@ package com.fastasyncworldedit.bukkit.filter;
|
|||||||
|
|
||||||
import com.fastasyncworldedit.core.regions.filter.CuboidRegionFilter;
|
import com.fastasyncworldedit.core.regions.filter.CuboidRegionFilter;
|
||||||
import com.fastasyncworldedit.core.util.TaskManager;
|
import com.fastasyncworldedit.core.util.TaskManager;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
|
||||||
import com.griefdefender.api.claim.Claim;
|
|
||||||
import com.griefdefender.api.GriefDefender;
|
|
||||||
import com.flowpowered.math.vector.Vector3i;
|
import com.flowpowered.math.vector.Vector3i;
|
||||||
|
import com.griefdefender.api.GriefDefender;
|
||||||
|
import com.griefdefender.api.claim.Claim;
|
||||||
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
@ -15,6 +15,7 @@ import java.util.function.Supplier;
|
|||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public class GriefDefenderFilter extends CuboidRegionFilter {
|
public class GriefDefenderFilter extends CuboidRegionFilter {
|
||||||
|
|
||||||
private final Collection<Claim> claims;
|
private final Collection<Claim> claims;
|
||||||
private final World world;
|
private final World world;
|
||||||
|
|
||||||
@ -37,4 +38,5 @@ public class GriefDefenderFilter extends CuboidRegionFilter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,14 @@ import java.util.function.Supplier;
|
|||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public class GriefPreventionFilter extends CuboidRegionFilter {
|
public class GriefPreventionFilter extends CuboidRegionFilter {
|
||||||
|
|
||||||
private final Collection<Claim> claims;
|
private final Collection<Claim> claims;
|
||||||
private final World world;
|
private final World world;
|
||||||
|
|
||||||
public GriefPreventionFilter(World world) {
|
public GriefPreventionFilter(World world) {
|
||||||
checkNotNull(world);
|
checkNotNull(world);
|
||||||
this.claims = TaskManager.IMP.sync(
|
this.claims = TaskManager.IMP.sync(
|
||||||
(Supplier<Collection<Claim>>) () -> new ArrayDeque<>(GriefPrevention.instance.dataStore.getClaims()));
|
(Supplier<Collection<Claim>>) () -> new ArrayDeque<>(GriefPrevention.instance.dataStore.getClaims()));
|
||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,4 +37,5 @@ public class GriefPreventionFilter extends CuboidRegionFilter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class WorldGuardFilter extends CuboidRegionFilter {
|
|||||||
public void calculateRegions() {
|
public void calculateRegions() {
|
||||||
Fawe.get().getQueueHandler().sync(() -> {
|
Fawe.get().getQueueHandler().sync(() -> {
|
||||||
WorldGuardFilter.this.manager = WorldGuard.getInstance().getPlatform().getRegionContainer().get(
|
WorldGuardFilter.this.manager = WorldGuard.getInstance().getPlatform().getRegionContainer().get(
|
||||||
BukkitAdapter.adapt(world));
|
BukkitAdapter.adapt(world));
|
||||||
for (ProtectedRegion region : manager.getRegions().values()) {
|
for (ProtectedRegion region : manager.getRegions().values()) {
|
||||||
BlockVector3 min = region.getMinimumPoint();
|
BlockVector3 min = region.getMinimumPoint();
|
||||||
BlockVector3 max = region.getMaximumPoint();
|
BlockVector3 max = region.getMaximumPoint();
|
||||||
@ -69,4 +69,5 @@ public class WorldGuardFilter extends CuboidRegionFilter {
|
|||||||
ApplicableRegionSet set = manager.getApplicableRegions(regionRegion);
|
ApplicableRegionSet set = manager.getApplicableRegions(regionRegion);
|
||||||
return set.size() > 0 && !set.getRegions().iterator().next().getId().equals("__global__");
|
return set.size() > 0 && !set.getRegions().iterator().next().getId().equals("__global__");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
public class BrushListener implements Listener {
|
public class BrushListener implements Listener {
|
||||||
|
|
||||||
public BrushListener(Plugin plugin) {
|
public BrushListener(Plugin plugin) {
|
||||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||||
}
|
}
|
||||||
@ -53,7 +54,8 @@ public class BrushListener implements Listener {
|
|||||||
public void onPlayerMove(PlayerMoveEvent event) {
|
public void onPlayerMove(PlayerMoveEvent event) {
|
||||||
Location from = event.getFrom();
|
Location from = event.getFrom();
|
||||||
Location to = event.getTo();
|
Location to = event.getTo();
|
||||||
if ((from.getYaw() != to.getYaw() && from.getPitch() != to.getPitch()) || from.getBlockX() != to.getBlockX() || from.getBlockZ() != to.getBlockZ() || from.getBlockY() != to.getBlockY()) {
|
if ((from.getYaw() != to.getYaw() && from.getPitch() != to.getPitch()) || from.getBlockX() != to.getBlockX() || from.getBlockZ() != to
|
||||||
|
.getBlockZ() || from.getBlockY() != to.getBlockY()) {
|
||||||
Player bukkitPlayer = event.getPlayer();
|
Player bukkitPlayer = event.getPlayer();
|
||||||
com.sk89q.worldedit.entity.Player player = BukkitAdapter.adapt(bukkitPlayer);
|
com.sk89q.worldedit.entity.Player player = BukkitAdapter.adapt(bukkitPlayer);
|
||||||
LocalSession session = player.getSession();
|
LocalSession session = player.getSession();
|
||||||
@ -83,4 +85,5 @@ public class BrushListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.fastasyncworldedit.bukkit.listener;
|
package com.fastasyncworldedit.bukkit.listener;
|
||||||
|
|
||||||
import com.fastasyncworldedit.core.Fawe;
|
|
||||||
import com.fastasyncworldedit.bukkit.FaweBukkit;
|
import com.fastasyncworldedit.bukkit.FaweBukkit;
|
||||||
|
import com.fastasyncworldedit.core.Fawe;
|
||||||
import com.fastasyncworldedit.core.configuration.Settings;
|
import com.fastasyncworldedit.core.configuration.Settings;
|
||||||
import com.fastasyncworldedit.core.util.FaweTimer;
|
import com.fastasyncworldedit.core.util.FaweTimer;
|
||||||
import com.fastasyncworldedit.core.util.MathMan;
|
import com.fastasyncworldedit.core.util.MathMan;
|
||||||
@ -50,8 +50,8 @@ public abstract class ChunkListener implements Listener {
|
|||||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||||
protected int rateLimit = 0;
|
protected int rateLimit = 0;
|
||||||
protected Location lastCancelPos;
|
protected Location lastCancelPos;
|
||||||
private int[] badLimit = new int[]{Settings.IMP.TICK_LIMITER.PHYSICS_MS,
|
private final int[] badLimit = new int[]{Settings.IMP.TICK_LIMITER.PHYSICS_MS,
|
||||||
Settings.IMP.TICK_LIMITER.FALLING, Settings.IMP.TICK_LIMITER.ITEMS};
|
Settings.IMP.TICK_LIMITER.FALLING, Settings.IMP.TICK_LIMITER.ITEMS};
|
||||||
|
|
||||||
public ChunkListener() {
|
public ChunkListener() {
|
||||||
if (Settings.IMP.TICK_LIMITER.ENABLED) {
|
if (Settings.IMP.TICK_LIMITER.ENABLED) {
|
||||||
@ -62,7 +62,7 @@ public abstract class ChunkListener implements Listener {
|
|||||||
Location tmpLoc = lastCancelPos;
|
Location tmpLoc = lastCancelPos;
|
||||||
if (tmpLoc != null) {
|
if (tmpLoc != null) {
|
||||||
LOGGER.debug("[FAWE Tick Limiter] Detected and cancelled physics lag source at "
|
LOGGER.debug("[FAWE Tick Limiter] Detected and cancelled physics lag source at "
|
||||||
+ tmpLoc);
|
+ tmpLoc);
|
||||||
}
|
}
|
||||||
rateLimit--;
|
rateLimit--;
|
||||||
physicsFreeze = false;
|
physicsFreeze = false;
|
||||||
@ -93,7 +93,7 @@ public abstract class ChunkListener implements Listener {
|
|||||||
public static boolean itemFreeze = false;
|
public static boolean itemFreeze = false;
|
||||||
|
|
||||||
protected final Long2ObjectOpenHashMap<Boolean> badChunks = new Long2ObjectOpenHashMap<>();
|
protected final Long2ObjectOpenHashMap<Boolean> badChunks = new Long2ObjectOpenHashMap<>();
|
||||||
private Long2ObjectOpenHashMap<int[]> counter = new Long2ObjectOpenHashMap<>();
|
private final Long2ObjectOpenHashMap<int[]> counter = new Long2ObjectOpenHashMap<>();
|
||||||
private int lastX = Integer.MIN_VALUE;
|
private int lastX = Integer.MIN_VALUE;
|
||||||
private int lastZ = Integer.MIN_VALUE;
|
private int lastZ = Integer.MIN_VALUE;
|
||||||
private int[] lastCount;
|
private int[] lastCount;
|
||||||
@ -248,7 +248,7 @@ public abstract class ChunkListener implements Listener {
|
|||||||
physStart = System.currentTimeMillis();
|
physStart = System.currentTimeMillis();
|
||||||
return;
|
return;
|
||||||
} else if (System.currentTimeMillis() - physStart
|
} else if (System.currentTimeMillis() - physStart
|
||||||
< Settings.IMP.TICK_LIMITER.PHYSICS_MS) {
|
< Settings.IMP.TICK_LIMITER.PHYSICS_MS) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,7 +281,7 @@ public abstract class ChunkListener implements Listener {
|
|||||||
String methodName = elem.getMethodName();
|
String methodName = elem.getMethodName();
|
||||||
// setAir | setTypeAndData (hacky, but this needs to be efficient)
|
// setAir | setTypeAndData (hacky, but this needs to be efficient)
|
||||||
if (methodName.charAt(0) == 's' && methodName.length() == 6
|
if (methodName.charAt(0) == 's' && methodName.length() == 6
|
||||||
|| methodName.length() == 14) {
|
|| methodName.length() == 14) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -370,16 +370,16 @@ public abstract class ChunkListener implements Listener {
|
|||||||
String className = elem.getClassName();
|
String className = elem.getClassName();
|
||||||
int len = className.length();
|
int len = className.length();
|
||||||
if (len > 15 && className.charAt(len - 15) == 'E' && className
|
if (len > 15 && className.charAt(len - 15) == 'E' && className
|
||||||
.endsWith("EntityFireworks")) {
|
.endsWith("EntityFireworks")) {
|
||||||
for (Entity ent : world.getEntities()) {
|
for (Entity ent : world.getEntities()) {
|
||||||
if (ent.getType() == EntityType.FIREWORK) {
|
if (ent.getType() == EntityType.FIREWORK) {
|
||||||
Vector velocity = ent.getVelocity();
|
Vector velocity = ent.getVelocity();
|
||||||
double vertical = Math.abs(velocity.getY());
|
double vertical = Math.abs(velocity.getY());
|
||||||
if (Math.abs(velocity.getX()) > vertical
|
if (Math.abs(velocity.getX()) > vertical
|
||||||
|| Math.abs(velocity.getZ()) > vertical) {
|
|| Math.abs(velocity.getZ()) > vertical) {
|
||||||
LOGGER.warn(
|
LOGGER.warn(
|
||||||
"[FAWE `tick-limiter`] Detected and cancelled rogue FireWork at "
|
"[FAWE `tick-limiter`] Detected and cancelled rogue FireWork at "
|
||||||
+ ent.getLocation());
|
+ ent.getLocation());
|
||||||
ent.remove();
|
ent.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -409,9 +409,10 @@ public abstract class ChunkListener implements Listener {
|
|||||||
if (rateLimit <= 0) {
|
if (rateLimit <= 0) {
|
||||||
rateLimit = 20;
|
rateLimit = 20;
|
||||||
LOGGER.warn(
|
LOGGER.warn(
|
||||||
"[FAWE `tick-limiter`] Detected and cancelled item lag source at " + loc);
|
"[FAWE `tick-limiter`] Detected and cancelled item lag source at " + loc);
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -86,4 +86,5 @@ public class ChunkListener9 extends ChunkListener {
|
|||||||
StackTraceElement[] elems = getElements(ex);
|
StackTraceElement[] elems = getElements(ex);
|
||||||
return elems.length > i ? elems[i] : null;
|
return elems.length > i ? elems[i] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ public class RenderListener implements Listener {
|
|||||||
} else {
|
} else {
|
||||||
int[] val = views.get(uuid);
|
int[] val = views.get(uuid);
|
||||||
if (val == null) {
|
if (val == null) {
|
||||||
val = new int[] {value, (int) Fawe.get().getTimer().getTick()};
|
val = new int[]{value, (int) Fawe.get().getTimer().getTick()};
|
||||||
UUID uid = player.getUniqueId();
|
UUID uid = player.getUniqueId();
|
||||||
views.put(uid, val);
|
views.put(uid, val);
|
||||||
} else {
|
} else {
|
||||||
@ -136,4 +136,5 @@ public class RenderListener implements Listener {
|
|||||||
UUID uid = player.getUniqueId();
|
UUID uid = player.getUniqueId();
|
||||||
views.remove(uid);
|
views.remove(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,9 @@ import org.bukkit.generator.ChunkGenerator;
|
|||||||
import org.bukkit.plugin.PluginBase;
|
import org.bukkit.plugin.PluginBase;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.PluginLoader;
|
import org.bukkit.plugin.PluginLoader;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -25,6 +25,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class PluginPreloader extends PluginBase {
|
public class PluginPreloader extends PluginBase {
|
||||||
|
|
||||||
private World world;
|
private World world;
|
||||||
private Set<BlockVector2> loaded;
|
private Set<BlockVector2> loaded;
|
||||||
private int index;
|
private int index;
|
||||||
@ -79,7 +80,7 @@ public class PluginPreloader extends PluginBase {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Fawe.get().getQueueHandler().syncWhenFree(() -> {
|
Fawe.get().getQueueHandler().syncWhenFree(() -> {
|
||||||
for (; iter.hasNext() && invalidator.get();index++) {
|
for (; iter.hasNext() && invalidator.get(); index++) {
|
||||||
BlockVector2 chunk = iter.next();
|
BlockVector2 chunk = iter.next();
|
||||||
if (!world.isChunkLoaded(chunk.getX(), chunk.getZ())) {
|
if (!world.isChunkLoaded(chunk.getX(), chunk.getZ())) {
|
||||||
world.addPluginChunkTicket(chunk.getX(), chunk.getZ(), this);
|
world.addPluginChunkTicket(chunk.getX(), chunk.getZ(), this);
|
||||||
@ -199,7 +200,13 @@ public class PluginPreloader extends PluginBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public List<String> onTabComplete(@Nonnull CommandSender sender, @Nonnull Command command, @Nonnull String alias, String[] args) {
|
public List<String> onTabComplete(
|
||||||
|
@Nonnull CommandSender sender,
|
||||||
|
@Nonnull Command command,
|
||||||
|
@Nonnull String alias,
|
||||||
|
String[] args
|
||||||
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,4 +12,5 @@ public abstract class BukkitMaskManager extends FaweMaskManager {
|
|||||||
public boolean hasMemberPermission(Permissible player) {
|
public boolean hasMemberPermission(Permissible player) {
|
||||||
return player.hasPermission("fawe." + getKey() + ".member");
|
return player.hasPermission("fawe." + getKey() + ".member");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,9 @@ public class GriefDefenderFeature extends BukkitMaskManager implements Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAllowed(Player player, Claim claim, MaskType type) {
|
public boolean isAllowed(Player player, Claim claim, MaskType type) {
|
||||||
return GriefDefender.getCore().isEnabled(player.getWorld().getUID()) && !claim.isWilderness() && (claim.getOwnerName().equalsIgnoreCase(player.getName()) || claim.getOwnerUniqueId().equals(player.getUniqueId()) ||
|
return GriefDefender.getCore().isEnabled(player.getWorld().getUID()) && !claim.isWilderness() && (claim
|
||||||
|
.getOwnerName()
|
||||||
|
.equalsIgnoreCase(player.getName()) || claim.getOwnerUniqueId().equals(player.getUniqueId()) ||
|
||||||
type == MaskType.MEMBER && claim.getUserTrusts(TrustTypes.BUILDER).contains(player.getUniqueId()));
|
type == MaskType.MEMBER && claim.getUserTrusts(TrustTypes.BUILDER).contains(player.getUniqueId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,8 +43,16 @@ public class GriefDefenderFeature extends BukkitMaskManager implements Listener
|
|||||||
if (!claim.isWilderness()) {
|
if (!claim.isWilderness()) {
|
||||||
if (isAllowed(player, claim, type)) {
|
if (isAllowed(player, claim, type)) {
|
||||||
claim.getGreaterBoundaryCorner().getX();
|
claim.getGreaterBoundaryCorner().getX();
|
||||||
final BlockVector3 pos1 = BlockVector3.at(claim.getLesserBoundaryCorner().getX(), claim.getLesserBoundaryCorner().getY(), claim.getLesserBoundaryCorner().getZ());
|
final BlockVector3 pos1 = BlockVector3.at(
|
||||||
final BlockVector3 pos2 = BlockVector3.at(claim.getGreaterBoundaryCorner().getX(), claim.getGreaterBoundaryCorner().getY(), claim.getGreaterBoundaryCorner().getZ());
|
claim.getLesserBoundaryCorner().getX(),
|
||||||
|
claim.getLesserBoundaryCorner().getY(),
|
||||||
|
claim.getLesserBoundaryCorner().getZ()
|
||||||
|
);
|
||||||
|
final BlockVector3 pos2 = BlockVector3.at(
|
||||||
|
claim.getGreaterBoundaryCorner().getX(),
|
||||||
|
claim.getGreaterBoundaryCorner().getY(),
|
||||||
|
claim.getGreaterBoundaryCorner().getZ()
|
||||||
|
);
|
||||||
return new FaweMask(new CuboidRegion(pos1, pos2)) {
|
return new FaweMask(new CuboidRegion(pos1, pos2)) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -59,4 +69,5 @@ public class GriefDefenderFeature extends BukkitMaskManager implements Listener
|
|||||||
public RegionFilter getFilter(String world) {
|
public RegionFilter getFilter(String world) {
|
||||||
return new GriefDefenderFilter(Bukkit.getWorld(world));
|
return new GriefDefenderFilter(Bukkit.getWorld(world));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,10 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAllowed(Player player, Claim claim, MaskType type) {
|
public boolean isAllowed(Player player, Claim claim, MaskType type) {
|
||||||
return claim != null && (claim.getOwnerName().equalsIgnoreCase(player.getName()) || claim.getOwnerName().equals(player.getUniqueId()) ||
|
return claim != null && (claim.getOwnerName().equalsIgnoreCase(player.getName()) || claim
|
||||||
type == MaskType.MEMBER && claim.allowBuild(player, Material.AIR) == null);
|
.getOwnerName()
|
||||||
|
.equals(player.getUniqueId()) ||
|
||||||
|
type == MaskType.MEMBER && claim.allowBuild(player, Material.AIR) == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -37,8 +39,16 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene
|
|||||||
if (claim != null) {
|
if (claim != null) {
|
||||||
if (isAllowed(player, claim, type)) {
|
if (isAllowed(player, claim, type)) {
|
||||||
claim.getGreaterBoundaryCorner().getBlockX();
|
claim.getGreaterBoundaryCorner().getBlockX();
|
||||||
final BlockVector3 pos1 = BlockVector3.at(claim.getLesserBoundaryCorner().getBlockX(), 0, claim.getLesserBoundaryCorner().getBlockZ());
|
final BlockVector3 pos1 = BlockVector3.at(
|
||||||
final BlockVector3 pos2 = BlockVector3.at(claim.getGreaterBoundaryCorner().getBlockX(), 256, claim.getGreaterBoundaryCorner().getBlockZ());
|
claim.getLesserBoundaryCorner().getBlockX(),
|
||||||
|
0,
|
||||||
|
claim.getLesserBoundaryCorner().getBlockZ()
|
||||||
|
);
|
||||||
|
final BlockVector3 pos2 = BlockVector3.at(
|
||||||
|
claim.getGreaterBoundaryCorner().getBlockX(),
|
||||||
|
256,
|
||||||
|
claim.getGreaterBoundaryCorner().getBlockZ()
|
||||||
|
);
|
||||||
return new FaweMask(new CuboidRegion(pos1, pos2)) {
|
return new FaweMask(new CuboidRegion(pos1, pos2)) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -55,4 +65,5 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene
|
|||||||
public RegionFilter getFilter(String world) {
|
public RegionFilter getFilter(String world) {
|
||||||
return new GriefPreventionFilter(Bukkit.getWorld(world));
|
return new GriefPreventionFilter(Bukkit.getWorld(world));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener {
|
|||||||
|
|
||||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||||
|
|
||||||
private FaweBukkit plugin;
|
private final FaweBukkit plugin;
|
||||||
private Plugin residence;
|
private final Plugin residence;
|
||||||
|
|
||||||
public ResidenceFeature(final Plugin residencePlugin, final FaweBukkit p3) {
|
public ResidenceFeature(final Plugin residencePlugin, final FaweBukkit p3) {
|
||||||
super(residencePlugin.getName());
|
super(residencePlugin.getName());
|
||||||
@ -31,9 +31,11 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener {
|
|||||||
|
|
||||||
public boolean isAllowed(Player player, ClaimedResidence residence, MaskType type) {
|
public boolean isAllowed(Player player, ClaimedResidence residence, MaskType type) {
|
||||||
return residence != null &&
|
return residence != null &&
|
||||||
(residence.getOwner().equals(player.getName()) ||
|
(residence.getOwner().equals(player.getName()) ||
|
||||||
residence.getOwner().equals(player.getUniqueId().toString()) ||
|
residence.getOwner().equals(player.getUniqueId().toString()) ||
|
||||||
type == MaskType.MEMBER && TaskManager.IMP.sync(() -> residence.getPermissions().playerHas(player, "build", false)));
|
type == MaskType.MEMBER && TaskManager.IMP.sync(() -> residence
|
||||||
|
.getPermissions()
|
||||||
|
.playerHas(player, "build", false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -61,4 +63,5 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -83,10 +83,10 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
|
|||||||
if (isMember) {
|
if (isMember) {
|
||||||
final Chunk chunk = location.getChunk();
|
final Chunk chunk = location.getChunk();
|
||||||
final BlockVector3 pos1 = BlockVector3
|
final BlockVector3 pos1 = BlockVector3
|
||||||
.at(chunk.getX() * 16, 0, chunk.getZ() * 16);
|
.at(chunk.getX() * 16, 0, chunk.getZ() * 16);
|
||||||
final BlockVector3 pos2 = BlockVector3.at(
|
final BlockVector3 pos2 = BlockVector3.at(
|
||||||
chunk.getX() * 16 + 15, 156, chunk.getZ() * 16
|
chunk.getX() * 16 + 15, 156, chunk.getZ() * 16
|
||||||
+ 15);
|
+ 15);
|
||||||
return new FaweMask(new CuboidRegion(pos1, pos2)) {
|
return new FaweMask(new CuboidRegion(pos1, pos2)) {
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) {
|
public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) {
|
||||||
@ -98,4 +98,5 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.fastasyncworldedit.bukkit.regions;
|
package com.fastasyncworldedit.bukkit.regions;
|
||||||
|
|
||||||
import com.fastasyncworldedit.bukkit.filter.WorldGuardFilter;
|
import com.fastasyncworldedit.bukkit.filter.WorldGuardFilter;
|
||||||
import com.fastasyncworldedit.core.regions.RegionWrapper;
|
|
||||||
import com.fastasyncworldedit.core.regions.FaweMask;
|
import com.fastasyncworldedit.core.regions.FaweMask;
|
||||||
|
import com.fastasyncworldedit.core.regions.RegionWrapper;
|
||||||
import com.fastasyncworldedit.core.regions.filter.RegionFilter;
|
import com.fastasyncworldedit.core.regions.filter.RegionFilter;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||||
@ -28,9 +28,11 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class WorldGuardFeature extends BukkitMaskManager implements Listener {
|
public class WorldGuardFeature extends BukkitMaskManager implements Listener {
|
||||||
|
|
||||||
private final WorldGuardPlugin worldguard;
|
private final WorldGuardPlugin worldguard;
|
||||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||||
|
|
||||||
@ -67,9 +69,18 @@ public class WorldGuardFeature extends BukkitMaskManager implements Listener {
|
|||||||
if (global != null && isAllowed(player, global)) {
|
if (global != null && isAllowed(player, global)) {
|
||||||
return global;
|
return global;
|
||||||
}
|
}
|
||||||
final ApplicableRegionSet regions = manager.getApplicableRegions(BlockVector3.at(location.getX(), location.getY(), location.getZ()));
|
final ApplicableRegionSet regions = manager.getApplicableRegions(BlockVector3.at(
|
||||||
|
location.getX(),
|
||||||
|
location.getY(),
|
||||||
|
location.getZ()
|
||||||
|
));
|
||||||
//Merge WorldGuardFlag
|
//Merge WorldGuardFlag
|
||||||
if (player.hasPermission("fawe.worldguardflag") && !regions.testState(player, Flags.BUILD, Flags.BLOCK_PLACE, Flags.BLOCK_BREAK)) {
|
if (player.hasPermission("fawe.worldguardflag") && !regions.testState(
|
||||||
|
player,
|
||||||
|
Flags.BUILD,
|
||||||
|
Flags.BLOCK_PLACE,
|
||||||
|
Flags.BLOCK_BREAK
|
||||||
|
)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
for (ProtectedRegion region : regions) {
|
for (ProtectedRegion region : regions) {
|
||||||
@ -117,8 +128,16 @@ public class WorldGuardFeature extends BukkitMaskManager implements Listener {
|
|||||||
pos2 = BlockVector3.at(Integer.MAX_VALUE, 255, Integer.MAX_VALUE);
|
pos2 = BlockVector3.at(Integer.MAX_VALUE, 255, Integer.MAX_VALUE);
|
||||||
} else {
|
} else {
|
||||||
if (myregion instanceof ProtectedCuboidRegion) {
|
if (myregion instanceof ProtectedCuboidRegion) {
|
||||||
pos1 = BlockVector3.at(myregion.getMinimumPoint().getBlockX(), myregion.getMinimumPoint().getBlockY(), myregion.getMinimumPoint().getBlockZ());
|
pos1 = BlockVector3.at(
|
||||||
pos2 = BlockVector3.at(myregion.getMaximumPoint().getBlockX(), myregion.getMaximumPoint().getBlockY(), myregion.getMaximumPoint().getBlockZ());
|
myregion.getMinimumPoint().getBlockX(),
|
||||||
|
myregion.getMinimumPoint().getBlockY(),
|
||||||
|
myregion.getMinimumPoint().getBlockZ()
|
||||||
|
);
|
||||||
|
pos2 = BlockVector3.at(
|
||||||
|
myregion.getMaximumPoint().getBlockX(),
|
||||||
|
myregion.getMaximumPoint().getBlockY(),
|
||||||
|
myregion.getMaximumPoint().getBlockZ()
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return new FaweMask(adapt(myregion)) {
|
return new FaweMask(adapt(myregion)) {
|
||||||
@Override
|
@Override
|
||||||
@ -144,6 +163,7 @@ public class WorldGuardFeature extends BukkitMaskManager implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class AdaptedRegion extends AbstractRegion {
|
private static class AdaptedRegion extends AbstractRegion {
|
||||||
|
|
||||||
private final ProtectedRegion region;
|
private final ProtectedRegion region;
|
||||||
|
|
||||||
public AdaptedRegion(ProtectedRegion region) {
|
public AdaptedRegion(ProtectedRegion region) {
|
||||||
@ -175,6 +195,7 @@ public class WorldGuardFeature extends BukkitMaskManager implements Listener {
|
|||||||
public boolean contains(BlockVector3 position) {
|
public boolean contains(BlockVector3 position) {
|
||||||
return region.contains(position);
|
return region.contains(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Region adapt(ProtectedRegion region) {
|
private static Region adapt(ProtectedRegion region) {
|
||||||
@ -192,4 +213,5 @@ public class WorldGuardFeature extends BukkitMaskManager implements Listener {
|
|||||||
}
|
}
|
||||||
return new AdaptedRegion(region);
|
return new AdaptedRegion(region);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,9 +33,9 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
|||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -46,18 +46,20 @@ import static org.bukkit.Bukkit.getWorld;
|
|||||||
|
|
||||||
public class FaweDelegateRegionManager {
|
public class FaweDelegateRegionManager {
|
||||||
|
|
||||||
public boolean setCuboids(final @NonNull PlotArea area,
|
public boolean setCuboids(
|
||||||
final @NonNull Set<CuboidRegion> regions,
|
final @NonNull PlotArea area,
|
||||||
final @NonNull Pattern blocks,
|
final @NonNull Set<CuboidRegion> regions,
|
||||||
int minY,
|
final @NonNull Pattern blocks,
|
||||||
int maxY,
|
int minY,
|
||||||
Runnable whenDone) {
|
int maxY,
|
||||||
|
Runnable whenDone
|
||||||
|
) {
|
||||||
TaskManager.IMP.async(() -> {
|
TaskManager.IMP.async(() -> {
|
||||||
synchronized (FaweDelegateRegionManager.class) {
|
synchronized (FaweDelegateRegionManager.class) {
|
||||||
World world = BukkitAdapter.adapt(getWorld(area.getWorldName()));
|
World world = BukkitAdapter.adapt(getWorld(area.getWorldName()));
|
||||||
EditSession session =
|
EditSession session =
|
||||||
new EditSessionBuilder(world).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull()
|
new EditSessionBuilder(world).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull()
|
||||||
.autoQueue(false).build();
|
.autoQueue(false).build();
|
||||||
for (CuboidRegion region : regions) {
|
for (CuboidRegion region : regions) {
|
||||||
region.setPos1(region.getPos1().withY(minY));
|
region.setPos1(region.getPos1().withY(minY));
|
||||||
region.setPos2(region.getPos2().withY(maxY));
|
region.setPos2(region.getPos2().withY(maxY));
|
||||||
@ -67,7 +69,8 @@ public class FaweDelegateRegionManager {
|
|||||||
session.flushQueue();
|
session.flushQueue();
|
||||||
for (CuboidRegion region : regions) {
|
for (CuboidRegion region : regions) {
|
||||||
FaweAPI.fixLighting(world, region, null,
|
FaweAPI.fixLighting(world, region, null,
|
||||||
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.IMP.LIGHTING.MODE));
|
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.IMP.LIGHTING.MODE)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (MaxChangedBlocksException e) {
|
} catch (MaxChangedBlocksException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -84,14 +87,22 @@ public class FaweDelegateRegionManager {
|
|||||||
return hpw.getType() != PlotAreaType.AUGMENTED || hpw.getTerrain() == PlotAreaTerrainType.NONE;
|
return hpw.getType() != PlotAreaType.AUGMENTED || hpw.getTerrain() == PlotAreaTerrainType.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean handleClear(@Nonnull Plot plot,
|
public boolean handleClear(
|
||||||
@Nullable Runnable whenDone,
|
@Nonnull Plot plot,
|
||||||
@Nonnull PlotManager manager) {
|
@Nullable Runnable whenDone,
|
||||||
|
@Nonnull PlotManager manager
|
||||||
|
) {
|
||||||
TaskManager.IMP.async(() -> {
|
TaskManager.IMP.async(() -> {
|
||||||
synchronized (FaweDelegateRegionManager.class) {
|
synchronized (FaweDelegateRegionManager.class) {
|
||||||
final HybridPlotWorld hybridPlotWorld = ((HybridPlotManager) manager).getHybridPlotWorld();
|
final HybridPlotWorld hybridPlotWorld = ((HybridPlotManager) manager).getHybridPlotWorld();
|
||||||
World world = BukkitAdapter.adapt(getWorld(hybridPlotWorld.getWorldName()));
|
World world = BukkitAdapter.adapt(getWorld(hybridPlotWorld.getWorldName()));
|
||||||
EditSession editSession = new EditSessionBuilder(world).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
EditSession editSession = new EditSessionBuilder(world)
|
||||||
|
.checkMemory(false)
|
||||||
|
.fastmode(true)
|
||||||
|
.limitUnlimited()
|
||||||
|
.changeSetNull()
|
||||||
|
.autoQueue(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
if (!hybridPlotWorld.PLOT_SCHEMATIC || !Settings.Schematics.PASTE_ON_TOP) {
|
if (!hybridPlotWorld.PLOT_SCHEMATIC || !Settings.Schematics.PASTE_ON_TOP) {
|
||||||
final BlockType bedrock;
|
final BlockType bedrock;
|
||||||
@ -107,12 +118,22 @@ public class FaweDelegateRegionManager {
|
|||||||
final BiomeType biome = hybridPlotWorld.getPlotBiome();
|
final BiomeType biome = hybridPlotWorld.getPlotBiome();
|
||||||
|
|
||||||
BlockVector3 pos1 = plot.getBottomAbs().getBlockVector3().withY(0);
|
BlockVector3 pos1 = plot.getBottomAbs().getBlockVector3().withY(0);
|
||||||
BlockVector3 pos2 = pos1.add(BlockVector3.at(hybridPlotWorld.PLOT_WIDTH - 1, 255, hybridPlotWorld.PLOT_WIDTH - 1));
|
BlockVector3 pos2 = pos1.add(BlockVector3.at(
|
||||||
|
hybridPlotWorld.PLOT_WIDTH - 1,
|
||||||
|
255,
|
||||||
|
hybridPlotWorld.PLOT_WIDTH - 1
|
||||||
|
));
|
||||||
|
|
||||||
Region bedrockRegion = new CuboidRegion(pos1, pos2.withY(0));
|
Region bedrockRegion = new CuboidRegion(pos1, pos2.withY(0));
|
||||||
Region fillingRegion = new CuboidRegion(pos1.withY(1), pos2.withY(hybridPlotWorld.PLOT_HEIGHT - 1));
|
Region fillingRegion = new CuboidRegion(pos1.withY(1), pos2.withY(hybridPlotWorld.PLOT_HEIGHT - 1));
|
||||||
Region floorRegion = new CuboidRegion(pos1.withY(hybridPlotWorld.PLOT_HEIGHT), pos2.withY(hybridPlotWorld.PLOT_HEIGHT));
|
Region floorRegion = new CuboidRegion(
|
||||||
Region airRegion = new CuboidRegion(pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1), pos2.withY(manager.getWorldHeight()));
|
pos1.withY(hybridPlotWorld.PLOT_HEIGHT),
|
||||||
|
pos2.withY(hybridPlotWorld.PLOT_HEIGHT)
|
||||||
|
);
|
||||||
|
Region airRegion = new CuboidRegion(
|
||||||
|
pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1),
|
||||||
|
pos2.withY(manager.getWorldHeight())
|
||||||
|
);
|
||||||
|
|
||||||
editSession.setBlocks(bedrockRegion, bedrock);
|
editSession.setBlocks(bedrockRegion, bedrock);
|
||||||
editSession.setBlocks(fillingRegion, filling);
|
editSession.setBlocks(fillingRegion, filling);
|
||||||
@ -124,14 +145,25 @@ public class FaweDelegateRegionManager {
|
|||||||
if (hybridPlotWorld.PLOT_SCHEMATIC) {
|
if (hybridPlotWorld.PLOT_SCHEMATIC) {
|
||||||
// We cannot reuse the editsession
|
// We cannot reuse the editsession
|
||||||
EditSession scheditsession = !Settings.Schematics.PASTE_ON_TOP ? editSession :
|
EditSession scheditsession = !Settings.Schematics.PASTE_ON_TOP ? editSession :
|
||||||
new EditSessionBuilder(world).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
new EditSessionBuilder(world)
|
||||||
|
.checkMemory(false)
|
||||||
|
.fastmode(true)
|
||||||
|
.limitUnlimited()
|
||||||
|
.changeSetNull()
|
||||||
|
.autoQueue(false)
|
||||||
|
.build();
|
||||||
File schematicFile = new File(hybridPlotWorld.getRoot(), "plot.schem");
|
File schematicFile = new File(hybridPlotWorld.getRoot(), "plot.schem");
|
||||||
if (!schematicFile.exists()) {
|
if (!schematicFile.exists()) {
|
||||||
schematicFile = new File(hybridPlotWorld.getRoot(), "plot.schematic");
|
schematicFile = new File(hybridPlotWorld.getRoot(), "plot.schematic");
|
||||||
}
|
}
|
||||||
BlockVector3 to = plot.getBottomAbs().getBlockVector3().withY(Settings.Schematics.PASTE_ON_TOP ? hybridPlotWorld.SCHEM_Y : 1);
|
BlockVector3 to = plot.getBottomAbs().getBlockVector3().withY(Settings.Schematics.PASTE_ON_TOP
|
||||||
|
? hybridPlotWorld.SCHEM_Y
|
||||||
|
: 1);
|
||||||
try {
|
try {
|
||||||
Clipboard clip = ClipboardFormats.findByFile(schematicFile).getReader(new FileInputStream(schematicFile)).read();
|
Clipboard clip = ClipboardFormats
|
||||||
|
.findByFile(schematicFile)
|
||||||
|
.getReader(new FileInputStream(schematicFile))
|
||||||
|
.read();
|
||||||
clip.paste(scheditsession, to, true, true, true);
|
clip.paste(scheditsession, to, true, true, true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -142,28 +174,49 @@ public class FaweDelegateRegionManager {
|
|||||||
|
|
||||||
// Be verbose in editsession flushing
|
// Be verbose in editsession flushing
|
||||||
editSession.flushQueue();
|
editSession.flushQueue();
|
||||||
FaweAPI.fixLighting(world, new CuboidRegion(plot.getBottomAbs().getBlockVector3(), plot.getTopAbs().getBlockVector3()), null,
|
FaweAPI.fixLighting(
|
||||||
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.IMP.LIGHTING.MODE));
|
world,
|
||||||
|
new CuboidRegion(plot.getBottomAbs().getBlockVector3(), plot.getTopAbs().getBlockVector3()),
|
||||||
|
null,
|
||||||
|
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.IMP.LIGHTING.MODE)
|
||||||
|
);
|
||||||
TaskManager.IMP.task(whenDone);
|
TaskManager.IMP.task(whenDone);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void swap(Location pos1,
|
public void swap(
|
||||||
Location pos2,
|
Location pos1,
|
||||||
Location swapPos,
|
Location pos2,
|
||||||
final Runnable whenDone) {
|
Location swapPos,
|
||||||
|
final Runnable whenDone
|
||||||
|
) {
|
||||||
TaskManager.IMP.async(() -> {
|
TaskManager.IMP.async(() -> {
|
||||||
synchronized (FaweDelegateRegionManager.class) {
|
synchronized (FaweDelegateRegionManager.class) {
|
||||||
//todo because of the following code this should proably be in the Bukkit module
|
//todo because of the following code this should proably be in the Bukkit module
|
||||||
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorldName()));
|
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorldName()));
|
||||||
World pos3World = BukkitAdapter.adapt(getWorld(swapPos.getWorldName()));
|
World pos3World = BukkitAdapter.adapt(getWorld(swapPos.getWorldName()));
|
||||||
WorldEdit.getInstance().getEditSessionFactory().getEditSession(pos1World, -1);
|
WorldEdit.getInstance().getEditSessionFactory().getEditSession(pos1World, -1);
|
||||||
EditSession sessionA = new EditSessionBuilder(pos1World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
EditSession sessionA = new EditSessionBuilder(pos1World)
|
||||||
EditSession sessionB = new EditSessionBuilder(pos3World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
.checkMemory(false)
|
||||||
|
.fastmode(true)
|
||||||
|
.limitUnlimited()
|
||||||
|
.changeSetNull()
|
||||||
|
.autoQueue(false)
|
||||||
|
.build();
|
||||||
|
EditSession sessionB = new EditSessionBuilder(pos3World)
|
||||||
|
.checkMemory(false)
|
||||||
|
.fastmode(true)
|
||||||
|
.limitUnlimited()
|
||||||
|
.changeSetNull()
|
||||||
|
.autoQueue(false)
|
||||||
|
.build();
|
||||||
CuboidRegion regionA = new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3());
|
CuboidRegion regionA = new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3());
|
||||||
CuboidRegion regionB = new CuboidRegion(swapPos.getBlockVector3(), swapPos.getBlockVector3().add(pos2.getBlockVector3()).subtract(pos1.getBlockVector3()));
|
CuboidRegion regionB = new CuboidRegion(
|
||||||
|
swapPos.getBlockVector3(),
|
||||||
|
swapPos.getBlockVector3().add(pos2.getBlockVector3()).subtract(pos1.getBlockVector3())
|
||||||
|
);
|
||||||
regionA.setWorld(pos1World);
|
regionA.setWorld(pos1World);
|
||||||
regionB.setWorld(pos3World);
|
regionB.setWorld(pos3World);
|
||||||
Clipboard clipA = Clipboard.create(regionA, UUID.randomUUID());
|
Clipboard clipA = Clipboard.create(regionA, UUID.randomUUID());
|
||||||
@ -181,10 +234,18 @@ public class FaweDelegateRegionManager {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
FaweAPI.fixLighting(pos1World, new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()), null,
|
FaweAPI.fixLighting(pos1World, new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()), null,
|
||||||
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.IMP.LIGHTING.MODE));
|
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.IMP.LIGHTING.MODE)
|
||||||
FaweAPI.fixLighting(pos1World, new CuboidRegion(swapPos.getBlockVector3(),
|
);
|
||||||
BlockVector3.at(swapPos.getX() + pos2.getX() - pos1.getX(), 0, swapPos.getZ() + pos2.getZ() - pos1.getZ())), null,
|
FaweAPI.fixLighting(pos1World, new CuboidRegion(
|
||||||
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.IMP.LIGHTING.MODE));
|
swapPos.getBlockVector3(),
|
||||||
|
BlockVector3.at(
|
||||||
|
swapPos.getX() + pos2.getX() - pos1.getX(),
|
||||||
|
0,
|
||||||
|
swapPos.getZ() + pos2.getZ() - pos1.getZ()
|
||||||
|
)
|
||||||
|
), null,
|
||||||
|
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.IMP.LIGHTING.MODE)
|
||||||
|
);
|
||||||
TaskManager.IMP.task(whenDone);
|
TaskManager.IMP.task(whenDone);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -195,7 +256,13 @@ public class FaweDelegateRegionManager {
|
|||||||
region.expand(BlockVector3.at(-extendBiome, 0, -extendBiome));
|
region.expand(BlockVector3.at(-extendBiome, 0, -extendBiome));
|
||||||
TaskManager.IMP.async(() -> {
|
TaskManager.IMP.async(() -> {
|
||||||
synchronized (FaweDelegateRegionManager.class) {
|
synchronized (FaweDelegateRegionManager.class) {
|
||||||
EditSession editSession = new EditSessionBuilder(BukkitAdapter.adapt(getWorld(world))).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
EditSession editSession = new EditSessionBuilder(BukkitAdapter.adapt(getWorld(world)))
|
||||||
|
.checkMemory(false)
|
||||||
|
.fastmode(true)
|
||||||
|
.limitUnlimited()
|
||||||
|
.changeSetNull()
|
||||||
|
.autoQueue(false)
|
||||||
|
.build();
|
||||||
FlatRegionFunction replace = new BiomeReplace(editSession, biome);
|
FlatRegionFunction replace = new BiomeReplace(editSession, biome);
|
||||||
FlatRegionVisitor visitor = new FlatRegionVisitor(region, replace);
|
FlatRegionVisitor visitor = new FlatRegionVisitor(region, replace);
|
||||||
try {
|
try {
|
||||||
@ -209,24 +276,50 @@ public class FaweDelegateRegionManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean copyRegion(final @NonNull Location pos1,
|
public boolean copyRegion(
|
||||||
final @NonNull Location pos2,
|
final @NonNull Location pos1,
|
||||||
final @NonNull Location pos3,
|
final @NonNull Location pos2,
|
||||||
final @NonNull Runnable whenDone) {
|
final @NonNull Location pos3,
|
||||||
|
final @NonNull Runnable whenDone
|
||||||
|
) {
|
||||||
TaskManager.IMP.async(() -> {
|
TaskManager.IMP.async(() -> {
|
||||||
synchronized (FaweDelegateRegionManager.class) {
|
synchronized (FaweDelegateRegionManager.class) {
|
||||||
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorldName()));
|
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorldName()));
|
||||||
World pos3World = BukkitAdapter.adapt(getWorld(pos3.getWorldName()));
|
World pos3World = BukkitAdapter.adapt(getWorld(pos3.getWorldName()));
|
||||||
EditSession from = new EditSessionBuilder(pos1World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
EditSession from = new EditSessionBuilder(pos1World)
|
||||||
EditSession to = new EditSessionBuilder(pos3World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
.checkMemory(false)
|
||||||
CuboidRegion region = new CuboidRegion(BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()), BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
|
.fastmode(true)
|
||||||
ForwardExtentCopy copy = new ForwardExtentCopy(from, region, to, BlockVector3.at(pos3.getX(), pos3.getY(), pos3.getZ()));
|
.limitUnlimited()
|
||||||
|
.changeSetNull()
|
||||||
|
.autoQueue(false)
|
||||||
|
.build();
|
||||||
|
EditSession to = new EditSessionBuilder(pos3World)
|
||||||
|
.checkMemory(false)
|
||||||
|
.fastmode(true)
|
||||||
|
.limitUnlimited()
|
||||||
|
.changeSetNull()
|
||||||
|
.autoQueue(false)
|
||||||
|
.build();
|
||||||
|
CuboidRegion region = new CuboidRegion(
|
||||||
|
BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()),
|
||||||
|
BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ())
|
||||||
|
);
|
||||||
|
ForwardExtentCopy copy = new ForwardExtentCopy(
|
||||||
|
from,
|
||||||
|
region,
|
||||||
|
to,
|
||||||
|
BlockVector3.at(pos3.getX(), pos3.getY(), pos3.getZ())
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
Operations.completeLegacy(copy);
|
Operations.completeLegacy(copy);
|
||||||
to.flushQueue();
|
to.flushQueue();
|
||||||
FaweAPI.fixLighting(pos1World,
|
FaweAPI.fixLighting(pos1World,
|
||||||
new CuboidRegion(pos3.getBlockVector3(), pos3.getBlockVector3().add(pos2.getBlockVector3().subtract(pos1.getBlockVector3()))),
|
new CuboidRegion(
|
||||||
null, RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.IMP.LIGHTING.MODE));
|
pos3.getBlockVector3(),
|
||||||
|
pos3.getBlockVector3().add(pos2.getBlockVector3().subtract(pos1.getBlockVector3()))
|
||||||
|
),
|
||||||
|
null, RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.IMP.LIGHTING.MODE)
|
||||||
|
);
|
||||||
} catch (MaxChangedBlocksException e) {
|
} catch (MaxChangedBlocksException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -240,8 +333,17 @@ public class FaweDelegateRegionManager {
|
|||||||
TaskManager.IMP.async(() -> {
|
TaskManager.IMP.async(() -> {
|
||||||
synchronized (FaweDelegateRegionManager.class) {
|
synchronized (FaweDelegateRegionManager.class) {
|
||||||
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorldName()));
|
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorldName()));
|
||||||
try (EditSession editSession = new EditSessionBuilder(pos1World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build()) {
|
try (EditSession editSession = new EditSessionBuilder(pos1World)
|
||||||
CuboidRegion region = new CuboidRegion(BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()), BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
|
.checkMemory(false)
|
||||||
|
.fastmode(true)
|
||||||
|
.limitUnlimited()
|
||||||
|
.changeSetNull()
|
||||||
|
.autoQueue(false)
|
||||||
|
.build()) {
|
||||||
|
CuboidRegion region = new CuboidRegion(
|
||||||
|
BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()),
|
||||||
|
BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ())
|
||||||
|
);
|
||||||
editSession.regenerate(region);
|
editSession.regenerate(region);
|
||||||
editSession.flushQueue();
|
editSession.flushQueue();
|
||||||
}
|
}
|
||||||
@ -250,4 +352,5 @@ public class FaweDelegateRegionManager {
|
|||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,10 @@ package com.fastasyncworldedit.bukkit.regions.plotsquared;
|
|||||||
import com.fastasyncworldedit.core.Fawe;
|
import com.fastasyncworldedit.core.Fawe;
|
||||||
import com.fastasyncworldedit.core.FaweAPI;
|
import com.fastasyncworldedit.core.FaweAPI;
|
||||||
import com.fastasyncworldedit.core.FaweCache;
|
import com.fastasyncworldedit.core.FaweCache;
|
||||||
|
import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicReader;
|
||||||
|
import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicWriter;
|
||||||
|
import com.fastasyncworldedit.core.jnbt.CompressedCompoundTag;
|
||||||
|
import com.fastasyncworldedit.core.jnbt.CompressedSchematicTag;
|
||||||
import com.fastasyncworldedit.core.util.EditSessionBuilder;
|
import com.fastasyncworldedit.core.util.EditSessionBuilder;
|
||||||
import com.fastasyncworldedit.core.util.IOUtil;
|
import com.fastasyncworldedit.core.util.IOUtil;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
@ -15,16 +19,12 @@ import com.plotsquared.core.util.SchematicHandler;
|
|||||||
import com.plotsquared.core.util.task.RunnableVal;
|
import com.plotsquared.core.util.task.RunnableVal;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.fastasyncworldedit.core.jnbt.CompressedCompoundTag;
|
|
||||||
import com.sk89q.jnbt.NBTInputStream;
|
import com.sk89q.jnbt.NBTInputStream;
|
||||||
import com.sk89q.jnbt.NBTOutputStream;
|
import com.sk89q.jnbt.NBTOutputStream;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.fastasyncworldedit.core.jnbt.CompressedSchematicTag;
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
||||||
import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicReader;
|
|
||||||
import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicWriter;
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.MCEditSchematicReader;
|
import com.sk89q.worldedit.extent.clipboard.io.MCEditSchematicReader;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.SpongeSchematicReader;
|
import com.sk89q.worldedit.extent.clipboard.io.SpongeSchematicReader;
|
||||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||||
@ -33,8 +33,8 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
|||||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||||
import org.anarres.parallelgzip.ParallelGZIPOutputStream;
|
import org.anarres.parallelgzip.ParallelGZIPOutputStream;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.EOFException;
|
import java.io.EOFException;
|
||||||
@ -56,13 +56,15 @@ public class FaweDelegateSchematicHandler {
|
|||||||
|
|
||||||
private static final AtomicBoolean exportingAll = new AtomicBoolean();
|
private static final AtomicBoolean exportingAll = new AtomicBoolean();
|
||||||
|
|
||||||
public void paste(final Schematic schematic,
|
public void paste(
|
||||||
final Plot plot,
|
final Schematic schematic,
|
||||||
final int xOffset,
|
final Plot plot,
|
||||||
final int yOffset,
|
final int xOffset,
|
||||||
final int zOffset,
|
final int yOffset,
|
||||||
final boolean autoHeight,
|
final int zOffset,
|
||||||
final RunnableVal<Boolean> whenDone) {
|
final boolean autoHeight,
|
||||||
|
final RunnableVal<Boolean> whenDone
|
||||||
|
) {
|
||||||
Runnable r = () -> {
|
Runnable r = () -> {
|
||||||
if (whenDone != null) {
|
if (whenDone != null) {
|
||||||
whenDone.value = false;
|
whenDone.value = false;
|
||||||
@ -78,8 +80,8 @@ public class FaweDelegateSchematicHandler {
|
|||||||
// Validate dimensions
|
// Validate dimensions
|
||||||
CuboidRegion region = plot.getLargestRegion();
|
CuboidRegion region = plot.getLargestRegion();
|
||||||
if (((region.getMaximumPoint().getX() - region.getMinimumPoint().getX() + xOffset + 1) < WIDTH) || (
|
if (((region.getMaximumPoint().getX() - region.getMinimumPoint().getX() + xOffset + 1) < WIDTH) || (
|
||||||
(region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset + 1) < LENGTH) || (HEIGHT
|
(region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset + 1) < LENGTH) || (HEIGHT
|
||||||
> 256)) {
|
> 256)) {
|
||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -94,8 +96,9 @@ public class FaweDelegateSchematicHandler {
|
|||||||
y_offset_actual = yOffset + ((ClassicPlotWorld) pw).PLOT_HEIGHT;
|
y_offset_actual = yOffset + ((ClassicPlotWorld) pw).PLOT_HEIGHT;
|
||||||
} else {
|
} else {
|
||||||
y_offset_actual = yOffset + 1 + PlotSquared.platform().worldUtil()
|
y_offset_actual = yOffset + 1 + PlotSquared.platform().worldUtil()
|
||||||
.getHighestBlockSynchronous(plot.getWorldName(), region.getMinimumPoint().getX() + 1,
|
.getHighestBlockSynchronous(plot.getWorldName(), region.getMinimumPoint().getX() + 1,
|
||||||
region.getMinimumPoint().getZ() + 1);
|
region.getMinimumPoint().getZ() + 1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -103,10 +106,10 @@ public class FaweDelegateSchematicHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final BlockVector3 to = BlockVector3
|
final BlockVector3 to = BlockVector3
|
||||||
.at(region.getMinimumPoint().getX() + xOffset, y_offset_actual, region.getMinimumPoint().getZ() + zOffset);
|
.at(region.getMinimumPoint().getX() + xOffset, y_offset_actual, region.getMinimumPoint().getZ() + zOffset);
|
||||||
|
|
||||||
try (EditSession editSession = new EditSessionBuilder(FaweAPI.getWorld(plot.getWorldName())).checkMemory(false)
|
try (EditSession editSession = new EditSessionBuilder(FaweAPI.getWorld(plot.getWorldName())).checkMemory(false)
|
||||||
.fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build()) {
|
.fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build()) {
|
||||||
final Clipboard clipboard = schematic.getClipboard();
|
final Clipboard clipboard = schematic.getClipboard();
|
||||||
clipboard.paste(editSession, to, true, false, true);
|
clipboard.paste(editSession, to, true, false, true);
|
||||||
if (whenDone != null) {
|
if (whenDone != null) {
|
||||||
@ -135,20 +138,20 @@ public class FaweDelegateSchematicHandler {
|
|||||||
if (cTag instanceof CompressedSchematicTag) {
|
if (cTag instanceof CompressedSchematicTag) {
|
||||||
Clipboard clipboard = (Clipboard) cTag.getSource();
|
Clipboard clipboard = (Clipboard) cTag.getSource();
|
||||||
try (OutputStream stream = new FileOutputStream(tmp);
|
try (OutputStream stream = new FileOutputStream(tmp);
|
||||||
NBTOutputStream output = new NBTOutputStream(
|
NBTOutputStream output = new NBTOutputStream(
|
||||||
new BufferedOutputStream(new ParallelGZIPOutputStream(stream)))) {
|
new BufferedOutputStream(new ParallelGZIPOutputStream(stream)))) {
|
||||||
new FastSchematicWriter(output).write(clipboard);
|
new FastSchematicWriter(output).write(clipboard);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try (OutputStream stream = new FileOutputStream(tmp);
|
try (OutputStream stream = new FileOutputStream(tmp);
|
||||||
BufferedOutputStream output = new BufferedOutputStream(new ParallelGZIPOutputStream(stream))) {
|
BufferedOutputStream output = new BufferedOutputStream(new ParallelGZIPOutputStream(stream))) {
|
||||||
LZ4BlockInputStream is = cTag.adapt(cTag.getSource());
|
LZ4BlockInputStream is = cTag.adapt(cTag.getSource());
|
||||||
IOUtil.copy(is, output);
|
IOUtil.copy(is, output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try (OutputStream stream = new FileOutputStream(tmp);
|
try (OutputStream stream = new FileOutputStream(tmp);
|
||||||
NBTOutputStream output = new NBTOutputStream(new ParallelGZIPOutputStream(stream))) {
|
NBTOutputStream output = new NBTOutputStream(new ParallelGZIPOutputStream(stream))) {
|
||||||
Map<String, Tag> map = tag.getValue();
|
Map<String, Tag> map = tag.getValue();
|
||||||
output.writeNamedTag("Schematic", map.getOrDefault("Schematic", tag));
|
output.writeNamedTag("Schematic", map.getOrDefault("Schematic", tag));
|
||||||
}
|
}
|
||||||
@ -193,7 +196,7 @@ public class FaweDelegateSchematicHandler {
|
|||||||
public Schematic getSchematic(@Nonnull InputStream is) {
|
public Schematic getSchematic(@Nonnull InputStream is) {
|
||||||
try {
|
try {
|
||||||
FastSchematicReader schematicReader = new FastSchematicReader(
|
FastSchematicReader schematicReader = new FastSchematicReader(
|
||||||
new NBTInputStream(new BufferedInputStream(new GZIPInputStream(new BufferedInputStream(is)))));
|
new NBTInputStream(new BufferedInputStream(new GZIPInputStream(new BufferedInputStream(is)))));
|
||||||
Clipboard clip = schematicReader.read();
|
Clipboard clip = schematicReader.read();
|
||||||
return new Schematic(clip);
|
return new Schematic(clip);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -203,7 +206,7 @@ public class FaweDelegateSchematicHandler {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
SpongeSchematicReader schematicReader =
|
SpongeSchematicReader schematicReader =
|
||||||
new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(is)));
|
new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(is)));
|
||||||
Clipboard clip = schematicReader.read();
|
Clipboard clip = schematicReader.read();
|
||||||
return new Schematic(clip);
|
return new Schematic(clip);
|
||||||
} catch (IOException e2) {
|
} catch (IOException e2) {
|
||||||
@ -213,17 +216,18 @@ public class FaweDelegateSchematicHandler {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
MCEditSchematicReader schematicReader =
|
MCEditSchematicReader schematicReader =
|
||||||
new MCEditSchematicReader(new NBTInputStream(new GZIPInputStream(is)));
|
new MCEditSchematicReader(new NBTInputStream(new GZIPInputStream(is)));
|
||||||
Clipboard clip = schematicReader.read();
|
Clipboard clip = schematicReader.read();
|
||||||
return new Schematic(clip);
|
return new Schematic(clip);
|
||||||
} catch (IOException e3) {
|
} catch (IOException e3) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
LOGGER.warn(
|
LOGGER.warn(
|
||||||
is + " | " + is.getClass().getCanonicalName() + " is not in GZIP format : " + e
|
is + " | " + is.getClass().getCanonicalName() + " is not in GZIP format : " + e
|
||||||
.getMessage());
|
.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.fastasyncworldedit.bukkit.regions.plotsquared;
|
|||||||
|
|
||||||
import com.fastasyncworldedit.core.Fawe;
|
import com.fastasyncworldedit.core.Fawe;
|
||||||
import com.fastasyncworldedit.core.FaweCache;
|
import com.fastasyncworldedit.core.FaweCache;
|
||||||
|
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
||||||
import com.fastasyncworldedit.core.queue.IQueueChunk;
|
import com.fastasyncworldedit.core.queue.IQueueChunk;
|
||||||
import com.fastasyncworldedit.core.queue.IQueueExtent;
|
import com.fastasyncworldedit.core.queue.IQueueExtent;
|
||||||
import com.plotsquared.core.queue.LightingMode;
|
import com.plotsquared.core.queue.LightingMode;
|
||||||
@ -12,15 +13,14 @@ import com.sk89q.worldedit.entity.Entity;
|
|||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@ -29,7 +29,7 @@ public class FaweQueueCoordinator extends QueueCoordinator {
|
|||||||
|
|
||||||
public final IQueueExtent<IQueueChunk> instance;
|
public final IQueueExtent<IQueueChunk> instance;
|
||||||
private final World world;
|
private final World world;
|
||||||
private BlockVector3 mutable = new MutableBlockVector3();
|
private final BlockVector3 mutable = new MutableBlockVector3();
|
||||||
private boolean setbiome = false;
|
private boolean setbiome = false;
|
||||||
|
|
||||||
public FaweQueueCoordinator(World world) {
|
public FaweQueueCoordinator(World world) {
|
||||||
@ -202,4 +202,5 @@ public class FaweQueueCoordinator extends QueueCoordinator {
|
|||||||
public boolean isSettingTiles() {
|
public boolean isSettingTiles() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,10 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
|||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
|
|
||||||
@CommandDeclaration(command = "trimchunks",
|
@CommandDeclaration(command = "trimchunks",
|
||||||
permission = "plots.admin",
|
permission = "plots.admin",
|
||||||
description = "Delete unmodified portions of your plotworld",
|
description = "Delete unmodified portions of your plotworld",
|
||||||
requiredType = RequiredType.PLAYER,
|
requiredType = RequiredType.PLAYER,
|
||||||
category = CommandCategory.ADMINISTRATION)
|
category = CommandCategory.ADMINISTRATION)
|
||||||
public class FaweTrim extends SubCommand {
|
public class FaweTrim extends SubCommand {
|
||||||
|
|
||||||
private boolean ran = false;
|
private boolean ran = false;
|
||||||
@ -28,7 +28,7 @@ public class FaweTrim extends SubCommand {
|
|||||||
}
|
}
|
||||||
if (strings.length != 2) {
|
if (strings.length != 2) {
|
||||||
plotPlayer.sendMessage(StaticCaption
|
plotPlayer.sendMessage(StaticCaption
|
||||||
.of("First make a backup of your world called <world-copy> then stand in the middle of an empty plot"));
|
.of("First make a backup of your world called <world-copy> then stand in the middle of an empty plot"));
|
||||||
plotPlayer.sendMessage(StaticCaption.of("use /plot trimall <world> <boolean-delete-unowned>"));
|
plotPlayer.sendMessage(StaticCaption.of("use /plot trimall <world> <boolean-delete-unowned>"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -52,4 +52,5 @@ public class FaweTrim extends SubCommand {
|
|||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import java.util.ArrayList;
|
|||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public class PlotRegionFilter extends CuboidRegionFilter {
|
public class PlotRegionFilter extends CuboidRegionFilter {
|
||||||
|
|
||||||
private final PlotArea area;
|
private final PlotArea area;
|
||||||
|
|
||||||
public PlotRegionFilter(PlotArea area) {
|
public PlotRegionFilter(PlotArea area) {
|
||||||
@ -27,4 +28,5 @@ public class PlotRegionFilter extends CuboidRegionFilter {
|
|||||||
add(BlockVector2.at(bottom.getX(), bottom.getZ()), BlockVector2.at(top.getX(), top.getZ()));
|
add(BlockVector2.at(bottom.getX(), bottom.getZ()), BlockVector2.at(top.getX(), top.getZ()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,43 +35,53 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@CommandDeclaration(command = "generatebiome",
|
@CommandDeclaration(command = "generatebiome",
|
||||||
permission = "plots.generatebiome",
|
permission = "plots.generatebiome",
|
||||||
category = CommandCategory.APPEARANCE,
|
category = CommandCategory.APPEARANCE,
|
||||||
requiredType = RequiredType.PLAYER,
|
requiredType = RequiredType.PLAYER,
|
||||||
description = "Generate a biome in your plot",
|
description = "Generate a biome in your plot",
|
||||||
aliases = {"bg", "gb"},
|
aliases = {"bg", "gb"},
|
||||||
usage = "/plots generatebiome <biome>")
|
usage = "/plots generatebiome <biome>")
|
||||||
public class PlotSetBiome extends Command {
|
public class PlotSetBiome extends Command {
|
||||||
|
|
||||||
public PlotSetBiome() {
|
public PlotSetBiome() {
|
||||||
super(MainCommand.getInstance(), true);
|
super(MainCommand.getInstance(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Boolean> execute(final PlotPlayer<?> player,
|
public CompletableFuture<Boolean> execute(
|
||||||
String[] args,
|
final PlotPlayer<?> player,
|
||||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
String[] args,
|
||||||
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
|
RunnableVal2<Command, CommandResult> whenDone
|
||||||
|
) throws CommandException {
|
||||||
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
|
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
|
||||||
checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.generatebiome"),
|
checkTrue(
|
||||||
TranslatableCaption.of("permission.no_plot_perms"));
|
plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.generatebiome"),
|
||||||
|
TranslatableCaption.of("permission.no_plot_perms")
|
||||||
|
);
|
||||||
if (plot.getRunning() != 0) {
|
if (plot.getRunning() != 0) {
|
||||||
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"),
|
checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
Templates.of("value", getUsage()));
|
Templates.of("value", getUsage())
|
||||||
|
);
|
||||||
final Set<CuboidRegion> regions = plot.getRegions();
|
final Set<CuboidRegion> regions = plot.getRegions();
|
||||||
BiomeRegistry biomeRegistry =
|
BiomeRegistry biomeRegistry =
|
||||||
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries()
|
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries()
|
||||||
.getBiomeRegistry();
|
.getBiomeRegistry();
|
||||||
Collection<BiomeType> knownBiomes = BiomeTypes.values();
|
Collection<BiomeType> knownBiomes = BiomeTypes.values();
|
||||||
final BiomeType biome = Biomes.findBiomeByName(knownBiomes, args[0], biomeRegistry);
|
final BiomeType biome = Biomes.findBiomeByName(knownBiomes, args[0], biomeRegistry);
|
||||||
if (biome == null) {
|
if (biome == null) {
|
||||||
String biomes = StringMan.join(BiomeType.REGISTRY.values(),
|
String biomes = StringMan.join(
|
||||||
TranslatableCaption.of("blocklist.block_list_separator").getComponent(player));
|
BiomeType.REGISTRY.values(),
|
||||||
|
TranslatableCaption.of("blocklist.block_list_separator").getComponent(player)
|
||||||
|
);
|
||||||
player.sendMessage(TranslatableCaption.of("biome.need_biome"));
|
player.sendMessage(TranslatableCaption.of("biome.need_biome"));
|
||||||
player.sendMessage(TranslatableCaption.of("commandconfig.subcommand_set_options_header"),
|
player.sendMessage(
|
||||||
Templates.of("values", biomes));
|
TranslatableCaption.of("commandconfig.subcommand_set_options_header"),
|
||||||
|
Templates.of("values", biomes)
|
||||||
|
);
|
||||||
return CompletableFuture.completedFuture(false);
|
return CompletableFuture.completedFuture(false);
|
||||||
}
|
}
|
||||||
confirm.run(this, () -> {
|
confirm.run(this, () -> {
|
||||||
@ -82,9 +92,9 @@ public class PlotSetBiome extends Command {
|
|||||||
plot.addRunning();
|
plot.addRunning();
|
||||||
TaskManager.IMP.async(() -> {
|
TaskManager.IMP.async(() -> {
|
||||||
EditSession session =
|
EditSession session =
|
||||||
new EditSessionBuilder(BukkitAdapter.adapt(Bukkit.getWorld(plot.getArea().getWorldName())))
|
new EditSessionBuilder(BukkitAdapter.adapt(Bukkit.getWorld(plot.getArea().getWorldName())))
|
||||||
.autoQueue(false).checkMemory(false).allowedRegionsEverywhere()
|
.autoQueue(false).checkMemory(false).allowedRegionsEverywhere()
|
||||||
.player(BukkitAdapter.adapt(Bukkit.getPlayer(player.getUUID()))).limitUnlimited().build();
|
.player(BukkitAdapter.adapt(Bukkit.getPlayer(player.getUUID()))).limitUnlimited().build();
|
||||||
long seed = ThreadLocalRandom.current().nextLong();
|
long seed = ThreadLocalRandom.current().nextLong();
|
||||||
for (CuboidRegion region : regions) {
|
for (CuboidRegion region : regions) {
|
||||||
session.regenerate(region, biome, seed);
|
session.regenerate(region, biome, seed);
|
||||||
@ -105,4 +115,5 @@ public class PlotSetBiome extends Command {
|
|||||||
.map(value -> new Command(null, false, value, "", RequiredType.PLAYER, null) {
|
.map(value -> new Command(null, false, value, "", RequiredType.PLAYER, null) {
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -69,9 +69,9 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
}
|
}
|
||||||
UUID uid = player.getUniqueId();
|
UUID uid = player.getUniqueId();
|
||||||
return !plot.getFlag(NoWorldeditFlag.class) && (plot.isOwner(uid) || type == MaskType.MEMBER && (
|
return !plot.getFlag(NoWorldeditFlag.class) && (plot.isOwner(uid) || type == MaskType.MEMBER && (
|
||||||
plot.getTrusted().contains(uid) || plot.getTrusted().contains(DBFunc.EVERYONE)
|
plot.getTrusted().contains(uid) || plot.getTrusted().contains(DBFunc.EVERYONE)
|
||||||
|| (plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE)) && player
|
|| (plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE)) && player
|
||||||
.hasPermission("fawe.plotsquared.member")) || player.hasPermission("fawe.plotsquared.admin"));
|
.hasPermission("fawe.plotsquared.member")) || player.hasPermission("fawe.plotsquared.admin"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -90,7 +90,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
if (regions.size() == 1) {
|
if (regions.size() == 1) {
|
||||||
CuboidRegion region = regions.iterator().next();
|
CuboidRegion region = regions.iterator().next();
|
||||||
if (region.getMinimumPoint().getX() == Integer.MIN_VALUE
|
if (region.getMinimumPoint().getX() == Integer.MIN_VALUE
|
||||||
&& region.getMaximumPoint().getX() == Integer.MAX_VALUE) {
|
&& region.getMaximumPoint().getX() == Integer.MAX_VALUE) {
|
||||||
regions.clear();
|
regions.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,8 +116,9 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
} else {
|
} else {
|
||||||
World world = FaweAPI.getWorld(area.getWorldName());
|
World world = FaweAPI.getWorld(area.getWorldName());
|
||||||
List<Region> weRegions = regions.stream().map(
|
List<Region> weRegions = regions.stream().map(
|
||||||
r -> new CuboidRegion(world, BlockVector3.at(r.getMinimumX(), r.getMinimumY(), r.getMinimumZ()),
|
r -> new CuboidRegion(world, BlockVector3.at(r.getMinimumX(), r.getMinimumY(), r.getMinimumZ()),
|
||||||
BlockVector3.at(r.getMaximumX(), r.getMaximumY(), r.getMaximumZ()))).collect(Collectors.toList());
|
BlockVector3.at(r.getMaximumX(), r.getMaximumY(), r.getMaximumZ())
|
||||||
|
)).collect(Collectors.toList());
|
||||||
maskedRegion = new RegionIntersection(world, weRegions);
|
maskedRegion = new RegionIntersection(world, weRegions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,4 +141,5 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ import static org.bukkit.Bukkit.getWorld;
|
|||||||
|
|
||||||
public class FaweChunkManager extends ChunkManager {
|
public class FaweChunkManager extends ChunkManager {
|
||||||
|
|
||||||
private ChunkManager parent;
|
private final ChunkManager parent;
|
||||||
|
|
||||||
public FaweChunkManager(ChunkManager parent) {
|
public FaweChunkManager(ChunkManager parent) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
@ -50,7 +50,13 @@ public class FaweChunkManager extends ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void swap(final Location pos1, final Location pos2, final Location pos3, final Location pos4, final Runnable whenDone) {
|
public void swap(
|
||||||
|
final Location pos1,
|
||||||
|
final Location pos2,
|
||||||
|
final Location pos3,
|
||||||
|
final Location pos4,
|
||||||
|
final Runnable whenDone
|
||||||
|
) {
|
||||||
if (!Settings.IMP.PLOTSQUARED_INTEGRATION.COPY_AND_SWAP) {
|
if (!Settings.IMP.PLOTSQUARED_INTEGRATION.COPY_AND_SWAP) {
|
||||||
parent.swap(pos1, pos2, pos3, pos4, whenDone);
|
parent.swap(pos1, pos2, pos3, pos4, whenDone);
|
||||||
}
|
}
|
||||||
@ -60,11 +66,29 @@ public class FaweChunkManager extends ChunkManager {
|
|||||||
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
|
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
|
||||||
World pos3World = BukkitAdapter.adapt(getWorld(pos3.getWorld()));
|
World pos3World = BukkitAdapter.adapt(getWorld(pos3.getWorld()));
|
||||||
WorldEdit.getInstance().getEditSessionFactory().getEditSession(
|
WorldEdit.getInstance().getEditSessionFactory().getEditSession(
|
||||||
pos1World,-1);
|
pos1World, -1);
|
||||||
EditSession sessionA = new EditSessionBuilder(pos1World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
EditSession sessionA = new EditSessionBuilder(pos1World)
|
||||||
EditSession sessionB = new EditSessionBuilder(pos3World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
.checkMemory(false)
|
||||||
CuboidRegion regionA = new CuboidRegion(BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()), BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
|
.fastmode(true)
|
||||||
CuboidRegion regionB = new CuboidRegion(BlockVector3.at(pos3.getX(), pos3.getY(), pos3.getZ()), BlockVector3.at(pos4.getX(), pos4.getY(), pos4.getZ()));
|
.limitUnlimited()
|
||||||
|
.changeSetNull()
|
||||||
|
.autoQueue(false)
|
||||||
|
.build();
|
||||||
|
EditSession sessionB = new EditSessionBuilder(pos3World)
|
||||||
|
.checkMemory(false)
|
||||||
|
.fastmode(true)
|
||||||
|
.limitUnlimited()
|
||||||
|
.changeSetNull()
|
||||||
|
.autoQueue(false)
|
||||||
|
.build();
|
||||||
|
CuboidRegion regionA = new CuboidRegion(
|
||||||
|
BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()),
|
||||||
|
BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ())
|
||||||
|
);
|
||||||
|
CuboidRegion regionB = new CuboidRegion(
|
||||||
|
BlockVector3.at(pos3.getX(), pos3.getY(), pos3.getZ()),
|
||||||
|
BlockVector3.at(pos4.getX(), pos4.getY(), pos4.getZ())
|
||||||
|
);
|
||||||
ForwardExtentCopy copyA = new ForwardExtentCopy(sessionA, regionA, sessionB, regionB.getMinimumPoint());
|
ForwardExtentCopy copyA = new ForwardExtentCopy(sessionA, regionA, sessionB, regionB.getMinimumPoint());
|
||||||
ForwardExtentCopy copyB = new ForwardExtentCopy(sessionB, regionB, sessionA, regionA.getMinimumPoint());
|
ForwardExtentCopy copyB = new ForwardExtentCopy(sessionB, regionB, sessionA, regionA.getMinimumPoint());
|
||||||
try {
|
try {
|
||||||
@ -89,10 +113,30 @@ public class FaweChunkManager extends ChunkManager {
|
|||||||
synchronized (FaweChunkManager.class) {
|
synchronized (FaweChunkManager.class) {
|
||||||
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
|
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
|
||||||
World pos3World = BukkitAdapter.adapt(getWorld(pos3.getWorld()));
|
World pos3World = BukkitAdapter.adapt(getWorld(pos3.getWorld()));
|
||||||
EditSession from = new EditSessionBuilder(pos1World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
EditSession from = new EditSessionBuilder(pos1World)
|
||||||
EditSession to = new EditSessionBuilder(pos3World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
.checkMemory(false)
|
||||||
CuboidRegion region = new CuboidRegion(BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()), BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
|
.fastmode(true)
|
||||||
ForwardExtentCopy copy = new ForwardExtentCopy(from, region, to, BlockVector3.at(pos3.getX(), pos3.getY(), pos3.getZ()));
|
.limitUnlimited()
|
||||||
|
.changeSetNull()
|
||||||
|
.autoQueue(false)
|
||||||
|
.build();
|
||||||
|
EditSession to = new EditSessionBuilder(pos3World)
|
||||||
|
.checkMemory(false)
|
||||||
|
.fastmode(true)
|
||||||
|
.limitUnlimited()
|
||||||
|
.changeSetNull()
|
||||||
|
.autoQueue(false)
|
||||||
|
.build();
|
||||||
|
CuboidRegion region = new CuboidRegion(
|
||||||
|
BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()),
|
||||||
|
BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ())
|
||||||
|
);
|
||||||
|
ForwardExtentCopy copy = new ForwardExtentCopy(
|
||||||
|
from,
|
||||||
|
region,
|
||||||
|
to,
|
||||||
|
BlockVector3.at(pos3.getX(), pos3.getY(), pos3.getZ())
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
Operations.completeLegacy(copy);
|
Operations.completeLegacy(copy);
|
||||||
to.flushQueue();
|
to.flushQueue();
|
||||||
@ -111,10 +155,11 @@ public class FaweChunkManager extends ChunkManager {
|
|||||||
synchronized (FaweChunkManager.class) {
|
synchronized (FaweChunkManager.class) {
|
||||||
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
|
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
|
||||||
try (EditSession editSession = new EditSessionBuilder(pos1World).checkMemory(false)
|
try (EditSession editSession = new EditSessionBuilder(pos1World).checkMemory(false)
|
||||||
.fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build()) {
|
.fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build()) {
|
||||||
CuboidRegion region = new CuboidRegion(
|
CuboidRegion region = new CuboidRegion(
|
||||||
BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()),
|
BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()),
|
||||||
BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
|
BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ())
|
||||||
|
);
|
||||||
editSession.regenerate(region);
|
editSession.regenerate(region);
|
||||||
editSession.flushQueue();
|
editSession.flushQueue();
|
||||||
}
|
}
|
||||||
@ -123,4 +168,5 @@ public class FaweChunkManager extends ChunkManager {
|
|||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,13 @@ package com.fastasyncworldedit.bukkit.regions.plotsquaredv4;
|
|||||||
import com.fastasyncworldedit.core.Fawe;
|
import com.fastasyncworldedit.core.Fawe;
|
||||||
import com.fastasyncworldedit.core.FaweAPI;
|
import com.fastasyncworldedit.core.FaweAPI;
|
||||||
import com.fastasyncworldedit.core.FaweCache;
|
import com.fastasyncworldedit.core.FaweCache;
|
||||||
|
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
||||||
import com.fastasyncworldedit.core.queue.IQueueChunk;
|
import com.fastasyncworldedit.core.queue.IQueueChunk;
|
||||||
import com.fastasyncworldedit.core.queue.IQueueExtent;
|
import com.fastasyncworldedit.core.queue.IQueueExtent;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
@ -20,7 +20,7 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
|
|||||||
|
|
||||||
public final IQueueExtent<IQueueChunk> instance;
|
public final IQueueExtent<IQueueChunk> instance;
|
||||||
private final World world;
|
private final World world;
|
||||||
private BlockVector3 mutable = new MutableBlockVector3();
|
private final BlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
public FaweLocalBlockQueue(String worldName) {
|
public FaweLocalBlockQueue(String worldName) {
|
||||||
super(worldName);
|
super(worldName);
|
||||||
@ -127,4 +127,5 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
|
|||||||
instance.setTile(x, y, z, (com.sk89q.jnbt.CompoundTag) FaweCache.IMP.asTag(tag));
|
instance.setTile(x, y, z, (com.sk89q.jnbt.CompoundTag) FaweCache.IMP.asTag(tag));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,9 @@ package com.fastasyncworldedit.bukkit.regions.plotsquaredv4;
|
|||||||
import com.fastasyncworldedit.core.FaweAPI;
|
import com.fastasyncworldedit.core.FaweAPI;
|
||||||
import com.fastasyncworldedit.core.FaweCache;
|
import com.fastasyncworldedit.core.FaweCache;
|
||||||
import com.fastasyncworldedit.core.extent.clipboard.ReadOnlyClipboard;
|
import com.fastasyncworldedit.core.extent.clipboard.ReadOnlyClipboard;
|
||||||
|
import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicWriter;
|
||||||
|
import com.fastasyncworldedit.core.jnbt.CompressedCompoundTag;
|
||||||
|
import com.fastasyncworldedit.core.jnbt.CompressedSchematicTag;
|
||||||
import com.fastasyncworldedit.core.util.EditSessionBuilder;
|
import com.fastasyncworldedit.core.util.EditSessionBuilder;
|
||||||
import com.fastasyncworldedit.core.util.IOUtil;
|
import com.fastasyncworldedit.core.util.IOUtil;
|
||||||
import com.fastasyncworldedit.core.util.TaskManager;
|
import com.fastasyncworldedit.core.util.TaskManager;
|
||||||
@ -13,8 +16,6 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.fastasyncworldedit.core.jnbt.CompressedCompoundTag;
|
|
||||||
import com.fastasyncworldedit.core.jnbt.CompressedSchematicTag;
|
|
||||||
import com.sk89q.jnbt.NBTOutputStream;
|
import com.sk89q.jnbt.NBTOutputStream;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
@ -22,7 +23,6 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
|||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
||||||
import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicWriter;
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
@ -43,6 +43,7 @@ import java.util.UUID;
|
|||||||
import static org.bukkit.Bukkit.getWorld;
|
import static org.bukkit.Bukkit.getWorld;
|
||||||
|
|
||||||
public class FaweSchematicHandler extends SchematicHandler {
|
public class FaweSchematicHandler extends SchematicHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean restoreTile(LocalBlockQueue queue, CompoundTag compoundTag, int x, int y, int z) {
|
public boolean restoreTile(LocalBlockQueue queue, CompoundTag compoundTag, int x, int y, int z) {
|
||||||
if (queue instanceof FaweLocalBlockQueue) {
|
if (queue instanceof FaweLocalBlockQueue) {
|
||||||
@ -59,8 +60,17 @@ public class FaweSchematicHandler extends SchematicHandler {
|
|||||||
Location pos1 = corners[0];
|
Location pos1 = corners[0];
|
||||||
Location pos2 = corners[1];
|
Location pos2 = corners[1];
|
||||||
World adaptedWorld = BukkitAdapter.adapt(getWorld(world));
|
World adaptedWorld = BukkitAdapter.adapt(getWorld(world));
|
||||||
final CuboidRegion region = new CuboidRegion(BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()), BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
|
final CuboidRegion region = new CuboidRegion(
|
||||||
final EditSession editSession = new EditSessionBuilder(adaptedWorld).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()),
|
||||||
|
BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ())
|
||||||
|
);
|
||||||
|
final EditSession editSession = new EditSessionBuilder(adaptedWorld)
|
||||||
|
.checkMemory(false)
|
||||||
|
.fastmode(true)
|
||||||
|
.limitUnlimited()
|
||||||
|
.changeSetNull()
|
||||||
|
.autoQueue(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
ReadOnlyClipboard clipboard = ReadOnlyClipboard.of(editSession, region, false, true);
|
ReadOnlyClipboard clipboard = ReadOnlyClipboard.of(editSession, region, false, true);
|
||||||
|
|
||||||
@ -84,17 +94,20 @@ public class FaweSchematicHandler extends SchematicHandler {
|
|||||||
CompressedCompoundTag cTag = (CompressedCompoundTag) tag;
|
CompressedCompoundTag cTag = (CompressedCompoundTag) tag;
|
||||||
if (cTag instanceof CompressedSchematicTag) {
|
if (cTag instanceof CompressedSchematicTag) {
|
||||||
Clipboard clipboard = (Clipboard) cTag.getSource();
|
Clipboard clipboard = (Clipboard) cTag.getSource();
|
||||||
try (OutputStream stream = new FileOutputStream(tmp); NBTOutputStream output = new NBTOutputStream(new BufferedOutputStream(new ParallelGZIPOutputStream(stream)))) {
|
try (OutputStream stream = new FileOutputStream(tmp); NBTOutputStream output = new NBTOutputStream(new BufferedOutputStream(
|
||||||
|
new ParallelGZIPOutputStream(stream)))) {
|
||||||
new FastSchematicWriter(output).write(clipboard);
|
new FastSchematicWriter(output).write(clipboard);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try (OutputStream stream = new FileOutputStream(tmp); BufferedOutputStream output = new BufferedOutputStream(new ParallelGZIPOutputStream(stream))) {
|
try (OutputStream stream = new FileOutputStream(tmp); BufferedOutputStream output = new BufferedOutputStream(
|
||||||
|
new ParallelGZIPOutputStream(stream))) {
|
||||||
LZ4BlockInputStream is = cTag.adapt(cTag.getSource());
|
LZ4BlockInputStream is = cTag.adapt(cTag.getSource());
|
||||||
IOUtil.copy(is, stream);
|
IOUtil.copy(is, stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try (OutputStream stream = new FileOutputStream(tmp); NBTOutputStream output = new NBTOutputStream(new ParallelGZIPOutputStream(stream))) {
|
try (OutputStream stream = new FileOutputStream(tmp); NBTOutputStream output = new NBTOutputStream(new ParallelGZIPOutputStream(
|
||||||
|
stream))) {
|
||||||
Map<String, Tag> map = tag.getValue();
|
Map<String, Tag> map = tag.getValue();
|
||||||
output.writeNamedTag("Schematic", map.getOrDefault("Schematic", tag));
|
output.writeNamedTag("Schematic", map.getOrDefault("Schematic", tag));
|
||||||
}
|
}
|
||||||
@ -138,4 +151,5 @@ public class FaweSchematicHandler extends SchematicHandler {
|
|||||||
}
|
}
|
||||||
}, whenDone);
|
}, whenDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,8 @@ public class FaweTrim extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (strings.length != 2) {
|
if (strings.length != 2) {
|
||||||
plotPlayer.sendMessage("First make a backup of your world called <world-copy> then stand in the middle of an empty plot");
|
plotPlayer.sendMessage(
|
||||||
|
"First make a backup of your world called <world-copy> then stand in the middle of an empty plot");
|
||||||
plotPlayer.sendMessage("use /plot trimall <world> <boolean-delete-unowned>");
|
plotPlayer.sendMessage("use /plot trimall <world> <boolean-delete-unowned>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -53,4 +54,5 @@ public class FaweTrim extends SubCommand {
|
|||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import java.util.ArrayList;
|
|||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public class PlotRegionFilter extends CuboidRegionFilter {
|
public class PlotRegionFilter extends CuboidRegionFilter {
|
||||||
|
|
||||||
private final PlotArea area;
|
private final PlotArea area;
|
||||||
|
|
||||||
public PlotRegionFilter(PlotArea area) {
|
public PlotRegionFilter(PlotArea area) {
|
||||||
@ -27,4 +28,5 @@ public class PlotRegionFilter extends CuboidRegionFilter {
|
|||||||
add(BlockVector2.at(bottom.getX(), bottom.getZ()), BlockVector2.at(top.getX(), top.getZ()));
|
add(BlockVector2.at(bottom.getX(), bottom.getZ()), BlockVector2.at(top.getX(), top.getZ()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,11 +24,12 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
|||||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||||
import com.sk89q.worldedit.world.biome.Biomes;
|
import com.sk89q.worldedit.world.biome.Biomes;
|
||||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "generatebiome",
|
command = "generatebiome",
|
||||||
@ -40,29 +41,40 @@ import org.bukkit.Bukkit;
|
|||||||
usage = "/plots generatebiome <biome>"
|
usage = "/plots generatebiome <biome>"
|
||||||
)
|
)
|
||||||
public class PlotSetBiome extends Command {
|
public class PlotSetBiome extends Command {
|
||||||
|
|
||||||
public PlotSetBiome() {
|
public PlotSetBiome() {
|
||||||
super(MainCommand.getInstance(), true);
|
super(MainCommand.getInstance(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
public CompletableFuture<Boolean> execute(
|
||||||
|
final PlotPlayer player,
|
||||||
|
String[] args,
|
||||||
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
|
RunnableVal2<Command, CommandResult> whenDone
|
||||||
|
) throws CommandException {
|
||||||
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
|
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
|
||||||
checkTrue(plot.isOwner(player.getUUID()) || Permissions
|
checkTrue(plot.isOwner(player.getUUID()) || Permissions
|
||||||
.hasPermission(player, "plots.admin.command.generatebiome"), Captions.NO_PLOT_PERMS);
|
.hasPermission(player, "plots.admin.command.generatebiome"), Captions.NO_PLOT_PERMS);
|
||||||
if (plot.getRunning() != 0) {
|
if (plot.getRunning() != 0) {
|
||||||
Captions.WAIT_FOR_TIMER.send(player);
|
Captions.WAIT_FOR_TIMER.send(player);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage());
|
checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage());
|
||||||
final Set<CuboidRegion> regions = plot.getRegions();
|
final Set<CuboidRegion> regions = plot.getRegions();
|
||||||
BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
BiomeRegistry biomeRegistry = WorldEdit
|
||||||
|
.getInstance()
|
||||||
|
.getPlatformManager()
|
||||||
|
.queryCapability(Capability.GAME_HOOKS)
|
||||||
|
.getRegistries()
|
||||||
|
.getBiomeRegistry();
|
||||||
Collection<BiomeType> knownBiomes = BiomeTypes.values();
|
Collection<BiomeType> knownBiomes = BiomeTypes.values();
|
||||||
final BiomeType biome = Biomes.findBiomeByName(knownBiomes, args[0], biomeRegistry);
|
final BiomeType biome = Biomes.findBiomeByName(knownBiomes, args[0], biomeRegistry);
|
||||||
if (biome == null) {
|
if (biome == null) {
|
||||||
String biomes = StringMan
|
String biomes = StringMan
|
||||||
.join(BiomeType.REGISTRY.values(), Captions.BLOCK_LIST_SEPARATOR.getTranslated());
|
.join(BiomeType.REGISTRY.values(), Captions.BLOCK_LIST_SEPARATOR.getTranslated());
|
||||||
Captions.NEED_BIOME.send(player);
|
Captions.NEED_BIOME.send(player);
|
||||||
MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.toString() + biomes);
|
MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER + biomes);
|
||||||
return CompletableFuture.completedFuture(false);
|
return CompletableFuture.completedFuture(false);
|
||||||
}
|
}
|
||||||
confirm.run(this, () -> {
|
confirm.run(this, () -> {
|
||||||
@ -90,4 +102,5 @@ public class PlotSetBiome extends Command {
|
|||||||
|
|
||||||
return CompletableFuture.completedFuture(true);
|
return CompletableFuture.completedFuture(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.fastasyncworldedit.bukkit.regions.plotsquaredv4;
|
package com.fastasyncworldedit.bukkit.regions.plotsquaredv4;
|
||||||
|
|
||||||
import com.fastasyncworldedit.core.FaweAPI;
|
import com.fastasyncworldedit.core.FaweAPI;
|
||||||
import com.fastasyncworldedit.core.regions.RegionWrapper;
|
|
||||||
import com.fastasyncworldedit.core.regions.FaweMask;
|
import com.fastasyncworldedit.core.regions.FaweMask;
|
||||||
import com.fastasyncworldedit.core.regions.FaweMaskManager;
|
import com.fastasyncworldedit.core.regions.FaweMaskManager;
|
||||||
|
import com.fastasyncworldedit.core.regions.RegionWrapper;
|
||||||
import com.fastasyncworldedit.core.regions.filter.RegionFilter;
|
import com.fastasyncworldedit.core.regions.filter.RegionFilter;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||||
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
|
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
|
||||||
@ -97,11 +97,11 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
}
|
}
|
||||||
UUID uid = player.getUniqueId();
|
UUID uid = player.getUniqueId();
|
||||||
return !Flags.NO_WORLDEDIT.isTrue(plot) && (plot.isOwner(uid)
|
return !Flags.NO_WORLDEDIT.isTrue(plot) && (plot.isOwner(uid)
|
||||||
|| type == MaskType.MEMBER && (plot.getTrusted().contains(uid) || plot.getTrusted()
|
|| type == MaskType.MEMBER && (plot.getTrusted().contains(uid) || plot.getTrusted()
|
||||||
.contains(DBFunc.EVERYONE)
|
.contains(DBFunc.EVERYONE)
|
||||||
|| (plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE))
|
|| (plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE))
|
||||||
&& player.hasPermission("fawe.plotsquared.member")) || player
|
&& player.hasPermission("fawe.plotsquared.member")) || player
|
||||||
.hasPermission("fawe.plotsquared.admin"));
|
.hasPermission("fawe.plotsquared.admin"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -119,7 +119,9 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
regions = WEManager.getMask(pp);
|
regions = WEManager.getMask(pp);
|
||||||
if (regions.size() == 1) {
|
if (regions.size() == 1) {
|
||||||
CuboidRegion region = regions.iterator().next();
|
CuboidRegion region = regions.iterator().next();
|
||||||
if (region.getMinimumPoint().getX() == Integer.MIN_VALUE && region.getMaximumPoint().getX() == Integer.MAX_VALUE) {
|
if (region.getMinimumPoint().getX() == Integer.MIN_VALUE && region
|
||||||
|
.getMaximumPoint()
|
||||||
|
.getX() == Integer.MAX_VALUE) {
|
||||||
regions.clear();
|
regions.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,7 +134,14 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
int max = area != null ? Math.min(255, area.MAX_BUILD_HEIGHT) : 255;
|
int max = area != null ? Math.min(255, area.MAX_BUILD_HEIGHT) : 255;
|
||||||
final HashSet<RegionWrapper> faweRegions = new HashSet<>();
|
final HashSet<RegionWrapper> faweRegions = new HashSet<>();
|
||||||
for (CuboidRegion current : regions) {
|
for (CuboidRegion current : regions) {
|
||||||
faweRegions.add(new RegionWrapper(current.getMinimumX(), current.getMaximumX(), min, max, current.getMinimumZ(), current.getMaximumZ()));
|
faweRegions.add(new RegionWrapper(
|
||||||
|
current.getMinimumX(),
|
||||||
|
current.getMaximumX(),
|
||||||
|
min,
|
||||||
|
max,
|
||||||
|
current.getMinimumZ(),
|
||||||
|
current.getMaximumZ()
|
||||||
|
));
|
||||||
}
|
}
|
||||||
final CuboidRegion region = regions.iterator().next();
|
final CuboidRegion region = regions.iterator().next();
|
||||||
final BlockVector3 pos1 = BlockVector3.at(region.getMinimumX(), min, region.getMinimumZ());
|
final BlockVector3 pos1 = BlockVector3.at(region.getMinimumX(), min, region.getMinimumZ());
|
||||||
@ -148,8 +157,12 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
} else {
|
} else {
|
||||||
World world = FaweAPI.getWorld(area.worldname);
|
World world = FaweAPI.getWorld(area.worldname);
|
||||||
List<Region> weRegions = regions.stream()
|
List<Region> weRegions = regions.stream()
|
||||||
.map(r -> new CuboidRegion(world, BlockVector3.at(r.getMinimumX(), r.getMinimumY(), r.getMinimumZ()), BlockVector3.at(r.getMaximumX(), r.getMaximumY(), r.getMaximumZ())))
|
.map(r -> new CuboidRegion(
|
||||||
.collect(Collectors.toList());
|
world,
|
||||||
|
BlockVector3.at(r.getMinimumX(), r.getMinimumY(), r.getMinimumZ()),
|
||||||
|
BlockVector3.at(r.getMaximumX(), r.getMaximumY(), r.getMaximumZ())
|
||||||
|
))
|
||||||
|
.collect(Collectors.toList());
|
||||||
maskedRegion = new RegionIntersection(world, weRegions);
|
maskedRegion = new RegionIntersection(world, weRegions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,4 +185,5 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package com.fastasyncworldedit.bukkit.util;
|
package com.fastasyncworldedit.bukkit.util;
|
||||||
|
|
||||||
import com.fastasyncworldedit.core.Fawe;
|
|
||||||
import com.fastasyncworldedit.bukkit.FaweBukkit;
|
import com.fastasyncworldedit.bukkit.FaweBukkit;
|
||||||
import com.fastasyncworldedit.bukkit.util.ItemUtil;
|
import com.fastasyncworldedit.core.Fawe;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
@ -12,6 +11,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class BukkitItemStack extends BaseItemStack {
|
public class BukkitItemStack extends BaseItemStack {
|
||||||
|
|
||||||
private ItemStack stack;
|
private ItemStack stack;
|
||||||
private Object nativeItem;
|
private Object nativeItem;
|
||||||
private boolean loadedNBT;
|
private boolean loadedNBT;
|
||||||
@ -75,4 +75,5 @@ public class BukkitItemStack extends BaseItemStack {
|
|||||||
}
|
}
|
||||||
super.setNbtData(nbtData);
|
super.setNbtData(nbtData);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import org.bukkit.Server;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public class BukkitReflectionUtils {
|
public class BukkitReflectionUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prefix of Bukkit classes.
|
* Prefix of Bukkit classes.
|
||||||
*/
|
*/
|
||||||
@ -55,4 +56,5 @@ public class BukkitReflectionUtils {
|
|||||||
final String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
final String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
||||||
return packageName.substring(packageName.lastIndexOf('.') + 1);
|
return packageName.substring(packageName.lastIndexOf('.') + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.fastasyncworldedit.core.util.TaskManager;
|
|||||||
import org.apache.commons.lang.mutable.MutableInt;
|
import org.apache.commons.lang.mutable.MutableInt;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class BukkitTaskManager extends TaskManager {
|
public class BukkitTaskManager extends TaskManager {
|
||||||
@ -52,4 +53,5 @@ public class BukkitTaskManager extends TaskManager {
|
|||||||
Bukkit.getScheduler().cancelTask(task);
|
Bukkit.getScheduler().cancelTask(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.fastasyncworldedit.bukkit.util;
|
package com.fastasyncworldedit.bukkit.util;
|
||||||
|
|
||||||
import com.fastasyncworldedit.core.util.ReflectionUtils;
|
import com.fastasyncworldedit.core.util.ReflectionUtils;
|
||||||
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
@ -39,7 +38,10 @@ public class ItemUtil {
|
|||||||
this.fieldHandle = ReflectionUtils.setAccessible(classCraftItemStack.getDeclaredField("handle"));
|
this.fieldHandle = ReflectionUtils.setAccessible(classCraftItemStack.getDeclaredField("handle"));
|
||||||
Class<?> classNBTTagCompound = BukkitReflectionUtils.getNmsClass("NBTTagCompound");
|
Class<?> classNBTTagCompound = BukkitReflectionUtils.getNmsClass("NBTTagCompound");
|
||||||
this.methodSetTag = ReflectionUtils.setAccessible(classNMSItem.getDeclaredMethod("setTag", classNBTTagCompound));
|
this.methodSetTag = ReflectionUtils.setAccessible(classNMSItem.getDeclaredMethod("setTag", classNBTTagCompound));
|
||||||
this.methodAsBukkitCopy = ReflectionUtils.setAccessible(classCraftItemStack.getDeclaredMethod("asBukkitCopy", classNMSItem));
|
this.methodAsBukkitCopy = ReflectionUtils.setAccessible(classCraftItemStack.getDeclaredMethod(
|
||||||
|
"asBukkitCopy",
|
||||||
|
classNMSItem
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getNMSItem(ItemStack item) {
|
public Object getNMSItem(ItemStack item) {
|
||||||
@ -56,7 +58,6 @@ public class ItemUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public CompoundTag getNBT(ItemStack item) {
|
public CompoundTag getNBT(ItemStack item) {
|
||||||
try {
|
try {
|
||||||
if (!item.hasItemMeta()) {
|
if (!item.hasItemMeta()) {
|
||||||
@ -113,4 +114,5 @@ public class ItemUtil {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.fastasyncworldedit.bukkit.util;
|
|||||||
|
|
||||||
import com.google.common.collect.ComparisonChain;
|
import com.google.common.collect.ComparisonChain;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,19 +120,28 @@ public class MinecraftVersion implements Comparable<MinecraftVersion> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) {
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
MinecraftVersion that = (MinecraftVersion) o;
|
MinecraftVersion that = (MinecraftVersion) o;
|
||||||
|
|
||||||
if (getMajor() != that.getMajor()) return false;
|
if (getMajor() != that.getMajor()) {
|
||||||
if (getMinor() != that.getMinor()) return false;
|
return false;
|
||||||
|
}
|
||||||
|
if (getMinor() != that.getMinor()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return getRelease() == that.getRelease();
|
return getRelease() == that.getRelease();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the server version based on the package path, e.g. {@code org.bukkit.craftbukkit.v1_16_R3},
|
* Determines the server version based on the package path, e.g. {@code org.bukkit.craftbukkit.v1_16_R3},
|
||||||
* where v1_16_R3 is the resolved version.
|
* where v1_16_R3 is the resolved version. Note: as of Minecraft 1.17, NMS is no longer versioned thus this
|
||||||
|
* method may have poor results.
|
||||||
*
|
*
|
||||||
* @return The package version.
|
* @return The package version.
|
||||||
*/
|
*/
|
||||||
|
@ -5,15 +5,17 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
|
|
||||||
public class VaultUtil {
|
public class VaultUtil {
|
||||||
|
|
||||||
public final Permission permission;
|
public final Permission permission;
|
||||||
|
|
||||||
public VaultUtil() {
|
public VaultUtil() {
|
||||||
final RegisteredServiceProvider<Permission> permissionProvider =
|
final RegisteredServiceProvider<Permission> permissionProvider =
|
||||||
Bukkit.getServer().getServicesManager().getRegistration(Permission.class);
|
Bukkit.getServer().getServicesManager().getRegistration(Permission.class);
|
||||||
if (permissionProvider != null) {
|
if (permissionProvider != null) {
|
||||||
this.permission = permissionProvider.getProvider();
|
this.permission = permissionProvider.getProvider();
|
||||||
} else {
|
} else {
|
||||||
this.permission = null;
|
this.permission = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,4 +14,5 @@ public class WorldUnloadedException extends WorldEditException {
|
|||||||
public WorldUnloadedException() {
|
public WorldUnloadedException() {
|
||||||
super(Caption.of("worldedit.error.world-unloaded"));
|
super(Caption.of("worldedit.error.world-unloaded"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,13 +20,14 @@ import org.inventivetalent.mapmanager.controller.MultiMapController;
|
|||||||
import org.inventivetalent.mapmanager.manager.MapManager;
|
import org.inventivetalent.mapmanager.manager.MapManager;
|
||||||
import org.inventivetalent.mapmanager.wrapper.MapWrapper;
|
import org.inventivetalent.mapmanager.wrapper.MapWrapper;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.awt.RenderingHints;
|
import java.awt.RenderingHints;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
public class BukkitImageViewer implements ImageViewer {
|
public class BukkitImageViewer implements ImageViewer {
|
||||||
|
|
||||||
private final MapManager mapManager;
|
private final MapManager mapManager;
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private BufferedImage last;
|
private BufferedImage last;
|
||||||
@ -148,7 +149,13 @@ public class BukkitImageViewer implements ImageViewer {
|
|||||||
last = image;
|
last = image;
|
||||||
int width = frames.length;
|
int width = frames.length;
|
||||||
int height = frames[0].length;
|
int height = frames[0].length;
|
||||||
BufferedImage scaled = ImageUtil.getScaledInstance(image, 128 * width, 128 * height, RenderingHints.VALUE_INTERPOLATION_BILINEAR, false);
|
BufferedImage scaled = ImageUtil.getScaledInstance(
|
||||||
|
image,
|
||||||
|
128 * width,
|
||||||
|
128 * height,
|
||||||
|
RenderingHints.VALUE_INTERPOLATION_BILINEAR,
|
||||||
|
false
|
||||||
|
);
|
||||||
MapWrapper mapWrapper = mapManager.wrapMultiImage(scaled, width, height);
|
MapWrapper mapWrapper = mapManager.wrapMultiImage(scaled, width, height);
|
||||||
MultiMapController controller = (MultiMapController) mapWrapper.getController();
|
MultiMapController controller = (MultiMapController) mapWrapper.getController();
|
||||||
controller.addViewer(player);
|
controller.addViewer(player);
|
||||||
@ -169,7 +176,13 @@ public class BukkitImageViewer implements ImageViewer {
|
|||||||
image = drawable.draw();
|
image = drawable.draw();
|
||||||
}
|
}
|
||||||
last = image;
|
last = image;
|
||||||
BufferedImage scaled = ImageUtil.getScaledInstance(image, 128, 128, RenderingHints.VALUE_INTERPOLATION_BILINEAR, false);
|
BufferedImage scaled = ImageUtil.getScaledInstance(
|
||||||
|
image,
|
||||||
|
128,
|
||||||
|
128,
|
||||||
|
RenderingHints.VALUE_INTERPOLATION_BILINEAR,
|
||||||
|
false
|
||||||
|
);
|
||||||
MapWrapper mapWrapper = mapManager.wrapImage(scaled);
|
MapWrapper mapWrapper = mapManager.wrapImage(scaled);
|
||||||
MapController controller = mapWrapper.getController();
|
MapController controller = mapWrapper.getController();
|
||||||
controller.addViewer(player);
|
controller.addViewer(player);
|
||||||
@ -199,4 +212,5 @@ public class BukkitImageViewer implements ImageViewer {
|
|||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
last = null;
|
last = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,12 +25,12 @@ import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
|||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.security.CodeSource;
|
import java.security.CodeSource;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
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 javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
@ -109,7 +109,8 @@ public class ClassSourceValidator {
|
|||||||
builder.append("** the version of ").append(plugin.getName()).append(" that you downloaded, you\n");
|
builder.append("** the version of ").append(plugin.getName()).append(" that you downloaded, you\n");
|
||||||
builder.append("** will be using a broken mix of old ").append(plugin.getName()).append(" (that came\n");
|
builder.append("** will be using a broken mix of old ").append(plugin.getName()).append(" (that came\n");
|
||||||
builder.append("** with the plugin) and your downloaded version. THIS MAY\n");
|
builder.append("** with the plugin) and your downloaded version. THIS MAY\n");
|
||||||
builder.append("** SEVERELY BREAK ").append(plugin.getName().toUpperCase(Locale.ROOT)).append(" AND ALL OF ITS FEATURES.\n");
|
builder.append("** SEVERELY BREAK ").append(plugin.getName().toUpperCase(Locale.ROOT)).append(
|
||||||
|
" AND ALL OF ITS FEATURES.\n");
|
||||||
builder.append("**\n");
|
builder.append("**\n");
|
||||||
builder.append("** This may have happened because the developer is using\n");
|
builder.append("** This may have happened because the developer is using\n");
|
||||||
builder.append("** the ").append(plugin.getName()).append(" API and thinks that including\n");
|
builder.append("** the ").append(plugin.getName()).append(" API and thinks that including\n");
|
||||||
@ -128,4 +129,5 @@ public class ClassSourceValidator {
|
|||||||
|
|
||||||
LOGGER.error(builder.toString());
|
LOGGER.error(builder.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,4 +29,5 @@ public interface CommandInspector {
|
|||||||
String getFullText(Command command);
|
String getFullText(Command command);
|
||||||
|
|
||||||
boolean testPermission(CommandSender sender, Command command);
|
boolean testPermission(CommandSender sender, Command command);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,10 @@ import java.util.Set;
|
|||||||
public class CommandRegistration {
|
public class CommandRegistration {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Bukkit.getServer().getHelpMap().registerHelpTopicFactory(DynamicPluginCommand.class,
|
Bukkit.getServer().getHelpMap().registerHelpTopicFactory(
|
||||||
new DynamicPluginCommandHelpTopic.Factory());
|
DynamicPluginCommand.class,
|
||||||
|
new DynamicPluginCommandHelpTopic.Factory()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Plugin plugin;
|
protected final Plugin plugin;
|
||||||
@ -72,8 +74,14 @@ public class CommandRegistration {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (CommandInfo command : registered) {
|
for (CommandInfo command : registered) {
|
||||||
DynamicPluginCommand cmd = new DynamicPluginCommand(command.getAliases(),
|
DynamicPluginCommand cmd = new DynamicPluginCommand(
|
||||||
command.getDesc(), "/" + command.getAliases()[0] + " " + command.getUsage(), executor, command.getRegisteredWith(), plugin);
|
command.getAliases(),
|
||||||
|
command.getDesc(),
|
||||||
|
"/" + command.getAliases()[0] + " " + command.getUsage(),
|
||||||
|
executor,
|
||||||
|
command.getRegisteredWith(),
|
||||||
|
plugin
|
||||||
|
);
|
||||||
cmd.setPermissions(command.getPermissions());
|
cmd.setPermissions(command.getPermissions());
|
||||||
commandMap.register(plugin.getDescription().getName(), cmd);
|
commandMap.register(plugin.getDescription().getName(), cmd);
|
||||||
}
|
}
|
||||||
@ -91,7 +99,7 @@ public class CommandRegistration {
|
|||||||
CommandMap commandMap = ReflectionUtil.getField(plugin.getServer().getPluginManager(), "commandMap");
|
CommandMap commandMap = ReflectionUtil.getField(plugin.getServer().getPluginManager(), "commandMap");
|
||||||
if (commandMap == null) {
|
if (commandMap == null) {
|
||||||
Bukkit.getServer().getLogger().severe(plugin.getDescription().getName()
|
Bukkit.getServer().getLogger().severe(plugin.getDescription().getName()
|
||||||
+ ": Could not retrieve server CommandMap, using fallback instead!");
|
+ ": Could not retrieve server CommandMap, using fallback instead!");
|
||||||
fallbackCommands = commandMap = new SimpleCommandMap(Bukkit.getServer());
|
fallbackCommands = commandMap = new SimpleCommandMap(Bukkit.getServer());
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new FallbackRegistrationListener(fallbackCommands), plugin);
|
Bukkit.getServer().getPluginManager().registerEvents(new FallbackRegistrationListener(fallbackCommands), plugin);
|
||||||
} else {
|
} else {
|
||||||
@ -108,7 +116,7 @@ public class CommandRegistration {
|
|||||||
if (knownCommands == null || aliases == null) {
|
if (knownCommands == null || aliases == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (Iterator<org.bukkit.command.Command> i = knownCommands.values().iterator(); i.hasNext();) {
|
for (Iterator<org.bukkit.command.Command> i = knownCommands.values().iterator(); i.hasNext(); ) {
|
||||||
org.bukkit.command.Command cmd = i.next();
|
org.bukkit.command.Command cmd = i.next();
|
||||||
if (cmd instanceof DynamicPluginCommand && ((DynamicPluginCommand) cmd).getOwner().equals(executor)) {
|
if (cmd instanceof DynamicPluginCommand && ((DynamicPluginCommand) cmd).getOwner().equals(executor)) {
|
||||||
i.remove();
|
i.remove();
|
||||||
|
@ -69,7 +69,13 @@ public class CommandsManagerRegistration extends CommandRegistration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toRegister.add(new CommandInfo(command.usage(), command.desc(), command.aliases(), commands, permissions == null ? null : permissions.toArray(new String[permissions.size()])));
|
toRegister.add(new CommandInfo(
|
||||||
|
command.usage(),
|
||||||
|
command.desc(),
|
||||||
|
command.aliases(),
|
||||||
|
commands,
|
||||||
|
permissions == null ? null : permissions.toArray(new String[permissions.size()])
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
return register(toRegister);
|
return register(toRegister);
|
||||||
|
@ -33,8 +33,8 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of a dynamically registered {@link org.bukkit.command.Command} attached to a plugin.
|
* An implementation of a dynamically registered {@link org.bukkit.command.Command} attached to a plugin.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class DynamicPluginCommand extends org.bukkit.command.Command implements PluginIdentifiableCommand {
|
public class DynamicPluginCommand extends org.bukkit.command.Command implements PluginIdentifiableCommand {
|
||||||
|
|
||||||
@ -43,7 +43,14 @@ public class DynamicPluginCommand extends org.bukkit.command.Command implements
|
|||||||
protected final Plugin owningPlugin;
|
protected final Plugin owningPlugin;
|
||||||
protected String[] permissions = new String[0];
|
protected String[] permissions = new String[0];
|
||||||
|
|
||||||
public DynamicPluginCommand(String[] aliases, String desc, String usage, CommandExecutor owner, Object registeredWith, Plugin plugin) {
|
public DynamicPluginCommand(
|
||||||
|
String[] aliases,
|
||||||
|
String desc,
|
||||||
|
String usage,
|
||||||
|
CommandExecutor owner,
|
||||||
|
Object registeredWith,
|
||||||
|
Plugin plugin
|
||||||
|
) {
|
||||||
super(aliases[0], desc, usage, Arrays.asList(aliases));
|
super(aliases[0], desc, usage, Arrays.asList(aliases));
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.owningPlugin = plugin;
|
this.owningPlugin = plugin;
|
||||||
@ -118,4 +125,5 @@ public class DynamicPluginCommand extends org.bukkit.command.Command implements
|
|||||||
}
|
}
|
||||||
return super.testPermissionSilent(sender);
|
return super.testPermissionSilent(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -139,10 +139,12 @@ public class DynamicPluginCommandHelpTopic extends HelpTopic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Factory implements HelpTopicFactory<DynamicPluginCommand> {
|
public static class Factory implements HelpTopicFactory<DynamicPluginCommand> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HelpTopic createTopic(DynamicPluginCommand command) {
|
public HelpTopic createTopic(DynamicPluginCommand command) {
|
||||||
return new DynamicPluginCommandHelpTopic(command);
|
return new DynamicPluginCommandHelpTopic(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class ConfigurationPermissionsResolver implements PermissionsResolver {
|
public class ConfigurationPermissionsResolver implements PermissionsResolver {
|
||||||
|
|
||||||
private final YAMLProcessor config;
|
private final YAMLProcessor config;
|
||||||
private final Map<String, Set<String>> userPermissionsCache = new HashMap<>();
|
private final Map<String, Set<String>> userPermissionsCache = new HashMap<>();
|
||||||
private final Set<String> defaultPermissionsCache = new HashSet<>();
|
private final Set<String> defaultPermissionsCache = new HashSet<>();
|
||||||
@ -41,14 +42,14 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static YAMLNode generateDefaultPerms(YAMLNode section) {
|
public static YAMLNode generateDefaultPerms(YAMLNode section) {
|
||||||
section.setProperty("groups.default.permissions", new String[] {
|
section.setProperty("groups.default.permissions", new String[]{
|
||||||
"worldedit.reload",
|
"worldedit.reload",
|
||||||
"worldedit.selection",
|
"worldedit.selection",
|
||||||
"worlds.creative.worldedit.region"
|
"worlds.creative.worldedit.region"
|
||||||
});
|
});
|
||||||
section.setProperty("groups.admins.permissions", new String[] { "*" });
|
section.setProperty("groups.admins.permissions", new String[]{"*"});
|
||||||
section.setProperty("users.sk89q.permissions", new String[] { "worldedit" });
|
section.setProperty("users.sk89q.permissions", new String[]{"worldedit"});
|
||||||
section.setProperty("users.sk89q.groups", new String[] { "admins" });
|
section.setProperty("users.sk89q.groups", new String[]{"admins"});
|
||||||
return section;
|
return section;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,4 +174,5 @@ public class DinnerPermsResolver implements PermissionsResolver {
|
|||||||
public String getDetectionMessage() {
|
public String getDetectionMessage() {
|
||||||
return "Using the Bukkit Permissions API.";
|
return "Using the Bukkit Permissions API.";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,11 @@
|
|||||||
package com.sk89q.wepif;
|
package com.sk89q.wepif;
|
||||||
|
|
||||||
import com.sk89q.util.yaml.YAMLProcessor;
|
import com.sk89q.util.yaml.YAMLProcessor;
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.Server;
|
|
||||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
@ -123,7 +124,7 @@ public class FlatFilePermissionsResolver implements PermissionsResolver {
|
|||||||
defaultPermissionsCache = userGroupPermissions.get("default");
|
defaultPermissionsCache = userGroupPermissions.get("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferedReader buff = null;
|
BufferedReader buff = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FileReader input = new FileReader(this.userFile);
|
FileReader input = new FileReader(this.userFile);
|
||||||
|
@ -28,6 +28,7 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.permissions.Permissible;
|
import org.bukkit.permissions.Permissible;
|
||||||
|
|
||||||
public class GroupManagerResolver extends DinnerPermsResolver {
|
public class GroupManagerResolver extends DinnerPermsResolver {
|
||||||
|
|
||||||
private final WorldsHolder worldsHolder;
|
private final WorldsHolder worldsHolder;
|
||||||
|
|
||||||
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
|
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
|
||||||
@ -128,4 +129,5 @@ public class GroupManagerResolver extends DinnerPermsResolver {
|
|||||||
public String getDetectionMessage() {
|
public String getDetectionMessage() {
|
||||||
return "GroupManager detected! Using GroupManager for permissions.";
|
return "GroupManager detected! Using GroupManager for permissions.";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ public class NijiPermissionsResolver implements PermissionsResolver {
|
|||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
String group = Permissions.Security.getGroup(player.getWorld().getName(), player.getName());
|
String group = Permissions.Security.getGroup(player.getWorld().getName(), player.getName());
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
groups = new String[] { group };
|
groups = new String[]{group};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (groups == null) {
|
if (groups == null) {
|
||||||
|
@ -27,6 +27,7 @@ import ru.tehkode.permissions.PermissionManager;
|
|||||||
import ru.tehkode.permissions.PermissionUser;
|
import ru.tehkode.permissions.PermissionUser;
|
||||||
|
|
||||||
public class PermissionsExResolver extends DinnerPermsResolver {
|
public class PermissionsExResolver extends DinnerPermsResolver {
|
||||||
|
|
||||||
private final PermissionManager manager;
|
private final PermissionManager manager;
|
||||||
|
|
||||||
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
|
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
|
||||||
@ -90,4 +91,5 @@ public class PermissionsExResolver extends DinnerPermsResolver {
|
|||||||
public String getDetectionMessage() {
|
public String getDetectionMessage() {
|
||||||
return "PermissionsEx detected! Using PermissionsEx for permissions.";
|
return "PermissionsEx detected! Using PermissionsEx for permissions.";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ package com.sk89q.wepif;
|
|||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
|
||||||
public interface PermissionsProvider {
|
public interface PermissionsProvider {
|
||||||
|
|
||||||
boolean hasPermission(String name, String permission);
|
boolean hasPermission(String name, String permission);
|
||||||
|
|
||||||
boolean hasPermission(String worldName, String name, String permission);
|
boolean hasPermission(String worldName, String name, String permission);
|
||||||
@ -37,4 +38,5 @@ public interface PermissionsProvider {
|
|||||||
boolean inGroup(OfflinePlayer player, String group);
|
boolean inGroup(OfflinePlayer player, String group);
|
||||||
|
|
||||||
String[] getGroups(OfflinePlayer player);
|
String[] getGroups(OfflinePlayer player);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
package com.sk89q.wepif;
|
package com.sk89q.wepif;
|
||||||
|
|
||||||
public interface PermissionsResolver extends PermissionsProvider {
|
public interface PermissionsResolver extends PermissionsProvider {
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
String getDetectionMessage();
|
String getDetectionMessage();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,23 +41,23 @@ import java.util.List;
|
|||||||
public class PermissionsResolverManager implements PermissionsResolver {
|
public class PermissionsResolverManager implements PermissionsResolver {
|
||||||
|
|
||||||
private static final String CONFIG_HEADER = "#\r\n"
|
private static final String CONFIG_HEADER = "#\r\n"
|
||||||
+ "# WEPIF Configuration File\r\n"
|
+ "# WEPIF Configuration File\r\n"
|
||||||
+ "#\r\n"
|
+ "#\r\n"
|
||||||
+ "# This file handles permissions configuration for every plugin using WEPIF\r\n"
|
+ "# This file handles permissions configuration for every plugin using WEPIF\r\n"
|
||||||
+ "#\r\n"
|
+ "#\r\n"
|
||||||
+ "# About editing this file:\r\n"
|
+ "# About editing this file:\r\n"
|
||||||
+ "# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If\r\n"
|
+ "# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If\r\n"
|
||||||
+ "# you use an editor like Notepad++ (recommended for Windows users), you\r\n"
|
+ "# you use an editor like Notepad++ (recommended for Windows users), you\r\n"
|
||||||
+ "# must configure it to \"replace tabs with spaces.\" In Notepad++, this can\r\n"
|
+ "# must configure it to \"replace tabs with spaces.\" In Notepad++, this can\r\n"
|
||||||
+ "# be changed in Settings > Preferences > Language Menu.\r\n"
|
+ "# be changed in Settings > Preferences > Language Menu.\r\n"
|
||||||
+ "# - Don't get rid of the indents. They are indented so some entries are\r\n"
|
+ "# - Don't get rid of the indents. They are indented so some entries are\r\n"
|
||||||
+ "# in categories (like \"enforce-single-session\" is in the \"protection\"\r\n"
|
+ "# in categories (like \"enforce-single-session\" is in the \"protection\"\r\n"
|
||||||
+ "# category.\r\n"
|
+ "# category.\r\n"
|
||||||
+ "# - If you want to check the format of this file before putting it\r\n"
|
+ "# - If you want to check the format of this file before putting it\r\n"
|
||||||
+ "# into WEPIF, paste it into https://yaml-online-parser.appspot.com/\r\n"
|
+ "# into WEPIF, paste it into https://yaml-online-parser.appspot.com/\r\n"
|
||||||
+ "# and see if it gives \"ERROR:\".\r\n"
|
+ "# and see if it gives \"ERROR:\".\r\n"
|
||||||
+ "# - Lines starting with # are comments and so they are ignored.\r\n"
|
+ "# - Lines starting with # are comments and so they are ignored.\r\n"
|
||||||
+ "\r\n";
|
+ "\r\n";
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||||
|
|
||||||
@ -86,15 +86,15 @@ public class PermissionsResolverManager implements PermissionsResolver {
|
|||||||
private final List<Class<? extends PermissionsResolver>> enabledResolvers = new ArrayList<>();
|
private final List<Class<? extends PermissionsResolver>> enabledResolvers = new ArrayList<>();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
protected Class<? extends PermissionsResolver>[] availableResolvers = new Class[] {
|
protected Class<? extends PermissionsResolver>[] availableResolvers = new Class[]{
|
||||||
PluginPermissionsResolver.class,
|
PluginPermissionsResolver.class,
|
||||||
PermissionsExResolver.class,
|
PermissionsExResolver.class,
|
||||||
bPermissionsResolver.class,
|
bPermissionsResolver.class,
|
||||||
GroupManagerResolver.class,
|
GroupManagerResolver.class,
|
||||||
NijiPermissionsResolver.class,
|
NijiPermissionsResolver.class,
|
||||||
VaultResolver.class,
|
VaultResolver.class,
|
||||||
DinnerPermsResolver.class,
|
DinnerPermsResolver.class,
|
||||||
FlatFilePermissionsResolver.class
|
FlatFilePermissionsResolver.class
|
||||||
};
|
};
|
||||||
|
|
||||||
protected PermissionsResolverManager(Plugin plugin) {
|
protected PermissionsResolverManager(Plugin plugin) {
|
||||||
@ -221,7 +221,7 @@ public class PermissionsResolverManager implements PermissionsResolver {
|
|||||||
} else {
|
} else {
|
||||||
List<String> disabledResolvers = config.getStringList("resolvers.disabled", new ArrayList<>());
|
List<String> disabledResolvers = config.getStringList("resolvers.disabled", new ArrayList<>());
|
||||||
List<String> stagedEnabled = config.getStringList("resolvers.enabled", null);
|
List<String> stagedEnabled = config.getStringList("resolvers.enabled", null);
|
||||||
for (Iterator<String> i = stagedEnabled.iterator(); i.hasNext();) {
|
for (Iterator<String> i = stagedEnabled.iterator(); i.hasNext(); ) {
|
||||||
String nextName = i.next();
|
String nextName = i.next();
|
||||||
Class<?> next = null;
|
Class<?> next = null;
|
||||||
try {
|
try {
|
||||||
@ -242,11 +242,11 @@ public class PermissionsResolverManager implements PermissionsResolver {
|
|||||||
|
|
||||||
for (Class<?> clazz : availableResolvers) {
|
for (Class<?> clazz : availableResolvers) {
|
||||||
if (!stagedEnabled.contains(clazz.getSimpleName())
|
if (!stagedEnabled.contains(clazz.getSimpleName())
|
||||||
&& !disabledResolvers.contains(clazz.getSimpleName())) {
|
&& !disabledResolvers.contains(clazz.getSimpleName())) {
|
||||||
disabledResolvers.add(clazz.getSimpleName());
|
disabledResolvers.add(clazz.getSimpleName());
|
||||||
LOGGER.info("New permissions resolver: "
|
LOGGER.info("New permissions resolver: "
|
||||||
+ clazz.getSimpleName() + " detected. "
|
+ clazz.getSimpleName() + " detected. "
|
||||||
+ "Added to disabled resolvers list.");
|
+ "Added to disabled resolvers list.");
|
||||||
isUpdated = true;
|
isUpdated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -272,9 +272,11 @@ public class PermissionsResolverManager implements PermissionsResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class MissingPluginException extends Exception {
|
public static class MissingPluginException extends Exception {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ServerListener implements org.bukkit.event.Listener {
|
class ServerListener implements org.bukkit.event.Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPluginEnable(PluginEnableEvent event) {
|
public void onPluginEnable(PluginEnableEvent event) {
|
||||||
Plugin plugin = event.getPlugin();
|
Plugin plugin = event.getPlugin();
|
||||||
@ -303,6 +305,7 @@ public class PermissionsResolverManager implements PermissionsResolver {
|
|||||||
void register(Plugin plugin) {
|
void register(Plugin plugin) {
|
||||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,8 @@ public class PluginPermissionsResolver implements PermissionsResolver {
|
|||||||
|
|
||||||
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
|
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
|
||||||
// Looking for service
|
// Looking for service
|
||||||
RegisteredServiceProvider<PermissionsProvider> serviceProvider = server.getServicesManager().getRegistration(PermissionsProvider.class);
|
RegisteredServiceProvider<PermissionsProvider> serviceProvider = server.getServicesManager().getRegistration(
|
||||||
|
PermissionsProvider.class);
|
||||||
|
|
||||||
if (serviceProvider != null) {
|
if (serviceProvider != null) {
|
||||||
return new PluginPermissionsResolver(serviceProvider.getProvider(), serviceProvider.getPlugin());
|
return new PluginPermissionsResolver(serviceProvider.getProvider(), serviceProvider.getPlugin());
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.bukkit;
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
|
import com.fastasyncworldedit.bukkit.adapter.IBukkitAdapter;
|
||||||
|
import com.fastasyncworldedit.bukkit.adapter.SimpleBukkitAdapter;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||||
import com.fastasyncworldedit.bukkit.adapter.IBukkitAdapter;
|
|
||||||
import com.fastasyncworldedit.bukkit.adapter.SimpleBukkitAdapter;
|
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
@ -49,9 +49,9 @@ import org.bukkit.block.data.BlockData;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -89,7 +89,7 @@ public enum BukkitAdapter {
|
|||||||
* Checks equality between a WorldEdit BlockType and a Bukkit Material.
|
* Checks equality between a WorldEdit BlockType and a Bukkit Material.
|
||||||
*
|
*
|
||||||
* @param blockType The WorldEdit BlockType
|
* @param blockType The WorldEdit BlockType
|
||||||
* @param type The Bukkit Material
|
* @param type The Bukkit Material
|
||||||
* @return If they are equal
|
* @return If they are equal
|
||||||
*/
|
*/
|
||||||
public static boolean equals(BlockType blockType, Material type) {
|
public static boolean equals(BlockType blockType, Material type) {
|
||||||
@ -184,11 +184,16 @@ public enum BukkitAdapter {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
switch (face) {
|
switch (face) {
|
||||||
case NORTH: return Direction.NORTH;
|
case NORTH:
|
||||||
case SOUTH: return Direction.SOUTH;
|
return Direction.NORTH;
|
||||||
case WEST: return Direction.WEST;
|
case SOUTH:
|
||||||
case EAST: return Direction.EAST;
|
return Direction.SOUTH;
|
||||||
case DOWN: return Direction.DOWN;
|
case WEST:
|
||||||
|
return Direction.WEST;
|
||||||
|
case EAST:
|
||||||
|
return Direction.EAST;
|
||||||
|
case DOWN:
|
||||||
|
return Direction.DOWN;
|
||||||
case UP:
|
case UP:
|
||||||
default:
|
default:
|
||||||
return Direction.UP;
|
return Direction.UP;
|
||||||
@ -220,7 +225,8 @@ public enum BukkitAdapter {
|
|||||||
adapt(location.getWorld()),
|
adapt(location.getWorld()),
|
||||||
position,
|
position,
|
||||||
location.getYaw(),
|
location.getYaw(),
|
||||||
location.getPitch());
|
location.getPitch()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -236,13 +242,14 @@ public enum BukkitAdapter {
|
|||||||
adapt((World) location.getExtent()),
|
adapt((World) location.getExtent()),
|
||||||
position.getX(), position.getY(), position.getZ(),
|
position.getX(), position.getY(), position.getZ(),
|
||||||
location.getYaw(),
|
location.getYaw(),
|
||||||
location.getPitch());
|
location.getPitch()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Bukkit location from a WorldEdit position with a Bukkit world.
|
* Create a Bukkit location from a WorldEdit position with a Bukkit world.
|
||||||
*
|
*
|
||||||
* @param world the Bukkit world
|
* @param world the Bukkit world
|
||||||
* @param position the WorldEdit position
|
* @param position the WorldEdit position
|
||||||
* @return a Bukkit location
|
* @return a Bukkit location
|
||||||
*/
|
*/
|
||||||
@ -251,13 +258,14 @@ public enum BukkitAdapter {
|
|||||||
checkNotNull(position);
|
checkNotNull(position);
|
||||||
return new org.bukkit.Location(
|
return new org.bukkit.Location(
|
||||||
world,
|
world,
|
||||||
position.getX(), position.getY(), position.getZ());
|
position.getX(), position.getY(), position.getZ()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Bukkit location from a WorldEdit position with a Bukkit world.
|
* Create a Bukkit location from a WorldEdit position with a Bukkit world.
|
||||||
*
|
*
|
||||||
* @param world the Bukkit world
|
* @param world the Bukkit world
|
||||||
* @param position the WorldEdit position
|
* @param position the WorldEdit position
|
||||||
* @return a Bukkit location
|
* @return a Bukkit location
|
||||||
*/
|
*/
|
||||||
@ -266,13 +274,14 @@ public enum BukkitAdapter {
|
|||||||
checkNotNull(position);
|
checkNotNull(position);
|
||||||
return new org.bukkit.Location(
|
return new org.bukkit.Location(
|
||||||
world,
|
world,
|
||||||
position.getX(), position.getY(), position.getZ());
|
position.getX(), position.getY(), position.getZ()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Bukkit location from a WorldEdit location with a Bukkit world.
|
* Create a Bukkit location from a WorldEdit location with a Bukkit world.
|
||||||
*
|
*
|
||||||
* @param world the Bukkit world
|
* @param world the Bukkit world
|
||||||
* @param location the WorldEdit location
|
* @param location the WorldEdit location
|
||||||
* @return a Bukkit location
|
* @return a Bukkit location
|
||||||
*/
|
*/
|
||||||
@ -283,7 +292,8 @@ public enum BukkitAdapter {
|
|||||||
world,
|
world,
|
||||||
location.getX(), location.getY(), location.getZ(),
|
location.getX(), location.getY(), location.getZ(),
|
||||||
location.getYaw(),
|
location.getYaw(),
|
||||||
location.getPitch());
|
location.getPitch()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -392,8 +402,8 @@ public enum BukkitAdapter {
|
|||||||
//FAWE end
|
//FAWE end
|
||||||
}
|
}
|
||||||
|
|
||||||
private static EnumMap<Material, BlockType> materialBlockTypeCache = new EnumMap<>(Material.class);
|
private static final EnumMap<Material, BlockType> materialBlockTypeCache = new EnumMap<>(Material.class);
|
||||||
private static EnumMap<Material, ItemType> materialItemTypeCache = new EnumMap<>(Material.class);
|
private static final EnumMap<Material, ItemType> materialItemTypeCache = new EnumMap<>(Material.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a Material to a BlockType.
|
* Converts a Material to a BlockType.
|
||||||
@ -421,8 +431,8 @@ public enum BukkitAdapter {
|
|||||||
//FAWE end
|
//FAWE end
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Int2ObjectMap<BlockState> blockStateCache = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<BlockState> blockStateCache = new Int2ObjectOpenHashMap<>();
|
||||||
private static Map<String, BlockState> blockStateStringCache = new HashMap<>();
|
private static final Map<String, BlockState> blockStateStringCache = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a WorldEdit BlockState from a Bukkit BlockData.
|
* Create a WorldEdit BlockState from a Bukkit BlockData.
|
||||||
@ -436,7 +446,7 @@ public enum BukkitAdapter {
|
|||||||
//FAWE end
|
//FAWE end
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Int2ObjectMap<BlockData> blockDataCache = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<BlockData> blockDataCache = new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Bukkit BlockData from a WorldEdit BlockStateHolder.
|
* Create a Bukkit BlockData from a WorldEdit BlockStateHolder.
|
||||||
|
@ -40,7 +40,7 @@ class BukkitBiomeRegistry implements BiomeRegistry {
|
|||||||
@Override
|
@Override
|
||||||
public Component getRichName(BiomeType biomeType) {
|
public Component getRichName(BiomeType biomeType) {
|
||||||
return TranslatableComponent.of(
|
return TranslatableComponent.of(
|
||||||
TranslationManager.makeTranslationKey("biome", biomeType.getId())
|
TranslationManager.makeTranslationKey("biome", biomeType.getId())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,8 +39,9 @@ public class BukkitBlockCategoryRegistry implements BlockCategoryRegistry {
|
|||||||
public Set<BlockType> getCategorisedByName(String category) {
|
public Set<BlockType> getCategorisedByName(String category) {
|
||||||
String[] split = category.split(":");
|
String[] split = category.split(":");
|
||||||
String namespace = split.length > 1 ? split[0] : "minecraft";
|
String namespace = split.length > 1 ? split[0] : "minecraft";
|
||||||
String key = split.length > 1 ? split[1] : category;
|
String key = split.length > 1 ? split[1] : category;
|
||||||
Tag<Material> tag = Bukkit.getTag(Tag.REGISTRY_BLOCKS, new NamespacedKey(namespace, key), Material.class);
|
Tag<Material> tag = Bukkit.getTag(Tag.REGISTRY_BLOCKS, new NamespacedKey(namespace, key), Material.class);
|
||||||
return getFromBukkitTag(tag);
|
return getFromBukkitTag(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,8 @@ import com.sk89q.worldedit.util.formatting.text.adapter.bukkit.TextAdapter;
|
|||||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.command.BlockCommandSender;
|
import org.bukkit.command.BlockCommandSender;
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -192,11 +190,13 @@ public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements
|
|||||||
updateActive();
|
updateActive();
|
||||||
} else {
|
} else {
|
||||||
// we should update it eventually
|
// we should update it eventually
|
||||||
Bukkit.getScheduler().callSyncMethod(plugin,
|
Bukkit.getScheduler().callSyncMethod(
|
||||||
|
plugin,
|
||||||
() -> {
|
() -> {
|
||||||
updateActive();
|
updateActive();
|
||||||
return null;
|
return null;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
@ -212,4 +212,5 @@ public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
package com.sk89q.worldedit.bukkit;
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
|
||||||
import com.sk89q.worldedit.registry.state.Property;
|
import com.sk89q.worldedit.registry.state.Property;
|
||||||
|
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||||
@ -30,11 +30,11 @@ import com.sk89q.worldedit.world.registry.PassthroughBlockMaterial;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
public class BukkitBlockRegistry extends BundledBlockRegistry {
|
public class BukkitBlockRegistry extends BundledBlockRegistry {
|
||||||
|
|
||||||
@ -144,6 +144,7 @@ public class BukkitBlockRegistry extends BundledBlockRegistry {
|
|||||||
public boolean isTranslucent() {
|
public boolean isTranslucent() {
|
||||||
return material.isTransparent();
|
return material.isTransparent();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//FAWE start
|
//FAWE start
|
||||||
|
@ -77,11 +77,12 @@ class BukkitCommandInspector implements CommandInspector {
|
|||||||
if (mapping.isPresent()) {
|
if (mapping.isPresent()) {
|
||||||
InjectedValueStore store = MapBackedValueStore.create();
|
InjectedValueStore store = MapBackedValueStore.create();
|
||||||
store.injectValue(Key.of(Actor.class), context ->
|
store.injectValue(Key.of(Actor.class), context ->
|
||||||
Optional.of(plugin.wrapCommandSender(sender)));
|
Optional.of(plugin.wrapCommandSender(sender)));
|
||||||
return mapping.get().getCondition().satisfied(store);
|
return mapping.get().getCondition().satisfied(store);
|
||||||
} else {
|
} else {
|
||||||
LOGGER.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
|
LOGGER.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,9 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
@ -114,7 +114,8 @@ public class BukkitCommandSender extends AbstractNonPlayerActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//FAWE start
|
//FAWE start
|
||||||
@Override public void setPermission(String permission, boolean value) {
|
@Override
|
||||||
|
public void setPermission(String permission, boolean value) {
|
||||||
}
|
}
|
||||||
//FAWE end
|
//FAWE end
|
||||||
|
|
||||||
@ -162,4 +163,5 @@ public class BukkitCommandSender extends AbstractNonPlayerActor {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,8 @@ public class BukkitConfiguration extends YAMLConfiguration {
|
|||||||
|
|
||||||
public boolean noOpPermissions = false;
|
public boolean noOpPermissions = false;
|
||||||
public boolean commandBlockSupport = false;
|
public boolean commandBlockSupport = false;
|
||||||
@Unreported private final WorldEditPlugin plugin;
|
@Unreported
|
||||||
|
private final WorldEditPlugin plugin;
|
||||||
|
|
||||||
public BukkitConfiguration(YAMLProcessor config, WorldEditPlugin plugin) {
|
public BukkitConfiguration(YAMLProcessor config, WorldEditPlugin plugin) {
|
||||||
super(config, LogManager.getLogger(plugin.getLogger().getName()));
|
super(config, LogManager.getLogger(plugin.getLogger().getName()));
|
||||||
@ -72,4 +73,5 @@ public class BukkitConfiguration extends YAMLConfiguration {
|
|||||||
public Path getWorkingDirectoryPath() {
|
public Path getWorkingDirectoryPath() {
|
||||||
return plugin.getDataFolder().toPath();
|
return plugin.getDataFolder().toPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,12 +27,10 @@ import com.sk89q.worldedit.entity.metadata.EntityProperties;
|
|||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.NullWorld;
|
import com.sk89q.worldedit.world.NullWorld;
|
||||||
import com.sk89q.worldedit.world.entity.EntityTypes;
|
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.util.Locale;
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
@ -136,4 +134,5 @@ public class BukkitEntity implements Entity {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -170,4 +170,5 @@ class BukkitEntityProperties implements EntityProperties {
|
|||||||
public boolean isWaterCreature() {
|
public boolean isWaterCreature() {
|
||||||
return entity instanceof WaterMob;
|
return entity instanceof WaterMob;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,9 @@ public class BukkitItemCategoryRegistry implements ItemCategoryRegistry {
|
|||||||
public Set<ItemType> getCategorisedByName(String category) {
|
public Set<ItemType> getCategorisedByName(String category) {
|
||||||
String[] split = category.split(":");
|
String[] split = category.split(":");
|
||||||
String namespace = split.length > 1 ? split[0] : "minecraft";
|
String namespace = split.length > 1 ? split[0] : "minecraft";
|
||||||
String key = split.length > 1 ? split[1] : category;
|
String key = split.length > 1 ? split[1] : category;
|
||||||
Tag<Material> tag = Bukkit.getTag(Tag.REGISTRY_ITEMS, new NamespacedKey(namespace, key), Material.class);
|
Tag<Material> tag = Bukkit.getTag(Tag.REGISTRY_ITEMS, new NamespacedKey(namespace, key), Material.class);
|
||||||
return getFromBukkitTag(tag);
|
return getFromBukkitTag(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
class BukkitItemRegistry extends BundledItemRegistry {
|
class BukkitItemRegistry extends BundledItemRegistry {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getRichName(ItemType itemType) {
|
public Component getRichName(ItemType itemType) {
|
||||||
if (WorldEditPlugin.getInstance().getBukkitImplAdapter() != null) {
|
if (WorldEditPlugin.getInstance().getBukkitImplAdapter() != null) {
|
||||||
|
@ -21,8 +21,8 @@ package com.sk89q.worldedit.bukkit;
|
|||||||
|
|
||||||
import com.fastasyncworldedit.core.configuration.Caption;
|
import com.fastasyncworldedit.core.configuration.Caption;
|
||||||
import com.fastasyncworldedit.core.configuration.Settings;
|
import com.fastasyncworldedit.core.configuration.Settings;
|
||||||
import com.fastasyncworldedit.core.util.task.RunnableVal;
|
|
||||||
import com.fastasyncworldedit.core.util.TaskManager;
|
import com.fastasyncworldedit.core.util.TaskManager;
|
||||||
|
import com.fastasyncworldedit.core.util.task.RunnableVal;
|
||||||
import com.sk89q.util.StringUtil;
|
import com.sk89q.util.StringUtil;
|
||||||
import com.sk89q.wepif.VaultResolver;
|
import com.sk89q.wepif.VaultResolver;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
@ -63,14 +63,14 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
import org.bukkit.permissions.PermissionAttachment;
|
import org.bukkit.permissions.PermissionAttachment;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
public class BukkitPlayer extends AbstractPlayerActor {
|
public class BukkitPlayer extends AbstractPlayerActor {
|
||||||
|
|
||||||
@ -236,7 +236,14 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
|||||||
}
|
}
|
||||||
org.bukkit.World finalWorld = world;
|
org.bukkit.World finalWorld = world;
|
||||||
//FAWE end
|
//FAWE end
|
||||||
return TaskManager.IMP.sync(() -> player.teleport(new Location(finalWorld, pos.getX(), pos.getY(), pos.getZ(), yaw, pitch)));
|
return TaskManager.IMP.sync(() -> player.teleport(new Location(
|
||||||
|
finalWorld,
|
||||||
|
pos.getX(),
|
||||||
|
pos.getY(),
|
||||||
|
pos.getZ(),
|
||||||
|
yaw,
|
||||||
|
pitch
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -263,7 +270,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
|||||||
public boolean hasPermission(String perm) {
|
public boolean hasPermission(String perm) {
|
||||||
return (!plugin.getLocalConfiguration().noOpPermissions && player.isOp())
|
return (!plugin.getLocalConfiguration().noOpPermissions && player.isOp())
|
||||||
|| plugin.getPermissionsResolver().hasPermission(
|
|| plugin.getPermissionsResolver().hasPermission(
|
||||||
player.getWorld().getName(), player, perm);
|
player.getWorld().getName(), player, perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
//FAWE start
|
//FAWE start
|
||||||
@ -333,7 +340,8 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
|||||||
getWorld(),
|
getWorld(),
|
||||||
position,
|
position,
|
||||||
nativeLocation.getYaw(),
|
nativeLocation.getYaw(),
|
||||||
nativeLocation.getPitch());
|
nativeLocation.getPitch()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -350,9 +358,11 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
|||||||
public void sendAnnouncements() {
|
public void sendAnnouncements() {
|
||||||
if (WorldEditPlugin.getInstance().getLifecycledBukkitImplAdapter() == null) {
|
if (WorldEditPlugin.getInstance().getLifecycledBukkitImplAdapter() == null) {
|
||||||
//FAWE start - swap out EH download url with ours
|
//FAWE start - swap out EH download url with ours
|
||||||
print(Caption.of("worldedit.version.bukkit.unsupported-adapter",
|
print(Caption.of(
|
||||||
|
"worldedit.version.bukkit.unsupported-adapter",
|
||||||
TextComponent.of("https://intellectualsites.github.io/download/fawe.html", TextColor.AQUA)
|
TextComponent.of("https://intellectualsites.github.io/download/fawe.html", TextColor.AQUA)
|
||||||
.clickEvent(ClickEvent.openUrl("https://intellectualsites.github.io/download/fawe.html"))));
|
.clickEvent(ClickEvent.openUrl("https://intellectualsites.github.io/download/fawe.html"))
|
||||||
|
));
|
||||||
//FAWE end
|
//FAWE end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,13 +19,13 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.bukkit;
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
|
import com.fastasyncworldedit.core.extent.inventory.SlottableBlockBag;
|
||||||
import com.sk89q.worldedit.blocks.BaseItem;
|
import com.sk89q.worldedit.blocks.BaseItem;
|
||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBagException;
|
import com.sk89q.worldedit.extent.inventory.BlockBagException;
|
||||||
import com.sk89q.worldedit.extent.inventory.OutOfBlocksException;
|
import com.sk89q.worldedit.extent.inventory.OutOfBlocksException;
|
||||||
import com.sk89q.worldedit.extent.inventory.OutOfSpaceException;
|
import com.sk89q.worldedit.extent.inventory.OutOfSpaceException;
|
||||||
import com.fastasyncworldedit.core.extent.inventory.SlottableBlockBag;
|
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -35,7 +35,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
public class BukkitPlayerBlockBag extends BlockBag implements SlottableBlockBag {
|
public class BukkitPlayerBlockBag extends BlockBag implements SlottableBlockBag {
|
||||||
//FAWE end
|
//FAWE end
|
||||||
|
|
||||||
private Player player;
|
private final Player player;
|
||||||
private ItemStack[] items;
|
private ItemStack[] items;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -194,7 +194,11 @@ public class BukkitPlayerBlockBag extends BlockBag implements SlottableBlockBag
|
|||||||
@Override
|
@Override
|
||||||
public void setItem(int slot, BaseItem block) {
|
public void setItem(int slot, BaseItem block) {
|
||||||
loadInventory();
|
loadInventory();
|
||||||
BaseItemStack stack = block instanceof BaseItemStack ? (BaseItemStack) block : new BaseItemStack(block.getType(), block.getNbtData(), 1);
|
BaseItemStack stack = block instanceof BaseItemStack ? (BaseItemStack) block : new BaseItemStack(
|
||||||
|
block.getType(),
|
||||||
|
block.getNbtData(),
|
||||||
|
1
|
||||||
|
);
|
||||||
items[slot] = BukkitAdapter.adapt(stack);
|
items[slot] = BukkitAdapter.adapt(stack);
|
||||||
}
|
}
|
||||||
//FAWE end
|
//FAWE end
|
||||||
|
@ -23,7 +23,6 @@ import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
|||||||
import com.sk89q.worldedit.world.registry.BlockCategoryRegistry;
|
import com.sk89q.worldedit.world.registry.BlockCategoryRegistry;
|
||||||
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
||||||
import com.sk89q.worldedit.world.registry.BundledRegistries;
|
import com.sk89q.worldedit.world.registry.BundledRegistries;
|
||||||
import com.sk89q.worldedit.world.registry.EntityRegistry;
|
|
||||||
import com.sk89q.worldedit.world.registry.ItemCategoryRegistry;
|
import com.sk89q.worldedit.world.registry.ItemCategoryRegistry;
|
||||||
import com.sk89q.worldedit.world.registry.ItemRegistry;
|
import com.sk89q.worldedit.world.registry.ItemRegistry;
|
||||||
|
|
||||||
|
@ -45,8 +45,9 @@ import org.bukkit.Server;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.enginehub.piston.CommandManager;
|
import org.enginehub.piston.CommandManager;
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
@ -55,7 +56,6 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import static com.sk89q.worldedit.util.formatting.WorldEditText.reduceToText;
|
import static com.sk89q.worldedit.util.formatting.WorldEditText.reduceToText;
|
||||||
|
|
||||||
@ -116,8 +116,7 @@ public class BukkitServerInterface extends AbstractPlatform implements MultiUser
|
|||||||
if (!type.startsWith("minecraft:")) {
|
if (!type.startsWith("minecraft:")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation") final EntityType entityType = EntityType.fromName(type.substring(10));
|
||||||
final EntityType entityType = EntityType.fromName(type.substring(10));
|
|
||||||
return entityType != null && entityType.isAlive();
|
return entityType != null && entityType.isAlive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,22 +174,29 @@ public class BukkitServerInterface extends AbstractPlatform implements MultiUser
|
|||||||
BukkitCommandInspector inspector = new BukkitCommandInspector(plugin, dispatcher);
|
BukkitCommandInspector inspector = new BukkitCommandInspector(plugin, dispatcher);
|
||||||
|
|
||||||
dynamicCommands.register(dispatcher.getAllCommands()
|
dynamicCommands.register(dispatcher.getAllCommands()
|
||||||
.map(command -> {
|
.map(command -> {
|
||||||
String[] permissionsArray = command.getCondition()
|
String[] permissionsArray = command.getCondition()
|
||||||
.as(PermissionCondition.class)
|
.as(PermissionCondition.class)
|
||||||
.map(PermissionCondition::getPermissions)
|
.map(PermissionCondition::getPermissions)
|
||||||
.map(s -> s.toArray(new String[0]))
|
.map(s -> s.toArray(new String[0]))
|
||||||
.orElseGet(() -> new String[0]);
|
.orElseGet(() -> new String[0]);
|
||||||
|
|
||||||
String[] aliases = Stream.concat(
|
String[] aliases = Stream.concat(
|
||||||
Stream.of(command.getName()),
|
Stream.of(command.getName()),
|
||||||
command.getAliases().stream()
|
command.getAliases().stream()
|
||||||
).toArray(String[]::new);
|
).toArray(String[]::new);
|
||||||
// TODO Handle localisation correctly
|
// TODO Handle localisation correctly
|
||||||
return new CommandInfo(reduceToText(command.getUsage(), WorldEdit.getInstance().getConfiguration().defaultLocale),
|
return new CommandInfo(
|
||||||
reduceToText(command.getDescription(), WorldEdit.getInstance().getConfiguration().defaultLocale), aliases,
|
reduceToText(
|
||||||
inspector, permissionsArray);
|
command.getUsage(),
|
||||||
}).collect(Collectors.toList()));
|
WorldEdit.getInstance().getConfiguration().defaultLocale
|
||||||
|
),
|
||||||
|
reduceToText(command.getDescription(), WorldEdit.getInstance().getConfiguration().defaultLocale),
|
||||||
|
aliases,
|
||||||
|
inspector,
|
||||||
|
permissionsArray
|
||||||
|
);
|
||||||
|
}).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -264,7 +270,8 @@ public class BukkitServerInterface extends AbstractPlatform implements MultiUser
|
|||||||
|
|
||||||
//FAWE start
|
//FAWE start
|
||||||
@Override
|
@Override
|
||||||
public @Nonnull RelighterFactory getRelighterFactory() {
|
public @Nonnull
|
||||||
|
RelighterFactory getRelighterFactory() {
|
||||||
if (this.relighterFactory == null) {
|
if (this.relighterFactory == null) {
|
||||||
this.relighterFactory = this.plugin.getBukkitImplAdapter().getRelighterFactory();
|
this.relighterFactory = this.plugin.getBukkitImplAdapter().getRelighterFactory();
|
||||||
LOGGER.info("Using " + this.relighterFactory.getClass().getCanonicalName() + " as relighter factory.");
|
LOGGER.info("Using " + this.relighterFactory.getClass().getCanonicalName() + " as relighter factory.");
|
||||||
|
@ -177,6 +177,7 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//FAWE start
|
//FAWE start
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the world handle.
|
* Get the world handle.
|
||||||
*
|
*
|
||||||
@ -332,7 +333,8 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
pt = pt.add(0, 1, 0); // bukkit skips the feature gen which does this offset normally, so we have to add it back
|
pt = pt.add(0, 1, 0); // bukkit skips the feature gen which does this offset normally, so we have to add it back
|
||||||
}
|
}
|
||||||
return type != null && world.generateTree(BukkitAdapter.adapt(world, pt), bukkitType,
|
return type != null && world.generateTree(BukkitAdapter.adapt(world, pt), bukkitType,
|
||||||
new EditSessionBlockChangeDelegate(editSession));
|
new EditSessionBlockChangeDelegate(editSession)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -505,7 +507,7 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (block instanceof BaseBlock && ((BaseBlock) block).getNbt() != null) {
|
if (block instanceof BaseBlock && ((BaseBlock) block).getNbt() != null) {
|
||||||
LOGGER.warn("Tried to set a corrupt tile entity at " + position.toString()
|
LOGGER.warn("Tried to set a corrupt tile entity at " + position.toString()
|
||||||
+ ": " + ((BaseBlock) block).getNbt(), e);
|
+ ": " + ((BaseBlock) block).getNbt(), e);
|
||||||
} else {
|
} else {
|
||||||
LOGGER.warn("Failed to set block via adapter, falling back to generic", e);
|
LOGGER.warn("Failed to set block via adapter, falling back to generic", e);
|
||||||
}
|
}
|
||||||
@ -527,8 +529,10 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SideEffect> applySideEffects(BlockVector3 position, com.sk89q.worldedit.world.block.BlockState previousType,
|
public Set<SideEffect> applySideEffects(
|
||||||
SideEffectSet sideEffectSet) {
|
BlockVector3 position, com.sk89q.worldedit.world.block.BlockState previousType,
|
||||||
|
SideEffectSet sideEffectSet
|
||||||
|
) {
|
||||||
if (worldNativeAccess != null) {
|
if (worldNativeAccess != null) {
|
||||||
worldNativeAccess.applySideEffects(position, previousType, sideEffectSet);
|
worldNativeAccess.applySideEffects(position, previousType, sideEffectSet);
|
||||||
return Sets.intersection(
|
return Sets.intersection(
|
||||||
|
@ -23,7 +23,6 @@ import com.sk89q.worldedit.LocalSession;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +29,7 @@ import org.bukkit.block.data.BlockData;
|
|||||||
*/
|
*/
|
||||||
public class EditSessionBlockChangeDelegate implements BlockChangeDelegate {
|
public class EditSessionBlockChangeDelegate implements BlockChangeDelegate {
|
||||||
|
|
||||||
private EditSession editSession;
|
private final EditSession editSession;
|
||||||
|
|
||||||
public EditSessionBlockChangeDelegate(EditSession editSession) {
|
public EditSessionBlockChangeDelegate(EditSession editSession) {
|
||||||
this.editSession = editSession;
|
this.editSession = editSession;
|
||||||
|
@ -76,13 +76,17 @@ public class WorldEditListener implements Listener {
|
|||||||
public void onPlayerCommandSend(PlayerCommandSendEvent event) {
|
public void onPlayerCommandSend(PlayerCommandSendEvent event) {
|
||||||
InjectedValueStore store = MapBackedValueStore.create();
|
InjectedValueStore store = MapBackedValueStore.create();
|
||||||
store.injectValue(Key.of(Actor.class), context ->
|
store.injectValue(Key.of(Actor.class), context ->
|
||||||
Optional.of(plugin.wrapCommandSender(event.getPlayer())));
|
Optional.of(plugin.wrapCommandSender(event.getPlayer())));
|
||||||
CommandManager commandManager = plugin.getWorldEdit().getPlatformManager().getPlatformCommandManager().getCommandManager();
|
CommandManager commandManager = plugin
|
||||||
|
.getWorldEdit()
|
||||||
|
.getPlatformManager()
|
||||||
|
.getPlatformCommandManager()
|
||||||
|
.getCommandManager();
|
||||||
event.getCommands().removeIf(name ->
|
event.getCommands().removeIf(name ->
|
||||||
// remove if in the manager and not satisfied
|
// remove if in the manager and not satisfied
|
||||||
commandManager.getCommand(name)
|
commandManager.getCommand(name)
|
||||||
.filter(command -> !command.getCondition().satisfied(store))
|
.filter(command -> !command.getCondition().satisfied(store))
|
||||||
.isPresent()
|
.isPresent()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,4 +155,5 @@ public class WorldEditListener implements Listener {
|
|||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
plugin.getWorldEdit().getEventBus().post(new SessionIdleEvent(new BukkitPlayer.SessionKeyImpl(event.getPlayer())));
|
plugin.getWorldEdit().getEventBus().post(new SessionIdleEvent(new BukkitPlayer.SessionKeyImpl(event.getPlayer())));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -117,9 +117,10 @@ public class WorldEditPlugin extends JavaPlugin {
|
|||||||
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
|
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
|
||||||
for (Plugin p : plugins) {
|
for (Plugin p : plugins) {
|
||||||
if (p.getName().equals("WorldEdit")) {
|
if (p.getName().equals("WorldEdit")) {
|
||||||
LOGGER.warn("You installed WorldEdit alongside FastAsyncWorldEdit. That is unneeded and will cause unforeseen issues, " +
|
LOGGER.warn(
|
||||||
"because FastAsyncWorldEdit already provides WorldEdit. " +
|
"You installed WorldEdit alongside FastAsyncWorldEdit. That is unneeded and will cause unforeseen issues, " +
|
||||||
"Stop your server and delete the 'worldedit-bukkit' jar from your plugins folder.");
|
"because FastAsyncWorldEdit already provides WorldEdit. " +
|
||||||
|
"Stop your server and delete the 'worldedit-bukkit' jar from your plugins folder.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//FAWE end
|
//FAWE end
|
||||||
@ -142,7 +143,7 @@ public class WorldEditPlugin extends JavaPlugin {
|
|||||||
//FAWE start - Modify WorldEdit config name
|
//FAWE start - Modify WorldEdit config name
|
||||||
config = new BukkitConfiguration(new YAMLProcessor(new File(getDataFolder(), "config-legacy.yml"), true), this);
|
config = new BukkitConfiguration(new YAMLProcessor(new File(getDataFolder(), "config-legacy.yml"), true), this);
|
||||||
//FAWE end
|
//FAWE end
|
||||||
|
|
||||||
//FAWE start - Setup permission attachments
|
//FAWE start - Setup permission attachments
|
||||||
permissionAttachmentManager = new BukkitPermissionAttachmentManager(this);
|
permissionAttachmentManager = new BukkitPermissionAttachmentManager(this);
|
||||||
//FAWE end
|
//FAWE end
|
||||||
@ -202,7 +203,8 @@ public class WorldEditPlugin extends JavaPlugin {
|
|||||||
getServer().getPluginManager().registerEvents(new WorldInitListener(), this);
|
getServer().getPluginManager().registerEvents(new WorldInitListener(), this);
|
||||||
} else {
|
} else {
|
||||||
//FAWE start
|
//FAWE start
|
||||||
LOGGER.warn("Server reload detected. This may cause various issues with FastAsyncWorldEdit and dependent plugins. Reloading the server is not advised.");
|
LOGGER.warn(
|
||||||
|
"Server reload detected. This may cause various issues with FastAsyncWorldEdit and dependent plugins. Reloading the server is not advised.");
|
||||||
LOGGER.warn("For more information why reloading is bad, see https://madelinemiller.dev/blog/problem-with-reload/");
|
LOGGER.warn("For more information why reloading is bad, see https://madelinemiller.dev/blog/problem-with-reload/");
|
||||||
//FAWE end
|
//FAWE end
|
||||||
try {
|
try {
|
||||||
@ -235,7 +237,7 @@ public class WorldEditPlugin extends JavaPlugin {
|
|||||||
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent(platform));
|
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent(platform));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "deprecation", "unchecked" })
|
@SuppressWarnings({"deprecation", "unchecked"})
|
||||||
private void initializeRegistries() {
|
private void initializeRegistries() {
|
||||||
// Biome
|
// Biome
|
||||||
for (Biome biome : Biome.values()) {
|
for (Biome biome : Biome.values()) {
|
||||||
@ -298,7 +300,8 @@ public class WorldEditPlugin extends JavaPlugin {
|
|||||||
ItemCategory.REGISTRY.register(itemTag.getKey().toString(), new ItemCategory(itemTag.getKey().toString()));
|
ItemCategory.REGISTRY.register(itemTag.getKey().toString(), new ItemCategory(itemTag.getKey().toString()));
|
||||||
}
|
}
|
||||||
} catch (NoSuchMethodError ignored) {
|
} catch (NoSuchMethodError ignored) {
|
||||||
LOGGER.warn("The version of Spigot/Paper you are using doesn't support Tags. The usage of tags with WorldEdit will not work until you update.");
|
LOGGER.warn(
|
||||||
|
"The version of Spigot/Paper you are using doesn't support Tags. The usage of tags with WorldEdit will not work until you update.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,8 +332,8 @@ public class WorldEditPlugin extends JavaPlugin {
|
|||||||
} else {
|
} else {
|
||||||
//FAWE start - Identify as FAWE
|
//FAWE start - Identify as FAWE
|
||||||
LOGGER.info("FastAsyncWorldEdit could not find a Bukkit adapter for this MC version, "
|
LOGGER.info("FastAsyncWorldEdit could not find a Bukkit adapter for this MC version, "
|
||||||
+ "but it seems that you have another implementation of FastAsyncWorldEdit installed (" + platform.getPlatformName() + ") "
|
+ "but it seems that you have another implementation of FastAsyncWorldEdit installed (" + platform.getPlatformName() + ") "
|
||||||
+ "that handles the world editing.");
|
+ "that handles the world editing.");
|
||||||
//FAWE end
|
//FAWE end
|
||||||
}
|
}
|
||||||
this.adapter.invalidate();
|
this.adapter.invalidate();
|
||||||
@ -443,7 +446,7 @@ public class WorldEditPlugin extends JavaPlugin {
|
|||||||
/**
|
/**
|
||||||
* Remember an edit session.
|
* Remember an edit session.
|
||||||
*
|
*
|
||||||
* @param player a player
|
* @param player a player
|
||||||
* @param editSession an edit session
|
* @param editSession an edit session
|
||||||
*/
|
*/
|
||||||
public void remember(Player player, EditSession editSession) {
|
public void remember(Player player, EditSession editSession) {
|
||||||
@ -473,8 +476,9 @@ public class WorldEditPlugin extends JavaPlugin {
|
|||||||
public PermissionsResolverManager getPermissionsResolver() {
|
public PermissionsResolverManager getPermissionsResolver() {
|
||||||
return PermissionsResolverManager.getInstance();
|
return PermissionsResolverManager.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
//FAWE start
|
//FAWE start
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the permissions attachment manager in use
|
* Get the permissions attachment manager in use
|
||||||
*
|
*
|
||||||
@ -565,6 +569,7 @@ public class WorldEditPlugin extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
@ -575,9 +580,11 @@ public class WorldEditPlugin extends JavaPlugin {
|
|||||||
loaded = true;
|
loaded = true;
|
||||||
setupWorldData();
|
setupWorldData();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AsyncTabCompleteListener implements Listener {
|
private class AsyncTabCompleteListener implements Listener {
|
||||||
|
|
||||||
AsyncTabCompleteListener() {
|
AsyncTabCompleteListener() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -597,7 +604,8 @@ public class WorldEditPlugin extends JavaPlugin {
|
|||||||
// 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()) {
|
if (!command.isPresent()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -608,5 +616,7 @@ public class WorldEditPlugin extends JavaPlugin {
|
|||||||
event.setCompletions(CommandUtil.fixSuggestions(buffer, suggestEvent.getSuggestions()));
|
event.setCompletions(CommandUtil.fixSuggestions(buffer, suggestEvent.getSuggestions()));
|
||||||
event.setHandled(true);
|
event.setHandled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,4 +38,5 @@ public class AdapterLoadException extends Exception {
|
|||||||
public AdapterLoadException(Throwable cause) {
|
public AdapterLoadException(Throwable cause) {
|
||||||
super(cause);
|
super(cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,8 @@ import com.fastasyncworldedit.bukkit.FaweBukkit;
|
|||||||
import com.fastasyncworldedit.bukkit.adapter.IBukkitAdapter;
|
import com.fastasyncworldedit.bukkit.adapter.IBukkitAdapter;
|
||||||
import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory;
|
import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory;
|
||||||
import com.fastasyncworldedit.core.Fawe;
|
import com.fastasyncworldedit.core.Fawe;
|
||||||
import com.fastasyncworldedit.core.queue.IChunkGet;
|
|
||||||
import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory;
|
import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory;
|
||||||
|
import com.fastasyncworldedit.core.queue.IChunkGet;
|
||||||
import com.fastasyncworldedit.core.queue.implementation.packet.ChunkPacket;
|
import com.fastasyncworldedit.core.queue.implementation.packet.ChunkPacket;
|
||||||
import com.sk89q.jnbt.AdventureNBTConverter;
|
import com.sk89q.jnbt.AdventureNBTConverter;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
@ -59,10 +59,10 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An interface for adapters of various Bukkit implementations.
|
* An interface for adapters of various Bukkit implementations.
|
||||||
@ -123,7 +123,7 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
|
|||||||
* Create the given entity.
|
* Create the given entity.
|
||||||
*
|
*
|
||||||
* @param location the location
|
* @param location the location
|
||||||
* @param state the state
|
* @param state the state
|
||||||
* @return the created entity or null
|
* @return the created entity or null
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -164,8 +164,8 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
|
|||||||
/**
|
/**
|
||||||
* Send the given NBT data to the player.
|
* Send the given NBT data to the player.
|
||||||
*
|
*
|
||||||
* @param player The player
|
* @param player The player
|
||||||
* @param pos The position
|
* @param pos The position
|
||||||
* @param nbtData The NBT Data
|
* @param nbtData The NBT Data
|
||||||
*/
|
*/
|
||||||
void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData);
|
void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData);
|
||||||
@ -181,10 +181,10 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
|
|||||||
/**
|
/**
|
||||||
* Simulates a player using an item.
|
* Simulates a player using an item.
|
||||||
*
|
*
|
||||||
* @param world the world
|
* @param world the world
|
||||||
* @param position the location
|
* @param position the location
|
||||||
* @param item the item to be used
|
* @param item the item to be used
|
||||||
* @param face the direction in which to "face" when using the item
|
* @param face the direction in which to "face" when using the item
|
||||||
* @return whether the usage was successful
|
* @return whether the usage was successful
|
||||||
*/
|
*/
|
||||||
default boolean simulateItemUse(World world, BlockVector3 position, BaseItem item, Direction face) {
|
default boolean simulateItemUse(World world, BlockVector3 position, BaseItem item, Direction face) {
|
||||||
@ -194,8 +194,8 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
|
|||||||
/**
|
/**
|
||||||
* Gets whether the given {@link BlockState} can be placed here.
|
* Gets whether the given {@link BlockState} can be placed here.
|
||||||
*
|
*
|
||||||
* @param world The world
|
* @param world The world
|
||||||
* @param position The position
|
* @param position The position
|
||||||
* @param blockState The blockstate
|
* @param blockState The blockstate
|
||||||
* @return If it can be placed
|
* @return If it can be placed
|
||||||
*/
|
*/
|
||||||
@ -243,9 +243,10 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Regenerate a region in the given world, so it appears "as new".
|
* Regenerate a region in the given world, so it appears "as new".
|
||||||
* @param world the world to regen in
|
*
|
||||||
* @param region the region to regen
|
* @param world the world to regen in
|
||||||
* @param extent the extent to use for setting blocks
|
* @param region the region to regen
|
||||||
|
* @param extent the extent to use for setting blocks
|
||||||
* @param options the regeneration options
|
* @param options the regeneration options
|
||||||
* @return true on success, false on failure
|
* @return true on success, false on failure
|
||||||
*/
|
*/
|
||||||
|
@ -47,15 +47,15 @@ public class BukkitImplLoader {
|
|||||||
private static final String CLASS_SUFFIX = ".class";
|
private static final String CLASS_SUFFIX = ".class";
|
||||||
|
|
||||||
private static final String LOAD_ERROR_MESSAGE =
|
private static final String LOAD_ERROR_MESSAGE =
|
||||||
//FAWE start - exchange WorldEdit to FAWE & suggest to update Fawe & the server software
|
//FAWE start - exchange WorldEdit to FAWE & suggest to update Fawe & the server software
|
||||||
"\n**********************************************\n"
|
"\n**********************************************\n"
|
||||||
+ "** This FastAsyncWorldEdit version does not fully support your version of Bukkit.\n"
|
+ "** This FastAsyncWorldEdit version does not fully support your version of Bukkit.\n"
|
||||||
+ "** You can fix this by:\n"
|
+ "** You can fix this by:\n"
|
||||||
+ "** - Updating your server version (Check /version to see how many versions you are behind)\n** - Updating FAWE\n"
|
+ "** - Updating your server version (Check /version to see how many versions you are behind)\n** - Updating FAWE\n"
|
||||||
+ "**\n" + "** When working with blocks or undoing, chests will be empty, signs\n"
|
+ "**\n" + "** When working with blocks or undoing, chests will be empty, signs\n"
|
||||||
+ "** will be blank, and so on. There will be no support for entity\n"
|
+ "** will be blank, and so on. There will be no support for entity\n"
|
||||||
+ "** and block property-related functions.\n"
|
+ "** and block property-related functions.\n"
|
||||||
+ "**********************************************\n";
|
+ "**********************************************\n";
|
||||||
//FAWE end
|
//FAWE end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -164,10 +164,10 @@ public class BukkitImplLoader {
|
|||||||
}
|
}
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
LOGGER.warn("Failed to load the Bukkit adapter class '" + className
|
LOGGER.warn("Failed to load the Bukkit adapter class '" + className
|
||||||
+ "' that is not supposed to be missing", e);
|
+ "' that is not supposed to be missing", e);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
LOGGER.warn("Failed to load the Bukkit adapter class '" + className
|
LOGGER.warn("Failed to load the Bukkit adapter class '" + className
|
||||||
+ "' that is not supposed to be raising this error", e);
|
+ "' that is not supposed to be raising this error", e);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
if (className.equals(customCandidate)) {
|
if (className.equals(customCandidate)) {
|
||||||
LOGGER.warn("Failed to load the Bukkit adapter class '" + className + "'", e);
|
LOGGER.warn("Failed to load the Bukkit adapter class '" + className + "'", e);
|
||||||
|
@ -16,81 +16,81 @@
|
|||||||
# - If you want to allow blocks, make sure to change "disallowed-blocks" to []
|
# - If you want to allow blocks, make sure to change "disallowed-blocks" to []
|
||||||
#
|
#
|
||||||
|
|
||||||
limits:
|
limits :
|
||||||
max-blocks-changed:
|
max-blocks-changed :
|
||||||
# Ignored, use FAWE config limits
|
# Ignored, use FAWE config limits
|
||||||
default: -1
|
default : -1
|
||||||
maximum: -1
|
maximum : -1
|
||||||
max-polygonal-points:
|
max-polygonal-points :
|
||||||
default: -1
|
default : -1
|
||||||
maximum: 20
|
maximum : 20
|
||||||
max-radius: -1
|
max-radius : -1
|
||||||
max-super-pickaxe-size: 5
|
max-super-pickaxe-size : 5
|
||||||
max-brush-radius: 100
|
max-brush-radius : 100
|
||||||
butcher-radius:
|
butcher-radius :
|
||||||
default: -1
|
default : -1
|
||||||
maximum: -1
|
maximum : -1
|
||||||
disallowed-blocks:
|
disallowed-blocks :
|
||||||
- "minecraft:wheat"
|
- "minecraft:wheat"
|
||||||
- "minecraft:fire"
|
- "minecraft:fire"
|
||||||
- "minecraft:redstone_wire"
|
- "minecraft:redstone_wire"
|
||||||
|
|
||||||
use-inventory:
|
use-inventory :
|
||||||
enable: false
|
enable : false
|
||||||
allow-override: true
|
allow-override : true
|
||||||
creative-mode-overrides: false
|
creative-mode-overrides : false
|
||||||
|
|
||||||
logging:
|
logging :
|
||||||
log-commands: false
|
log-commands : false
|
||||||
file: worldedit.log
|
file : worldedit.log
|
||||||
# The format of custom log message. This is java general format string (java.util.Formatter). Arguments are:
|
# The format of custom log message. This is java general format string (java.util.Formatter). Arguments are:
|
||||||
# 1$ : date - a Date object representing event time of the log record.
|
# 1$ : date - a Date object representing event time of the log record.
|
||||||
# 2$ : source - a string representing the caller, if available; otherwise, the logger's name.
|
# 2$ : source - a string representing the caller, if available; otherwise, the logger's name.
|
||||||
# 3$ : logger - the logger's name.
|
# 3$ : logger - the logger's name.
|
||||||
# 4$ : level - the log level.
|
# 4$ : level - the log level.
|
||||||
# 5$ : message - the formatted log message returned from the Formatter.formatMessage(LogRecord) method. It uses java.text formatting and does not use the java.util.Formatter format argument.
|
# 5$ : message - the formatted log message returned from the Formatter.formatMessage(LogRecord) method. It uses java.text formatting and does not use the java.util.Formatter format argument.
|
||||||
# 6$ : thrown - a string representing the throwable associated with the log record and its backtrace beginning with a newline character, if any; otherwise, an empty string.
|
# 6$ : thrown - a string representing the throwable associated with the log record and its backtrace beginning with a newline character, if any; otherwise, an empty string.
|
||||||
# For details see:
|
# For details see:
|
||||||
# https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html
|
# https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html
|
||||||
# https://docs.oracle.com/javase/8/docs/api/java/util/logging/SimpleFormatter.html#format-java.util.logging.LogRecord-
|
# https://docs.oracle.com/javase/8/docs/api/java/util/logging/SimpleFormatter.html#format-java.util.logging.LogRecord-
|
||||||
format: "[%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s]: %5$s%6$s%n"
|
format : "[%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s]: %5$s%6$s%n"
|
||||||
|
|
||||||
super-pickaxe:
|
super-pickaxe :
|
||||||
drop-items: true
|
drop-items : true
|
||||||
many-drop-items: false
|
many-drop-items : false
|
||||||
|
|
||||||
snapshots:
|
snapshots :
|
||||||
directory:
|
directory :
|
||||||
|
|
||||||
navigation-wand:
|
navigation-wand :
|
||||||
item: minecraft:compass
|
item : minecraft:compass
|
||||||
max-distance: 100
|
max-distance : 100
|
||||||
|
|
||||||
scripting:
|
scripting :
|
||||||
timeout: 3000
|
timeout : 3000
|
||||||
dir: craftscripts
|
dir : craftscripts
|
||||||
|
|
||||||
saving:
|
saving :
|
||||||
dir: schematics
|
dir : schematics
|
||||||
|
|
||||||
files:
|
files :
|
||||||
allow-symbolic-links: false
|
allow-symbolic-links : false
|
||||||
|
|
||||||
history:
|
history :
|
||||||
size: 15
|
size : 15
|
||||||
expiration: 10
|
expiration : 10
|
||||||
|
|
||||||
calculation:
|
calculation :
|
||||||
timeout: 100
|
timeout : 100
|
||||||
|
|
||||||
debugging:
|
debugging :
|
||||||
trace-unflushed-sessions: false
|
trace-unflushed-sessions : false
|
||||||
|
|
||||||
wand-item: minecraft:wooden_axe
|
wand-item : minecraft:wooden_axe
|
||||||
shell-save-type:
|
shell-save-type :
|
||||||
no-double-slash: false
|
no-double-slash : false
|
||||||
no-op-permissions: false
|
no-op-permissions : false
|
||||||
debug: false
|
debug : false
|
||||||
show-help-on-first-use: true
|
show-help-on-first-use : true
|
||||||
server-side-cui: true
|
server-side-cui : true
|
||||||
command-block-support: false
|
command-block-support : false
|
||||||
|
@ -1,233 +1,233 @@
|
|||||||
name: FastAsyncWorldEdit
|
name : FastAsyncWorldEdit
|
||||||
main: com.sk89q.worldedit.bukkit.WorldEditPlugin
|
main : com.sk89q.worldedit.bukkit.WorldEditPlugin
|
||||||
version: "${internalVersion}"
|
version : "${internalVersion}"
|
||||||
load: STARTUP
|
load : STARTUP
|
||||||
api-version: 1.15
|
api-version : 1.15
|
||||||
softdepend: [Vault]
|
softdepend : [ Vault ]
|
||||||
provides: [WorldEdit]
|
provides : [ WorldEdit ]
|
||||||
website: https://www.spigotmc.org/resources/13932/
|
website : https://www.spigotmc.org/resources/13932/
|
||||||
description: Blazingly fast world manipulation for builders, large networks and developers.
|
description : Blazingly fast world manipulation for builders, large networks and developers.
|
||||||
authors: [Empire92, MattBDev, IronApollo, dordsor21, NotMyFault]
|
authors : [ Empire92, MattBDev, IronApollo, dordsor21, NotMyFault ]
|
||||||
loadbefore: [WorldGuard, PlotSquared]
|
loadbefore : [ WorldGuard, PlotSquared ]
|
||||||
database: false
|
database : false
|
||||||
permissions:
|
permissions :
|
||||||
fawe.plotsquared:
|
fawe.plotsquared :
|
||||||
default: true
|
default : true
|
||||||
children:
|
children :
|
||||||
fawe.plotsquared.trusted: true
|
fawe.plotsquared.trusted : true
|
||||||
fawe.bypass.regions:
|
fawe.bypass.regions :
|
||||||
default: false
|
default : false
|
||||||
fawe.bypass:
|
fawe.bypass :
|
||||||
default: false
|
default : false
|
||||||
children:
|
children :
|
||||||
fawe.bypass.regions: true
|
fawe.bypass.regions : true
|
||||||
fawe.limit.*: true
|
fawe.limit.* : true
|
||||||
fawe.tips:
|
fawe.tips :
|
||||||
default: false
|
default : false
|
||||||
fawe.admin:
|
fawe.admin :
|
||||||
default: op
|
default : op
|
||||||
fawe.reload:
|
fawe.reload :
|
||||||
default: false
|
default : false
|
||||||
fawe.permpack.basic:
|
fawe.permpack.basic :
|
||||||
default: op
|
default : op
|
||||||
children:
|
children :
|
||||||
fawe.worldeditregion: true
|
fawe.worldeditregion : true
|
||||||
fawe.cancel: true
|
fawe.cancel : true
|
||||||
worldedit.biome.info: true
|
worldedit.biome.info : true
|
||||||
worldedit.biome.set: true
|
worldedit.biome.set : true
|
||||||
worldedit.biome.list: true
|
worldedit.biome.list : true
|
||||||
worldedit.chunkinfo: true
|
worldedit.chunkinfo : true
|
||||||
worldedit.listchunks: true
|
worldedit.listchunks : true
|
||||||
worldedit.clipboard.cut: true
|
worldedit.clipboard.cut : true
|
||||||
worldedit.clipboard.paste: true
|
worldedit.clipboard.paste : true
|
||||||
worldedit.schematic.formats: true
|
worldedit.schematic.formats : true
|
||||||
worldedit.schematic.load: true
|
worldedit.schematic.load : true
|
||||||
worldedit.schematic.list: true
|
worldedit.schematic.list : true
|
||||||
worldedit.schematic.save: true
|
worldedit.schematic.save : true
|
||||||
worldedit.clipboard.clear: true
|
worldedit.clipboard.clear : true
|
||||||
worldedit.clipboard.copy: true
|
worldedit.clipboard.copy : true
|
||||||
worldedit.clipboard.lazycopy: true
|
worldedit.clipboard.lazycopy : true
|
||||||
worldedit.clipboard.place: true
|
worldedit.clipboard.place : true
|
||||||
worldedit.clipboard.download: true
|
worldedit.clipboard.download : true
|
||||||
worldedit.clipboard.flip: true
|
worldedit.clipboard.flip : true
|
||||||
worldedit.clipboard.rotate: true
|
worldedit.clipboard.rotate : true
|
||||||
worldedit.help: true
|
worldedit.help : true
|
||||||
worldedit.global-mask: true
|
worldedit.global-mask : true
|
||||||
worldedit.global-transform: true
|
worldedit.global-transform : true
|
||||||
worldedit.generation.cylinder: true
|
worldedit.generation.cylinder : true
|
||||||
worldedit.generation.sphere: true
|
worldedit.generation.sphere : true
|
||||||
worldedit.generation.forest: true
|
worldedit.generation.forest : true
|
||||||
worldedit.generation.pumpkins: true
|
worldedit.generation.pumpkins : true
|
||||||
worldedit.generation.pyramid: true
|
worldedit.generation.pyramid : true
|
||||||
worldedit.generation.shape: true
|
worldedit.generation.shape : true
|
||||||
worldedit.history.undo: true
|
worldedit.history.undo : true
|
||||||
worldedit.history.redo: true
|
worldedit.history.redo : true
|
||||||
worldedit.history.rollback: true
|
worldedit.history.rollback : true
|
||||||
worldedit.navigation.unstuck: true
|
worldedit.navigation.unstuck : true
|
||||||
worldedit.navigation.ascend: true
|
worldedit.navigation.ascend : true
|
||||||
worldedit.navigation.descend: true
|
worldedit.navigation.descend : true
|
||||||
worldedit.navigation.ceiling: true
|
worldedit.navigation.ceiling : true
|
||||||
worldedit.navigation.thru.command: true
|
worldedit.navigation.thru.command : true
|
||||||
worldedit.navigation.jumpto.command: true
|
worldedit.navigation.jumpto.command : true
|
||||||
worldedit.navigation.up: true
|
worldedit.navigation.up : true
|
||||||
worldedit.region.hollow: true
|
worldedit.region.hollow : true
|
||||||
worldedit.region.line: true
|
worldedit.region.line : true
|
||||||
worldedit.region.curve: true
|
worldedit.region.curve : true
|
||||||
worldedit.region.overlay: true
|
worldedit.region.overlay : true
|
||||||
worldedit.region.center: true
|
worldedit.region.center : true
|
||||||
worldedit.region.naturalize: true
|
worldedit.region.naturalize : true
|
||||||
worldedit.region.walls: true
|
worldedit.region.walls : true
|
||||||
worldedit.region.faces: true
|
worldedit.region.faces : true
|
||||||
worldedit.region.smooth: true
|
worldedit.region.smooth : true
|
||||||
worldedit.region.move: true
|
worldedit.region.move : true
|
||||||
worldedit.region.forest: true
|
worldedit.region.forest : true
|
||||||
worldedit.region.replace: true
|
worldedit.region.replace : true
|
||||||
worldedit.region.stack: true
|
worldedit.region.stack : true
|
||||||
worldedit.region.set: true
|
worldedit.region.set : true
|
||||||
worldedit.selection.pos: true
|
worldedit.selection.pos : true
|
||||||
worldedit.selection.chunk: true
|
worldedit.selection.chunk : true
|
||||||
worldedit.selection.hpos: true
|
worldedit.selection.hpos : true
|
||||||
worldedit.wand: true
|
worldedit.wand : true
|
||||||
worldedit.wand.toggle: true
|
worldedit.wand.toggle : true
|
||||||
worldedit.selection.contract: true
|
worldedit.selection.contract : true
|
||||||
worldedit.selection.outset: true
|
worldedit.selection.outset : true
|
||||||
worldedit.selection.inset: true
|
worldedit.selection.inset : true
|
||||||
worldedit.analysis.distr: true
|
worldedit.analysis.distr : true
|
||||||
worldedit.analysis.count: true
|
worldedit.analysis.count : true
|
||||||
worldedit.analysis.sel: true
|
worldedit.analysis.sel : true
|
||||||
worldedit.selection.size: true
|
worldedit.selection.size : true
|
||||||
worldedit.selection.expand: true
|
worldedit.selection.expand : true
|
||||||
worldedit.selection.shift: true
|
worldedit.selection.shift : true
|
||||||
worldedit.snapshots.list: true
|
worldedit.snapshots.list : true
|
||||||
worldedit.superpickaxe: true
|
worldedit.superpickaxe : true
|
||||||
worldedit.superpickaxe.area: true
|
worldedit.superpickaxe.area : true
|
||||||
worldedit.superpickaxe.recursive: true
|
worldedit.superpickaxe.recursive : true
|
||||||
worldedit.brush.blendball: true
|
worldedit.brush.blendball : true
|
||||||
worldedit.brush.erode: true
|
worldedit.brush.erode : true
|
||||||
worldedit.brush.pull: true
|
worldedit.brush.pull : true
|
||||||
worldedit.brush.circle: true
|
worldedit.brush.circle : true
|
||||||
worldedit.brush.recursive: true
|
worldedit.brush.recursive : true
|
||||||
worldedit.brush.line: true
|
worldedit.brush.line : true
|
||||||
worldedit.brush.spline: true
|
worldedit.brush.spline : true
|
||||||
worldedit.brush.surfacespline: true
|
worldedit.brush.surfacespline : true
|
||||||
worldedit.brush.shatter: true
|
worldedit.brush.shatter : true
|
||||||
worldedit.brush.stencil: true
|
worldedit.brush.stencil : true
|
||||||
worldedit.brush.height: true
|
worldedit.brush.height : true
|
||||||
worldedit.brush.layer: true
|
worldedit.brush.layer : true
|
||||||
worldedit.brush.populateschematic: true
|
worldedit.brush.populateschematic : true
|
||||||
worldedit.brush.scatter: true
|
worldedit.brush.scatter : true
|
||||||
worldedit.brush.splatter: true
|
worldedit.brush.splatter : true
|
||||||
worldedit.brush.scattercommand: true
|
worldedit.brush.scattercommand : true
|
||||||
worldedit.brush.copy: true
|
worldedit.brush.copy : true
|
||||||
worldedit.brush.command: true
|
worldedit.brush.command : true
|
||||||
worldedit.brush.apply: true
|
worldedit.brush.apply : true
|
||||||
worldedit.brush.sphere: true
|
worldedit.brush.sphere : true
|
||||||
worldedit.brush.cylinder: true
|
worldedit.brush.cylinder : true
|
||||||
worldedit.brush.clipboard: true
|
worldedit.brush.clipboard : true
|
||||||
worldedit.brush.smooth: true
|
worldedit.brush.smooth : true
|
||||||
worldedit.brush.ex: true
|
worldedit.brush.ex : true
|
||||||
worldedit.brush.gravity: true
|
worldedit.brush.gravity : true
|
||||||
worldedit.brush.options.range: true
|
worldedit.brush.options.range : true
|
||||||
worldedit.brush.options.material: true
|
worldedit.brush.options.material : true
|
||||||
worldedit.brush.options.size: true
|
worldedit.brush.options.size : true
|
||||||
worldedit.brush.options.mask: true
|
worldedit.brush.options.mask : true
|
||||||
worldedit.brush.options.smask: true
|
worldedit.brush.options.smask : true
|
||||||
worldedit.brush.options.transform: true
|
worldedit.brush.options.transform : true
|
||||||
worldedit.brush.options.scroll: true
|
worldedit.brush.options.scroll : true
|
||||||
worldedit.brush.options.visualize: true
|
worldedit.brush.options.visualize : true
|
||||||
worldedit.tool.deltree: true
|
worldedit.tool.deltree : true
|
||||||
worldedit.tool.farwand: true
|
worldedit.tool.farwand : true
|
||||||
worldedit.tool.lrbuild: true
|
worldedit.tool.lrbuild : true
|
||||||
worldedit.tool.info: true
|
worldedit.tool.info : true
|
||||||
worldedit.tool.tree: true
|
worldedit.tool.tree : true
|
||||||
worldedit.tool.replacer: true
|
worldedit.tool.replacer : true
|
||||||
worldedit.tool.data-cycler: true
|
worldedit.tool.data-cycler : true
|
||||||
worldedit.tool.flood-fill: true
|
worldedit.tool.flood-fill : true
|
||||||
worldedit.tool.inspect: true
|
worldedit.tool.inspect : true
|
||||||
worldedit.fill.recursive: true
|
worldedit.fill.recursive : true
|
||||||
worldedit.drain: true
|
worldedit.drain : true
|
||||||
worldedit.fixlava: true
|
worldedit.fixlava : true
|
||||||
worldedit.fixwater: true
|
worldedit.fixwater : true
|
||||||
worldedit.removeabove: true
|
worldedit.removeabove : true
|
||||||
worldedit.removebelow: true
|
worldedit.removebelow : true
|
||||||
worldedit.removenear: true
|
worldedit.removenear : true
|
||||||
worldedit.replacenear: true
|
worldedit.replacenear : true
|
||||||
worldedit.snow: true
|
worldedit.snow : true
|
||||||
worldedit.thaw: true
|
worldedit.thaw : true
|
||||||
worldedit.green: true
|
worldedit.green : true
|
||||||
worldedit.extinguish: true
|
worldedit.extinguish : true
|
||||||
worldedit.calc: true
|
worldedit.calc : true
|
||||||
worldedit.fill: true
|
worldedit.fill : true
|
||||||
fawe.voxelbrush:
|
fawe.voxelbrush :
|
||||||
default: op
|
default : op
|
||||||
children:
|
children :
|
||||||
voxelsniper.brush.ball: true
|
voxelsniper.brush.ball : true
|
||||||
voxelsniper.brush.biome: true
|
voxelsniper.brush.biome : true
|
||||||
voxelsniper.brush.blendball: true
|
voxelsniper.brush.blendball : true
|
||||||
voxelsniper.brush.blenddisc: true
|
voxelsniper.brush.blenddisc : true
|
||||||
voxelsniper.brush.blendvoxel: true
|
voxelsniper.brush.blendvoxel : true
|
||||||
voxelsniper.brush.blendvoxeldisc: true
|
voxelsniper.brush.blendvoxeldisc : true
|
||||||
voxelsniper.brush.blob: true
|
voxelsniper.brush.blob : true
|
||||||
voxelsniper.brush.blockreset: true
|
voxelsniper.brush.blockreset : true
|
||||||
voxelsniper.brush.blockresetsurface: true
|
voxelsniper.brush.blockresetsurface : true
|
||||||
voxelsniper.brush.canyon: true
|
voxelsniper.brush.canyon : true
|
||||||
voxelsniper.brush.canyonselection: true
|
voxelsniper.brush.canyonselection : true
|
||||||
voxelsniper.brush.checkervoxeldisc: true
|
voxelsniper.brush.checkervoxeldisc : true
|
||||||
voxelsniper.brush.cleansnow: true
|
voxelsniper.brush.cleansnow : true
|
||||||
voxelsniper.brush.clonestamp: true
|
voxelsniper.brush.clonestamp : true
|
||||||
voxelsniper.brush.copypasta: true
|
voxelsniper.brush.copypasta : true
|
||||||
voxelsniper.brush.cylinder: true
|
voxelsniper.brush.cylinder : true
|
||||||
voxelsniper.brush.disc: true
|
voxelsniper.brush.disc : true
|
||||||
voxelsniper.brush.discface: true
|
voxelsniper.brush.discface : true
|
||||||
voxelsniper.brush.dome: true
|
voxelsniper.brush.dome : true
|
||||||
voxelsniper.brush.drain: true
|
voxelsniper.brush.drain : true
|
||||||
voxelsniper.brush.ellipse: true
|
voxelsniper.brush.ellipse : true
|
||||||
voxelsniper.brush.ellipsoid: true
|
voxelsniper.brush.ellipsoid : true
|
||||||
voxelsniper.brush.eraser: true
|
voxelsniper.brush.eraser : true
|
||||||
voxelsniper.brush.erode: true
|
voxelsniper.brush.erode : true
|
||||||
voxelsniper.brush.extrude: true
|
voxelsniper.brush.extrude : true
|
||||||
voxelsniper.brush.filldown: true
|
voxelsniper.brush.filldown : true
|
||||||
voxelsniper.brush.flatocean: true
|
voxelsniper.brush.flatocean : true
|
||||||
voxelsniper.brush.heatray: true
|
voxelsniper.brush.heatray : true
|
||||||
voxelsniper.brush.jaggedline: true
|
voxelsniper.brush.jaggedline : true
|
||||||
voxelsniper.brush.line: true
|
voxelsniper.brush.line : true
|
||||||
voxelsniper.brush.move: true
|
voxelsniper.brush.move : true
|
||||||
voxelsniper.brush.ocean: true
|
voxelsniper.brush.ocean : true
|
||||||
voxelsniper.brush.overlay: true
|
voxelsniper.brush.overlay : true
|
||||||
voxelsniper.brush.pull: true
|
voxelsniper.brush.pull : true
|
||||||
voxelsniper.brush.randomerode: true
|
voxelsniper.brush.randomerode : true
|
||||||
voxelsniper.brush.ring: true
|
voxelsniper.brush.ring : true
|
||||||
voxelsniper.brush.rot2d: true
|
voxelsniper.brush.rot2d : true
|
||||||
voxelsniper.brush.rot2dvert: true
|
voxelsniper.brush.rot2dvert : true
|
||||||
voxelsniper.brush.rot3d: true
|
voxelsniper.brush.rot3d : true
|
||||||
voxelsniper.brush.ruler: true
|
voxelsniper.brush.ruler : true
|
||||||
voxelsniper.brush.scanner: true
|
voxelsniper.brush.scanner : true
|
||||||
voxelsniper.brush.set: true
|
voxelsniper.brush.set : true
|
||||||
voxelsniper.brush.setredstoneflip: true
|
voxelsniper.brush.setredstoneflip : true
|
||||||
voxelsniper.brush.setredstonerotate: true
|
voxelsniper.brush.setredstonerotate : true
|
||||||
voxelsniper.brush.shellball: true
|
voxelsniper.brush.shellball : true
|
||||||
voxelsniper.brush.shellset: true
|
voxelsniper.brush.shellset : true
|
||||||
voxelsniper.brush.shellvoxel: true
|
voxelsniper.brush.shellvoxel : true
|
||||||
voxelsniper.brush.signoverwrite: true
|
voxelsniper.brush.signoverwrite : true
|
||||||
voxelsniper.brush.snipe: true
|
voxelsniper.brush.snipe : true
|
||||||
voxelsniper.brush.snowcone: true
|
voxelsniper.brush.snowcone : true
|
||||||
voxelsniper.brush.spiralstaircase: true
|
voxelsniper.brush.spiralstaircase : true
|
||||||
voxelsniper.brush.splatterball: true
|
voxelsniper.brush.splatterball : true
|
||||||
voxelsniper.brush.splatterdisc: true
|
voxelsniper.brush.splatterdisc : true
|
||||||
voxelsniper.brush.splatteroverlay: true
|
voxelsniper.brush.splatteroverlay : true
|
||||||
voxelsniper.brush.splattervoxel: true
|
voxelsniper.brush.splattervoxel : true
|
||||||
voxelsniper.brush.splattervoxeldisc: true
|
voxelsniper.brush.splattervoxeldisc : true
|
||||||
voxelsniper.brush.spline: true
|
voxelsniper.brush.spline : true
|
||||||
voxelsniper.brush.stamp: true
|
voxelsniper.brush.stamp : true
|
||||||
voxelsniper.brush.stencil: true
|
voxelsniper.brush.stencil : true
|
||||||
voxelsniper.brush.stencillist: true
|
voxelsniper.brush.stencillist : true
|
||||||
voxelsniper.brush.threepointcircle: true
|
voxelsniper.brush.threepointcircle : true
|
||||||
voxelsniper.brush.triangle: true
|
voxelsniper.brush.triangle : true
|
||||||
voxelsniper.brush.underlay: true
|
voxelsniper.brush.underlay : true
|
||||||
voxelsniper.brush.voltmeter: true
|
voxelsniper.brush.voltmeter : true
|
||||||
voxelsniper.brush.voxel: true
|
voxelsniper.brush.voxel : true
|
||||||
voxelsniper.brush.voxeldisc: true
|
voxelsniper.brush.voxeldisc : true
|
||||||
voxelsniper.brush.voxeldiscface: true
|
voxelsniper.brush.voxeldiscface : true
|
||||||
voxelsniper.brush.warp: true
|
voxelsniper.brush.warp : true
|
||||||
voxelsniper.goto: true
|
voxelsniper.goto : true
|
||||||
voxelsniper.sniper: true
|
voxelsniper.sniper : true
|
||||||
|
@ -4,8 +4,8 @@ import com.fastasyncworldedit.bukkit.util.MinecraftVersion;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
public class MinecraftVersionTest {
|
public class MinecraftVersionTest {
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import static org.mockito.Mockito.mock;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
public class DinnerPermsResolverTest {
|
public class DinnerPermsResolverTest {
|
||||||
|
|
||||||
private DinnerPermsResolver resolver;
|
private DinnerPermsResolver resolver;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
@ -86,4 +87,5 @@ public class DinnerPermsResolverTest {
|
|||||||
assertTrue(resolver.inGroup(permissible, "b"));
|
assertTrue(resolver.inGroup(permissible, "b"));
|
||||||
assertFalse(resolver.inGroup(permissible, "c"));
|
assertFalse(resolver.inGroup(permissible, "c"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,15 +31,16 @@ import org.bukkit.permissions.PermissionAttachment;
|
|||||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
public class TestOfflinePermissible implements OfflinePlayer, Permissible {
|
public class TestOfflinePermissible implements OfflinePlayer, Permissible {
|
||||||
|
|
||||||
private boolean op;
|
private boolean op;
|
||||||
private UUID randomUuid = UUID.randomUUID();
|
private UUID randomUuid = UUID.randomUUID();
|
||||||
|
|
||||||
@ -190,15 +191,15 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
|
|||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLastLogin() {
|
public long getLastLogin() {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLastSeen() {
|
public long getLastSeen() {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void incrementStatistic(@Nonnull Statistic statistic) throws IllegalArgumentException {
|
public void incrementStatistic(@Nonnull Statistic statistic) throws IllegalArgumentException {
|
||||||
@ -212,19 +213,19 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void incrementStatistic(@Nonnull Statistic statistic, int amount)
|
public void incrementStatistic(@Nonnull Statistic statistic, int amount)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decrementStatistic(@Nonnull Statistic statistic, int amount)
|
public void decrementStatistic(@Nonnull Statistic statistic, int amount)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStatistic(@Nonnull Statistic statistic, int newValue)
|
public void setStatistic(@Nonnull Statistic statistic, int newValue)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,73 +236,84 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void incrementStatistic(@Nonnull Statistic statistic, @Nonnull Material material)
|
public void incrementStatistic(@Nonnull Statistic statistic, @Nonnull Material material)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decrementStatistic(@Nonnull Statistic statistic, @Nonnull Material material)
|
public void decrementStatistic(@Nonnull Statistic statistic, @Nonnull Material material)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStatistic(@Nonnull Statistic statistic, @Nonnull Material material)
|
public int getStatistic(@Nonnull Statistic statistic, @Nonnull Material material)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void incrementStatistic(@Nonnull Statistic statistic, @Nonnull Material material,
|
public void incrementStatistic(
|
||||||
int amount) throws IllegalArgumentException {
|
@Nonnull Statistic statistic, @Nonnull Material material,
|
||||||
|
int amount
|
||||||
|
) throws IllegalArgumentException {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decrementStatistic(@Nonnull Statistic statistic, @Nonnull Material material,
|
public void decrementStatistic(
|
||||||
int amount) throws IllegalArgumentException {
|
@Nonnull Statistic statistic, @Nonnull Material material,
|
||||||
|
int amount
|
||||||
|
) throws IllegalArgumentException {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStatistic(@Nonnull Statistic statistic, @Nonnull Material material, int newValue)
|
public void setStatistic(@Nonnull Statistic statistic, @Nonnull Material material, int newValue)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void incrementStatistic(@Nonnull Statistic statistic, @Nonnull EntityType entityType)
|
public void incrementStatistic(@Nonnull Statistic statistic, @Nonnull EntityType entityType)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decrementStatistic(@Nonnull Statistic statistic, @Nonnull EntityType entityType)
|
public void decrementStatistic(@Nonnull Statistic statistic, @Nonnull EntityType entityType)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStatistic(@Nonnull Statistic statistic, @Nonnull EntityType entityType)
|
public int getStatistic(@Nonnull Statistic statistic, @Nonnull EntityType entityType)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void incrementStatistic(@Nonnull Statistic statistic, @Nonnull EntityType entityType,
|
public void incrementStatistic(
|
||||||
int amount) throws IllegalArgumentException {
|
@Nonnull Statistic statistic, @Nonnull EntityType entityType,
|
||||||
|
int amount
|
||||||
|
) throws IllegalArgumentException {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decrementStatistic(@Nonnull Statistic statistic, @Nonnull EntityType entityType,
|
public void decrementStatistic(
|
||||||
int amount) {
|
@Nonnull Statistic statistic, @Nonnull EntityType entityType,
|
||||||
|
int amount
|
||||||
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStatistic(@Nonnull Statistic statistic, @Nonnull EntityType entityType,
|
public void setStatistic(
|
||||||
int newValue) {
|
@Nonnull Statistic statistic, @Nonnull EntityType entityType,
|
||||||
|
int newValue
|
||||||
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
`java-library`
|
`java-library`
|
||||||
|
@ -5,4 +5,5 @@ package com.sk89q.worldedit.cli;
|
|||||||
* annoying, if you try to use the CLI as plugin.
|
* annoying, if you try to use the CLI as plugin.
|
||||||
*/
|
*/
|
||||||
public class AccessPoint {
|
public class AccessPoint {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,11 @@ public class CLIBlockCategoryRegistry implements BlockCategoryRegistry {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<BlockType> getCategorisedByName(String category) {
|
public Set<BlockType> getCategorisedByName(String category) {
|
||||||
return CLIWorldEdit.inst.getFileRegistries().getDataFile().blocktags.getOrDefault(category, Collections.emptyList()).stream()
|
return CLIWorldEdit.inst.getFileRegistries().getDataFile().blocktags
|
||||||
|
.getOrDefault(category, Collections.emptyList())
|
||||||
|
.stream()
|
||||||
.map(BlockType.REGISTRY::get)
|
.map(BlockType.REGISTRY::get)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,10 @@ import com.sk89q.worldedit.util.Direction;
|
|||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.registry.BundledBlockRegistry;
|
import com.sk89q.worldedit.world.registry.BundledBlockRegistry;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
public class CLIBlockRegistry extends BundledBlockRegistry {
|
public class CLIBlockRegistry extends BundledBlockRegistry {
|
||||||
|
|
||||||
@ -52,7 +52,11 @@ public class CLIBlockRegistry extends BundledBlockRegistry {
|
|||||||
return new EnumProperty(key, values);
|
return new EnumProperty(key, values);
|
||||||
}
|
}
|
||||||
case "direction": {
|
case "direction": {
|
||||||
List<Direction> fixedValues = values.stream().map(String::toUpperCase).map(Direction::valueOf).collect(Collectors.toList());
|
List<Direction> fixedValues = values
|
||||||
|
.stream()
|
||||||
|
.map(String::toUpperCase)
|
||||||
|
.map(Direction::valueOf)
|
||||||
|
.collect(Collectors.toList());
|
||||||
return new DirectionalProperty(key, fixedValues);
|
return new DirectionalProperty(key, fixedValues);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -69,4 +73,5 @@ public class CLIBlockRegistry extends BundledBlockRegistry {
|
|||||||
(key, value) -> createProperty(value.type, key, value.values);
|
(key, value) -> createProperty(value.type, key, value.values);
|
||||||
return ImmutableMap.copyOf(Maps.transformEntries(properties, entryTransform));
|
return ImmutableMap.copyOf(Maps.transformEntries(properties, entryTransform));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user