3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-07 03:50:06 +01: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>
Dieser Commit ist enthalten in:
dordsor21 2021-07-24 16:34:05 +01:00 committet von GitHub
Ursprung 3b4beba7d6
Commit 8c0195970b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
1143 geänderte Dateien mit 143599 neuen und 9952 gelöschten Zeilen

1013
.editorconfig Normale Datei

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -1,13 +1,13 @@
package com.fastasyncworldedit.bukkit;
import javax.annotation.Nullable;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionAttachment;
import javax.annotation.Nullable;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class BukkitPermissionAttachmentManager {
private final WorldEditPlugin plugin;
@ -33,4 +33,5 @@ public class BukkitPermissionAttachmentManager {
p.removeAttachment(attach);
}
}
}

Datei anzeigen

@ -1,29 +1,27 @@
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.NMSAdapter;
import com.fastasyncworldedit.bukkit.listener.BrushListener;
import com.fastasyncworldedit.bukkit.listener.ChunkListener9;
import com.fastasyncworldedit.bukkit.listener.RenderListener;
import com.fastasyncworldedit.bukkit.regions.GriefPreventionFeature;
import com.fastasyncworldedit.bukkit.regions.GriefDefenderFeature;
import com.fastasyncworldedit.bukkit.regions.GriefPreventionFeature;
import com.fastasyncworldedit.bukkit.regions.ResidenceFeature;
import com.fastasyncworldedit.bukkit.regions.TownyFeature;
import com.fastasyncworldedit.bukkit.regions.WorldGuardFeature;
import com.fastasyncworldedit.bukkit.util.BukkitTaskManager;
import com.fastasyncworldedit.bukkit.util.ItemUtil;
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.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.util.ThirdPartyManager;
import com.fastasyncworldedit.core.util.TaskManager;
import com.fastasyncworldedit.core.util.WEManager;
import com.fastasyncworldedit.core.util.image.ImageViewer;
@ -44,7 +42,6 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.UUID;
@ -91,7 +88,7 @@ public class FaweBukkit implements IFawe, Listener {
TaskManager.IMP.task(() -> {
// Fix for ProtocolSupport
Settings.IMP.PROTOCOL_SUPPORT_FIX =
Bukkit.getPluginManager().isPluginEnabled("ProtocolSupport");
Bukkit.getPluginManager().isPluginEnabled("ProtocolSupport");
// This class
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();
}
@ -112,20 +110,12 @@ public class FaweBukkit implements IFawe, Listener {
PluginManager manager = Bukkit.getPluginManager();
if (manager.getPlugin("PacketListenerApi") == null) {
File output = new File(plugin.getDataFolder().getParentFile(),
"PacketListenerAPI_v3.7.6-SNAPSHOT.jar");
byte[] jarData = ThirdPartyManager.PacketListenerAPI.download();
try (FileOutputStream fos = new FileOutputStream(output)) {
fos.write(jarData);
}
LOGGER.error("PacketListener not found! Please install PacketListenerAPI v3.7.6 or above before attempting to " +
"complete image-related edits");
}
if (manager.getPlugin("MapManager") == null) {
File output = new File(plugin.getDataFolder().getParentFile(),
"MapManager_v1.7.8-SNAPSHOT.jar");
byte[] jarData = ThirdPartyManager.MapManager.download();
try (FileOutputStream fos = new FileOutputStream(output)) {
fos.write(jarData);
}
LOGGER.error("MapManager not found! Please install PacketListenerAPI v1.7.8 or above before attempting to " +
"complete image-related edits");
}
return new BukkitImageViewer(BukkitAdapter.adapt(player));
} catch (Throwable ignored) {
@ -133,7 +123,8 @@ public class FaweBukkit implements IFawe, Listener {
return null;
}
@Override public File getDirectory() {
@Override
public File getDirectory() {
return plugin.getDataFolder();
}
@ -151,21 +142,22 @@ public class FaweBukkit implements IFawe, Listener {
return tmp;
}
@Override public String getDebugInfo() {
@Override
public String getDebugInfo() {
StringBuilder msg = new StringBuilder();
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
msg.append("Server Version: ").append(Bukkit.getVersion()).append("\n");
msg.append("Plugins (").append(plugins.length).append("): \n");
for (Plugin p : plugins) {
msg.append(" - ").append(p.getName()).append(":").append("\n")
.append(" • Version: ").append(p.getDescription().getVersion()).append("\n")
.append(" • Enabled: ").append(p.isEnabled()).append("\n")
.append(" • Main: ").append(p.getDescription().getMain()).append("\n")
.append(" • Authors: ").append(p.getDescription().getAuthors()).append("\n")
.append(" • Load Before: ").append(p.getDescription().getLoadBefore()).append("\n")
.append(" • Dependencies: ").append(p.getDescription().getDepend()).append("\n")
.append(" • Soft Dependencies: ").append(p.getDescription().getSoftDepend()).append("\n")
.append(" • Provides: ").append(p.getDescription().getProvides()).append("\n");
.append(" • Version: ").append(p.getDescription().getVersion()).append("\n")
.append(" • Enabled: ").append(p.isEnabled()).append("\n")
.append(" • Main: ").append(p.getDescription().getMain()).append("\n")
.append(" • Authors: ").append(p.getDescription().getAuthors()).append("\n")
.append(" • Load Before: ").append(p.getDescription().getLoadBefore()).append("\n")
.append(" • Dependencies: ").append(p.getDescription().getDepend()).append("\n")
.append(" • Soft Dependencies: ").append(p.getDescription().getSoftDepend()).append("\n")
.append(" • Provides: ").append(p.getDescription().getProvides()).append("\n");
}
return msg.toString();
}
@ -173,7 +165,8 @@ public class FaweBukkit implements IFawe, Listener {
/**
* The task manager handles sync/async tasks.
*/
@Override public TaskManager getTaskManager() {
@Override
public TaskManager getTaskManager() {
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
*/
@Override public Collection<FaweMaskManager> getMaskManagers() {
@Override
public Collection<FaweMaskManager> getMaskManagers() {
final Plugin worldguardPlugin =
Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
final ArrayList<FaweMaskManager> managers = new ArrayList<>();
if (worldguardPlugin != null && worldguardPlugin.isEnabled()) {
try {
@ -212,7 +206,7 @@ public class FaweBukkit implements IFawe, Listener {
}
}
final Plugin griefpreventionPlugin =
Bukkit.getServer().getPluginManager().getPlugin("GriefPrevention");
Bukkit.getServer().getPluginManager().getPlugin("GriefPrevention");
if (griefpreventionPlugin != null && griefpreventionPlugin.isEnabled()) {
try {
managers.add(new GriefPreventionFeature(griefpreventionPlugin));
@ -259,26 +253,31 @@ public class FaweBukkit implements IFawe, Listener {
wePlayer.unregister();
}
@Override public String getPlatform() {
@Override
public String getPlatform() {
return "Bukkit";
}
@Override public UUID getUUID(String name) {
@Override
public UUID getUUID(String name) {
return Bukkit.getOfflinePlayer(name).getUniqueId();
}
@Override public String getName(UUID uuid) {
@Override
public String getName(UUID uuid) {
return Bukkit.getOfflinePlayer(uuid).getName();
}
@Override public Preloader getPreloader() {
@Override
public Preloader getPreloader() {
if (PaperLib.isPaper()) {
return new AsyncPreloader();
}
return null;
}
@Override public boolean isChunksStretched() {
@Override
public boolean isChunksStretched() {
return chunksStretched;
}
@ -295,11 +294,12 @@ public class FaweBukkit implements IFawe, Listener {
if (plotSquared.getClass().getPackage().toString().contains("intellectualsites")) {
WEManager.IMP.managers.add(new com.fastasyncworldedit.bukkit.regions.plotsquaredv4.PlotSquaredFeature());
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());
LOGGER.info("Plugin 'PlotSquared' found. Using it now.");
} else {
LOGGER.error("Incompatible version of PlotSquared found. Please use PlotSquared v6.");
}
}
}

Datei anzeigen

@ -1,8 +1,8 @@
package com.fastasyncworldedit.bukkit.adapter;
import co.aikar.timings.Timings;
import com.fastasyncworldedit.core.queue.implementation.QueueHandler;
import com.fastasyncworldedit.bukkit.listener.ChunkListener;
import com.fastasyncworldedit.core.queue.implementation.QueueHandler;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import org.apache.logging.log4j.Logger;
import org.spigotmc.AsyncCatcher;
@ -17,6 +17,7 @@ public class BukkitQueueHandler extends QueueHandler {
private static boolean alertTimingsChange = true;
private static Method methodCheck;
static {
try {
methodCheck = Class.forName("co.aikar.timings.TimingsManager").getDeclaredMethod("recheckEnabled");
@ -61,4 +62,5 @@ public class BukkitQueueHandler extends QueueHandler {
}
}
}
}

Datei anzeigen

@ -16,6 +16,7 @@ import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
public abstract class CachedBukkitAdapter implements IBukkitAdapter {
private int[] itemTypes;
private int[] blockTypes;
@ -98,4 +99,5 @@ public abstract class CachedBukkitAdapter implements IBukkitAdapter {
throw e;
}
}
}

Datei anzeigen

@ -1,13 +1,14 @@
package com.fastasyncworldedit.bukkit.adapter;
import javax.annotation.Nonnull;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import javax.annotation.Nonnull;
public class DelegateLock extends ReentrantLockWithGetOwner {
private final ReentrantLock parent;
private volatile boolean modified;
private final AtomicInteger count;
@ -106,4 +107,5 @@ public class DelegateLock extends ReentrantLockWithGetOwner {
public synchronized String toString() {
return parent.toString();
}
}

Datei anzeigen

@ -3,6 +3,7 @@ package com.fastasyncworldedit.bukkit.adapter;
import java.util.concurrent.Semaphore;
public class DelegateSemaphore extends Semaphore {
private final Semaphore delegate;
public DelegateSemaphore(int permits, Semaphore delegate) {
@ -30,4 +31,5 @@ public class DelegateSemaphore extends Semaphore {
public synchronized void release() {
this.delegate.release();
}
}

Datei anzeigen

@ -1,11 +1,9 @@
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.blocks.BaseItemStack;
import com.sk89q.worldedit.bukkit.BukkitEntity;
import com.fastasyncworldedit.bukkit.util.BukkitItemStack;
import com.sk89q.worldedit.bukkit.BukkitPlayer;
import com.sk89q.worldedit.bukkit.BukkitWorld;
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.GameModes;
import com.sk89q.worldedit.world.item.ItemType;
import java.util.Locale;
import com.sk89q.worldedit.world.item.ItemTypes;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@ -35,6 +31,10 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.Locale;
import static com.google.common.base.Preconditions.checkNotNull;
public interface IBukkitAdapter {
/**
@ -81,7 +81,7 @@ public interface IBukkitAdapter {
/**
* 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
* @return a Bukkit location
*/
@ -90,7 +90,8 @@ public interface IBukkitAdapter {
checkNotNull(position);
return new org.bukkit.Location(
world,
position.getX(), position.getY(), position.getZ());
position.getX(), position.getY(), position.getZ()
);
}
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.
*
* @param world the Bukkit world
* @param world the Bukkit world
* @param location the WorldEdit location
* @return a Bukkit location
*/
@ -111,7 +112,8 @@ public interface IBukkitAdapter {
world,
location.getX(), location.getY(), location.getZ(),
location.getYaw(),
location.getPitch());
location.getPitch()
);
}
/**
@ -192,7 +194,7 @@ public interface IBukkitAdapter {
default BlockType asBlockType(Material material) {
checkNotNull(material);
if (!material.isBlock()) {
throw new IllegalArgumentException(material.getKey().toString() + " is not a block!") {
throw new IllegalArgumentException(material.getKey() + " is not a block!") {
@Override
public synchronized Throwable fillInStackTrace() {
return this;
@ -203,7 +205,6 @@ public interface IBukkitAdapter {
}
/**
* Converts a Material to a ItemType
*
@ -269,6 +270,7 @@ public interface IBukkitAdapter {
default BukkitPlayer adapt(Player player) {
return WorldEditPlugin.getInstance().wrapPlayer(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
*
* @param blockType The WorldEdit BlockType
* @param type The Bukkit Material
* @param type The Bukkit Material
* @return If they are equal
*/
default boolean equals(BlockType blockType, Material type) {
@ -351,4 +353,5 @@ public interface IBukkitAdapter {
throw new NotABlockException();
}
}
}

Datei anzeigen

@ -12,6 +12,7 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.nbt.CompoundBinaryTag;
import com.sk89q.worldedit.world.DataFixer;
import com.sk89q.worldedit.world.biome.BiomeType;
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.item.ItemType;
import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.sk89q.worldedit.util.nbt.CompoundBinaryTag;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
@ -38,6 +38,7 @@ import java.util.Map;
import java.util.OptionalInt;
public interface IDelegateBukkitImplAdapter<T> extends BukkitImplAdapter<T> {
BukkitImplAdapter<T> getParent();
@Override
@ -262,4 +263,5 @@ public interface IDelegateBukkitImplAdapter<T> extends BukkitImplAdapter<T> {
default BlockState asBlockState(ItemStack itemStack) {
return getParent().asBlockState(itemStack);
}
}

Datei anzeigen

@ -10,6 +10,7 @@ import java.util.ArrayList;
import java.util.Map;
public abstract class MapChunkUtil<T> {
protected Field fieldX;
protected Field fieldZ;
protected Field fieldHeightMap;
@ -50,4 +51,5 @@ public abstract class MapChunkUtil<T> {
return null;
}
}
}

Datei anzeigen

@ -1,11 +1,11 @@
package com.fastasyncworldedit.bukkit.adapter;
import com.fastasyncworldedit.core.FAWEPlatformAdapterImpl;
import com.fastasyncworldedit.core.queue.IChunkGet;
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.math.BlockVector3;
import com.fastasyncworldedit.core.world.block.BlockID;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypesCache;
@ -13,8 +13,11 @@ import java.util.Map;
import java.util.function.Function;
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 num_palette = 0;
char lastOrdinal = BlockID.__RESERVED__;
@ -43,9 +46,11 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl {
if (ticking) {
BlockState state = BlockState.getFromOrdinal(ordinal);
ticking_blocks
.put(BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
WorldEditPlugin.getInstance().getBukkitImplAdapter()
.getInternalBlockStateId(state).orElse(0));
.put(
BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
WorldEditPlugin.getInstance().getBukkitImplAdapter()
.getInternalBlockStateId(state).orElse(0)
);
}
}
}
@ -61,9 +66,11 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl {
return air;
}
public static int createPalette(int layer, int[] blockToPalette, int[] paletteToBlock,
int[] blocksCopy, int[] num_palette_buffer, Function<Integer, char[]> get, char[] set,
Map<BlockVector3, Integer> ticking_blocks, boolean fastmode) {
public static int createPalette(
int layer, int[] blockToPalette, int[] paletteToBlock,
int[] blocksCopy, int[] num_palette_buffer, Function<Integer, char[]> get, char[] set,
Map<BlockVector3, Integer> ticking_blocks, boolean fastmode
) {
int air = 0;
int num_palette = 0;
char[] getArr = null;
@ -100,9 +107,11 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl {
if (ticking) {
BlockState state = BlockState.getFromOrdinal(ordinal);
ticking_blocks
.put(BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
WorldEditPlugin.getInstance().getBukkitImplAdapter()
.getInternalBlockStateId(state).orElse(0));
.put(
BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
WorldEditPlugin.getInstance().getBukkitImplAdapter()
.getInternalBlockStateId(state).orElse(0)
);
}
}
}
@ -126,9 +135,11 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl {
}
if (ticking) {
BlockState state = BlockState.getFromOrdinal(ordinal);
ticking_blocks.put(BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
WorldEditPlugin.getInstance().getBukkitImplAdapter()
.getInternalBlockStateId(state).orElse(0));
ticking_blocks.put(
BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
WorldEditPlugin.getInstance().getBukkitImplAdapter()
.getInternalBlockStateId(state).orElse(0)
);
}
}
int palette = blockToPalette[ordinal];
@ -192,4 +203,5 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl {
}
((BukkitGetBlocks) chunk).send(mask, lighting);
}
}

Datei anzeigen

@ -1,19 +1,25 @@
package com.fastasyncworldedit.bukkit.adapter;
import com.fastasyncworldedit.core.queue.IQueueChunk;
import com.fastasyncworldedit.core.queue.IQueueExtent;
import com.fastasyncworldedit.core.configuration.Settings;
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.RelighterFactory;
import com.fastasyncworldedit.core.configuration.Settings;
import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode;
import com.fastasyncworldedit.core.queue.IQueueChunk;
import com.fastasyncworldedit.core.queue.IQueueExtent;
import com.sk89q.worldedit.world.World;
import javax.annotation.Nonnull;
public class NMSRelighterFactory implements RelighterFactory {
@Override
public @Nonnull Relighter createRelighter(RelightMode relightMode, World world, IQueueExtent<IQueueChunk> queue) {
return new NMSRelighter(queue,
relightMode != null ? relightMode : RelightMode.valueOf(Settings.IMP.LIGHTING.MODE));
public @Nonnull
Relighter createRelighter(RelightMode relightMode, World world, IQueueExtent<IQueueChunk> queue) {
return new NMSRelighter(
queue,
relightMode != null ? relightMode : RelightMode.valueOf(Settings.IMP.LIGHTING.MODE)
);
}
}

Datei anzeigen

@ -8,4 +8,5 @@ public class ReentrantLockWithGetOwner extends ReentrantLock {
public Thread getOwner() {
return super.getOwner();
}
}
}

Datei anzeigen

@ -1,9 +1,9 @@
package com.fastasyncworldedit.bukkit.adapter;
import com.fastasyncworldedit.core.configuration.Settings;
import com.fastasyncworldedit.core.queue.IChunkCache;
import com.fastasyncworldedit.core.queue.IChunkGet;
import com.fastasyncworldedit.core.queue.implementation.SingleThreadQueueExtent;
import com.fastasyncworldedit.core.configuration.Settings;
import com.fastasyncworldedit.core.util.MathMan;
import com.sk89q.worldedit.extent.Extent;
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.longs.Long2ObjectLinkedOpenHashMap;
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.Arrays;
import java.util.Comparator;
@ -30,20 +33,18 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
import org.apache.logging.log4j.Logger;
import org.bukkit.generator.BlockPopulator;
/**
* Represents an abstract regeneration handler.
*
* @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 <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 <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 <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>> {
private static final Logger LOGGER = LogManagerCompat.getLogger();
protected final org.bukkit.World originalBukkitWorld;
protected final Region region;
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 boolean generateConcurrent = true;
protected long seed;
private final Long2ObjectLinkedOpenHashMap<ProtoChunk> protoChunks = new Long2ObjectLinkedOpenHashMap<>();
private final Long2ObjectOpenHashMap<Chunk> chunks = new Long2ObjectOpenHashMap<>();
private ExecutorService executor;
@ -61,10 +62,11 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
/**
* Initializes an abstract regeneration handler.
*
* @param originalBukkitWorld the Bukkit world containing all the information on how to regenerate the {code Region}
* @param region the selection to regenerate
* @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 region the selection to regenerate
* @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}
*/
public Regenerator(org.bukkit.World originalBukkitWorld, Region region, Extent target, RegenOptions options) {
this.originalBukkitWorld = originalBukkitWorld;
@ -75,6 +77,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
/**
* Regenerates the selected {@code Region}.
*
* @return whether or not the regeneration process was successful
* @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.
*
* @param x the chunk x 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.
@ -126,6 +130,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
/**
* Returns the {@code Chunk} at the given chunk coordinates.
*
* @param x the chunk x 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.
@ -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, ...)?
//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
Int2ObjectOpenHashMap<List<Long>> chunkCoordsForRadius = new Int2ObjectOpenHashMap<>();
chunkStati.keySet().stream().map(ChunkStatusWrapper::requiredNeigborChunkRadius0).distinct().forEach(radius -> {
if (radius == -1) //ignore ChunkStatus.EMPTY
if (radius == -1) { //ignore ChunkStatus.EMPTY
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
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
Int2ObjectOpenHashMap<Long2ObjectOpenHashMap<List<IChunkAccess>>> worldlimits = new Int2ObjectOpenHashMap<>();
chunkStati.keySet().stream().map(ChunkStatusWrapper::requiredNeigborChunkRadius0).distinct().forEach(radius -> {
if (radius == -1) //ignore ChunkStatus.EMPTY
if (radius == -1) { //ignore ChunkStatus.EMPTY
return;
}
Long2ObjectOpenHashMap<List<IChunkAccess>> map = new Long2ObjectOpenHashMap<>();
for (Long xz : chunkCoordsForRadius.get(radius)) {
int x = MathMan.unpairIntX(xz);
@ -281,19 +288,19 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
// realExtent.setBlockLight(vec, extent.getBrightness(vec));
}
}
//functions to be implemented by sub class
private void cleanup0() {
if (executor != null) {
executor.shutdownNow();
}
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
* world.</p>
*
*
* <p>Fields required to be initialized: chunkStati, seed</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.
*
* <p>
* 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.
* @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;
/**
* 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();
//functions to implement by sub class - regenate related
/**
* 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.
*
* @param chunk the {@code Chunk} to populate
* @param chunk the {@code Chunk} to populate
* @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);
/**
* Implement the initialization an {@code IChunkCache<IChunkGet>} here. Use will need the {@code getChunkAt} function
*
* @return an initialized {@code IChunkCache<IChunkGet>}
*/
protected abstract IChunkCache<IChunkGet> initSourceQueueCache();
//algorithms
private List<Long> getChunkCoordsRegen(Region region, int border) { //needs to be square num of chunks
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 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);
return adjustedRegion.getChunks().stream()
.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()))
.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
*
* @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)
* @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 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);
for (int offset = 0; offset < numlists; offset++) {
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));
}
tasks.add(para);
}
} else {
@ -437,8 +460,9 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
tasks = new SequentialTasks(numlists);
for (int offset = 0; offset < numlists; offset++) {
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));
}
tasks.add(para);
}
}
@ -456,8 +480,10 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
}
//classes
/**
* 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
*/
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}.
*
* @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}.
* This list is order in the correct order required by the {@code ChunkStatus}, unless Mojang suddenly decides to do things differently.
* @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}.
* 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);
@ -493,9 +519,13 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
try {
processChunk(xz, accessibleChunks);
} 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 {
@ -509,6 +539,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
public SequentialTasks(int expectedsize) {
super(expectedsize);
}
}
public static class ConcurrentTasks<T> extends Tasks<T> {
@ -516,6 +547,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
public ConcurrentTasks(int expectedsize) {
super(expectedsize);
}
}
public static class Tasks<T> implements Iterable<T> {
@ -537,7 +569,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
public int size() {
return tasks.size();
}
@Override
public Iterator<T> iterator() {
return tasks.iterator();
@ -547,5 +579,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
public String toString() {
return tasks.toString();
}
}
}

Datei anzeigen

@ -1,6 +1,5 @@
package com.fastasyncworldedit.bukkit.adapter;
import com.fastasyncworldedit.bukkit.adapter.CachedBukkitAdapter;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
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;
public class SimpleBukkitAdapter extends CachedBukkitAdapter {
private BlockData[][] blockDataCache;
private boolean init() {
@ -18,7 +18,7 @@ public class SimpleBukkitAdapter extends CachedBukkitAdapter {
return false;
}
this.blockDataCache = new BlockData[BlockTypes.size()][];
blockDataCache[0] = new BlockData[] {Material.AIR.createBlockData()};
blockDataCache[0] = new BlockData[]{Material.AIR.createBlockData()};
return true;
}
@ -51,4 +51,5 @@ public class SimpleBukkitAdapter extends CachedBukkitAdapter {
throw e;
}
}
}

Datei anzeigen

@ -2,10 +2,10 @@ package com.fastasyncworldedit.bukkit.filter;
import com.fastasyncworldedit.core.regions.filter.CuboidRegionFilter;
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.griefdefender.api.GriefDefender;
import com.griefdefender.api.claim.Claim;
import com.sk89q.worldedit.math.BlockVector2;
import org.bukkit.World;
import java.util.ArrayDeque;
@ -15,6 +15,7 @@ import java.util.function.Supplier;
import static com.google.common.base.Preconditions.checkNotNull;
public class GriefDefenderFilter extends CuboidRegionFilter {
private final Collection<Claim> claims;
private final World world;
@ -37,4 +38,5 @@ public class GriefDefenderFilter extends CuboidRegionFilter {
}
}
}
}

Datei anzeigen

@ -14,13 +14,14 @@ import java.util.function.Supplier;
import static com.google.common.base.Preconditions.checkNotNull;
public class GriefPreventionFilter extends CuboidRegionFilter {
private final Collection<Claim> claims;
private final World world;
public GriefPreventionFilter(World world) {
checkNotNull(world);
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;
}
@ -36,4 +37,5 @@ public class GriefPreventionFilter extends CuboidRegionFilter {
}
}
}
}

Datei anzeigen

@ -32,7 +32,7 @@ public class WorldGuardFilter extends CuboidRegionFilter {
public void calculateRegions() {
Fawe.get().getQueueHandler().sync(() -> {
WorldGuardFilter.this.manager = WorldGuard.getInstance().getPlatform().getRegionContainer().get(
BukkitAdapter.adapt(world));
BukkitAdapter.adapt(world));
for (ProtectedRegion region : manager.getRegions().values()) {
BlockVector3 min = region.getMinimumPoint();
BlockVector3 max = region.getMaximumPoint();
@ -69,4 +69,5 @@ public class WorldGuardFilter extends CuboidRegionFilter {
ApplicableRegionSet set = manager.getApplicableRegions(regionRegion);
return set.size() > 0 && !set.getRegions().iterator().next().getId().equals("__global__");
}
}

Datei anzeigen

@ -20,6 +20,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.plugin.Plugin;
public class BrushListener implements Listener {
public BrushListener(Plugin plugin) {
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@ -53,7 +54,8 @@ public class BrushListener implements Listener {
public void onPlayerMove(PlayerMoveEvent event) {
Location from = event.getFrom();
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();
com.sk89q.worldedit.entity.Player player = BukkitAdapter.adapt(bukkitPlayer);
LocalSession session = player.getSession();
@ -83,4 +85,5 @@ public class BrushListener implements Listener {
}
}
}
}

Datei anzeigen

@ -1,7 +1,7 @@
package com.fastasyncworldedit.bukkit.listener;
import com.fastasyncworldedit.core.Fawe;
import com.fastasyncworldedit.bukkit.FaweBukkit;
import com.fastasyncworldedit.core.Fawe;
import com.fastasyncworldedit.core.configuration.Settings;
import com.fastasyncworldedit.core.util.FaweTimer;
import com.fastasyncworldedit.core.util.MathMan;
@ -50,8 +50,8 @@ public abstract class ChunkListener implements Listener {
private static final Logger LOGGER = LogManagerCompat.getLogger();
protected int rateLimit = 0;
protected Location lastCancelPos;
private int[] badLimit = new int[]{Settings.IMP.TICK_LIMITER.PHYSICS_MS,
Settings.IMP.TICK_LIMITER.FALLING, Settings.IMP.TICK_LIMITER.ITEMS};
private final int[] badLimit = new int[]{Settings.IMP.TICK_LIMITER.PHYSICS_MS,
Settings.IMP.TICK_LIMITER.FALLING, Settings.IMP.TICK_LIMITER.ITEMS};
public ChunkListener() {
if (Settings.IMP.TICK_LIMITER.ENABLED) {
@ -62,7 +62,7 @@ public abstract class ChunkListener implements Listener {
Location tmpLoc = lastCancelPos;
if (tmpLoc != null) {
LOGGER.debug("[FAWE Tick Limiter] Detected and cancelled physics lag source at "
+ tmpLoc);
+ tmpLoc);
}
rateLimit--;
physicsFreeze = false;
@ -93,7 +93,7 @@ public abstract class ChunkListener implements Listener {
public static boolean itemFreeze = false;
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 lastZ = Integer.MIN_VALUE;
private int[] lastCount;
@ -248,7 +248,7 @@ public abstract class ChunkListener implements Listener {
physStart = System.currentTimeMillis();
return;
} else if (System.currentTimeMillis() - physStart
< Settings.IMP.TICK_LIMITER.PHYSICS_MS) {
< Settings.IMP.TICK_LIMITER.PHYSICS_MS) {
return;
}
}
@ -281,7 +281,7 @@ public abstract class ChunkListener implements Listener {
String methodName = elem.getMethodName();
// setAir | setTypeAndData (hacky, but this needs to be efficient)
if (methodName.charAt(0) == 's' && methodName.length() == 6
|| methodName.length() == 14) {
|| methodName.length() == 14) {
return true;
}
}
@ -370,16 +370,16 @@ public abstract class ChunkListener implements Listener {
String className = elem.getClassName();
int len = className.length();
if (len > 15 && className.charAt(len - 15) == 'E' && className
.endsWith("EntityFireworks")) {
.endsWith("EntityFireworks")) {
for (Entity ent : world.getEntities()) {
if (ent.getType() == EntityType.FIREWORK) {
Vector velocity = ent.getVelocity();
double vertical = Math.abs(velocity.getY());
if (Math.abs(velocity.getX()) > vertical
|| Math.abs(velocity.getZ()) > vertical) {
|| Math.abs(velocity.getZ()) > vertical) {
LOGGER.warn(
"[FAWE `tick-limiter`] Detected and cancelled rogue FireWork at "
+ ent.getLocation());
"[FAWE `tick-limiter`] Detected and cancelled rogue FireWork at "
+ ent.getLocation());
ent.remove();
}
}
@ -409,9 +409,10 @@ public abstract class ChunkListener implements Listener {
if (rateLimit <= 0) {
rateLimit = 20;
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);
}
}
}

Datei anzeigen

@ -86,4 +86,5 @@ public class ChunkListener9 extends ChunkListener {
StackTraceElement[] elems = getElements(ex);
return elems.length > i ? elems[i] : null;
}
}

Datei anzeigen

@ -86,7 +86,7 @@ public class RenderListener implements Listener {
} else {
int[] val = views.get(uuid);
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();
views.put(uid, val);
} else {
@ -136,4 +136,5 @@ public class RenderListener implements Listener {
UUID uid = player.getUniqueId();
views.remove(uid);
}
}

Datei anzeigen

@ -13,9 +13,9 @@ import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.PluginBase;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginLoader;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.File;
import java.io.InputStream;
import java.util.Iterator;
@ -25,6 +25,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Logger;
public class PluginPreloader extends PluginBase {
private World world;
private Set<BlockVector2> loaded;
private int index;
@ -79,7 +80,7 @@ public class PluginPreloader extends PluginBase {
return;
}
Fawe.get().getQueueHandler().syncWhenFree(() -> {
for (; iter.hasNext() && invalidator.get();index++) {
for (; iter.hasNext() && invalidator.get(); index++) {
BlockVector2 chunk = iter.next();
if (!world.isChunkLoaded(chunk.getX(), chunk.getZ())) {
world.addPluginChunkTicket(chunk.getX(), chunk.getZ(), this);
@ -199,7 +200,13 @@ public class PluginPreloader extends PluginBase {
@Override
@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;
}
}

Datei anzeigen

@ -12,4 +12,5 @@ public abstract class BukkitMaskManager extends FaweMaskManager {
public boolean hasMemberPermission(Permissible player) {
return player.hasPermission("fawe." + getKey() + ".member");
}
}

Datei anzeigen

@ -28,7 +28,9 @@ public class GriefDefenderFeature extends BukkitMaskManager implements Listener
}
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()));
}
@ -41,8 +43,16 @@ public class GriefDefenderFeature extends BukkitMaskManager implements Listener
if (!claim.isWilderness()) {
if (isAllowed(player, claim, type)) {
claim.getGreaterBoundaryCorner().getX();
final BlockVector3 pos1 = BlockVector3.at(claim.getLesserBoundaryCorner().getX(), claim.getLesserBoundaryCorner().getY(), claim.getLesserBoundaryCorner().getZ());
final BlockVector3 pos2 = BlockVector3.at(claim.getGreaterBoundaryCorner().getX(), claim.getGreaterBoundaryCorner().getY(), claim.getGreaterBoundaryCorner().getZ());
final BlockVector3 pos1 = BlockVector3.at(
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)) {
@Override
@ -59,4 +69,5 @@ public class GriefDefenderFeature extends BukkitMaskManager implements Listener
public RegionFilter getFilter(String world) {
return new GriefDefenderFilter(Bukkit.getWorld(world));
}
}

Datei anzeigen

@ -26,8 +26,10 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene
}
public boolean isAllowed(Player player, Claim claim, MaskType type) {
return claim != null && (claim.getOwnerName().equalsIgnoreCase(player.getName()) || claim.getOwnerName().equals(player.getUniqueId()) ||
type == MaskType.MEMBER && claim.allowBuild(player, Material.AIR) == null);
return claim != null && (claim.getOwnerName().equalsIgnoreCase(player.getName()) || claim
.getOwnerName()
.equals(player.getUniqueId()) ||
type == MaskType.MEMBER && claim.allowBuild(player, Material.AIR) == null);
}
@Override
@ -37,8 +39,16 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene
if (claim != null) {
if (isAllowed(player, claim, type)) {
claim.getGreaterBoundaryCorner().getBlockX();
final BlockVector3 pos1 = BlockVector3.at(claim.getLesserBoundaryCorner().getBlockX(), 0, claim.getLesserBoundaryCorner().getBlockZ());
final BlockVector3 pos2 = BlockVector3.at(claim.getGreaterBoundaryCorner().getBlockX(), 256, claim.getGreaterBoundaryCorner().getBlockZ());
final BlockVector3 pos1 = BlockVector3.at(
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)) {
@Override
@ -55,4 +65,5 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene
public RegionFilter getFilter(String world) {
return new GriefPreventionFilter(Bukkit.getWorld(world));
}
}

Datei anzeigen

@ -19,8 +19,8 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener {
private static final Logger LOGGER = LogManagerCompat.getLogger();
private FaweBukkit plugin;
private Plugin residence;
private final FaweBukkit plugin;
private final Plugin residence;
public ResidenceFeature(final Plugin residencePlugin, final FaweBukkit p3) {
super(residencePlugin.getName());
@ -31,9 +31,11 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener {
public boolean isAllowed(Player player, ClaimedResidence residence, MaskType type) {
return residence != null &&
(residence.getOwner().equals(player.getName()) ||
residence.getOwner().equals(player.getUniqueId().toString()) ||
type == MaskType.MEMBER && TaskManager.IMP.sync(() -> residence.getPermissions().playerHas(player, "build", false)));
(residence.getOwner().equals(player.getName()) ||
residence.getOwner().equals(player.getUniqueId().toString()) ||
type == MaskType.MEMBER && TaskManager.IMP.sync(() -> residence
.getPermissions()
.playerHas(player, "build", false)));
}
@Override
@ -61,4 +63,5 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener {
}
return null;
}
}

Datei anzeigen

@ -83,10 +83,10 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
if (isMember) {
final Chunk chunk = location.getChunk();
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(
chunk.getX() * 16 + 15, 156, chunk.getZ() * 16
+ 15);
chunk.getX() * 16 + 15, 156, chunk.getZ() * 16
+ 15);
return new FaweMask(new CuboidRegion(pos1, pos2)) {
@Override
public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) {
@ -98,4 +98,5 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
}
return null;
}
}

Datei anzeigen

@ -1,8 +1,8 @@
package com.fastasyncworldedit.bukkit.regions;
import com.fastasyncworldedit.bukkit.filter.WorldGuardFilter;
import com.fastasyncworldedit.core.regions.RegionWrapper;
import com.fastasyncworldedit.core.regions.FaweMask;
import com.fastasyncworldedit.core.regions.RegionWrapper;
import com.fastasyncworldedit.core.regions.filter.RegionFilter;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
@ -28,9 +28,11 @@ import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import java.util.Locale;
public class WorldGuardFeature extends BukkitMaskManager implements Listener {
private final WorldGuardPlugin worldguard;
private static final Logger LOGGER = LogManagerCompat.getLogger();
@ -67,9 +69,18 @@ public class WorldGuardFeature extends BukkitMaskManager implements Listener {
if (global != null && isAllowed(player, 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
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;
}
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);
} else {
if (myregion instanceof ProtectedCuboidRegion) {
pos1 = BlockVector3.at(myregion.getMinimumPoint().getBlockX(), myregion.getMinimumPoint().getBlockY(), myregion.getMinimumPoint().getBlockZ());
pos2 = BlockVector3.at(myregion.getMaximumPoint().getBlockX(), myregion.getMaximumPoint().getBlockY(), myregion.getMaximumPoint().getBlockZ());
pos1 = BlockVector3.at(
myregion.getMinimumPoint().getBlockX(),
myregion.getMinimumPoint().getBlockY(),
myregion.getMinimumPoint().getBlockZ()
);
pos2 = BlockVector3.at(
myregion.getMaximumPoint().getBlockX(),
myregion.getMaximumPoint().getBlockY(),
myregion.getMaximumPoint().getBlockZ()
);
} else {
return new FaweMask(adapt(myregion)) {
@Override
@ -144,6 +163,7 @@ public class WorldGuardFeature extends BukkitMaskManager implements Listener {
}
private static class AdaptedRegion extends AbstractRegion {
private final ProtectedRegion region;
public AdaptedRegion(ProtectedRegion region) {
@ -175,6 +195,7 @@ public class WorldGuardFeature extends BukkitMaskManager implements Listener {
public boolean contains(BlockVector3 position) {
return region.contains(position);
}
}
private static Region adapt(ProtectedRegion region) {
@ -192,4 +213,5 @@ public class WorldGuardFeature extends BukkitMaskManager implements Listener {
}
return new AdaptedRegion(region);
}
}

Datei anzeigen

@ -33,9 +33,9 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@ -46,18 +46,20 @@ import static org.bukkit.Bukkit.getWorld;
public class FaweDelegateRegionManager {
public boolean setCuboids(final @NonNull PlotArea area,
final @NonNull Set<CuboidRegion> regions,
final @NonNull Pattern blocks,
int minY,
int maxY,
Runnable whenDone) {
public boolean setCuboids(
final @NonNull PlotArea area,
final @NonNull Set<CuboidRegion> regions,
final @NonNull Pattern blocks,
int minY,
int maxY,
Runnable whenDone
) {
TaskManager.IMP.async(() -> {
synchronized (FaweDelegateRegionManager.class) {
World world = BukkitAdapter.adapt(getWorld(area.getWorldName()));
EditSession session =
new EditSessionBuilder(world).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull()
.autoQueue(false).build();
new EditSessionBuilder(world).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull()
.autoQueue(false).build();
for (CuboidRegion region : regions) {
region.setPos1(region.getPos1().withY(minY));
region.setPos2(region.getPos2().withY(maxY));
@ -67,7 +69,8 @@ public class FaweDelegateRegionManager {
session.flushQueue();
for (CuboidRegion region : regions) {
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) {
e.printStackTrace();
@ -84,14 +87,22 @@ public class FaweDelegateRegionManager {
return hpw.getType() != PlotAreaType.AUGMENTED || hpw.getTerrain() == PlotAreaTerrainType.NONE;
}
public boolean handleClear(@Nonnull Plot plot,
@Nullable Runnable whenDone,
@Nonnull PlotManager manager) {
public boolean handleClear(
@Nonnull Plot plot,
@Nullable Runnable whenDone,
@Nonnull PlotManager manager
) {
TaskManager.IMP.async(() -> {
synchronized (FaweDelegateRegionManager.class) {
final HybridPlotWorld hybridPlotWorld = ((HybridPlotManager) manager).getHybridPlotWorld();
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) {
final BlockType bedrock;
@ -107,12 +118,22 @@ public class FaweDelegateRegionManager {
final BiomeType biome = hybridPlotWorld.getPlotBiome();
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 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 airRegion = new CuboidRegion(pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1), pos2.withY(manager.getWorldHeight()));
Region floorRegion = new CuboidRegion(
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(fillingRegion, filling);
@ -124,14 +145,25 @@ public class FaweDelegateRegionManager {
if (hybridPlotWorld.PLOT_SCHEMATIC) {
// We cannot reuse the 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");
if (!schematicFile.exists()) {
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 {
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);
} catch (IOException e) {
e.printStackTrace();
@ -142,28 +174,49 @@ public class FaweDelegateRegionManager {
// Be verbose in editsession flushing
editSession.flushQueue();
FaweAPI.fixLighting(world, new CuboidRegion(plot.getBottomAbs().getBlockVector3(), plot.getTopAbs().getBlockVector3()), null,
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.IMP.LIGHTING.MODE));
FaweAPI.fixLighting(
world,
new CuboidRegion(plot.getBottomAbs().getBlockVector3(), plot.getTopAbs().getBlockVector3()),
null,
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.IMP.LIGHTING.MODE)
);
TaskManager.IMP.task(whenDone);
}
});
return true;
}
public void swap(Location pos1,
Location pos2,
Location swapPos,
final Runnable whenDone) {
public void swap(
Location pos1,
Location pos2,
Location swapPos,
final Runnable whenDone
) {
TaskManager.IMP.async(() -> {
synchronized (FaweDelegateRegionManager.class) {
//todo because of the following code this should proably be in the Bukkit module
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorldName()));
World pos3World = BukkitAdapter.adapt(getWorld(swapPos.getWorldName()));
WorldEdit.getInstance().getEditSessionFactory().getEditSession(pos1World, -1);
EditSession sessionA = new EditSessionBuilder(pos1World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
EditSession sessionB = new EditSessionBuilder(pos3World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
EditSession sessionA = new EditSessionBuilder(pos1World)
.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 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);
regionB.setWorld(pos3World);
Clipboard clipA = Clipboard.create(regionA, UUID.randomUUID());
@ -181,10 +234,18 @@ public class FaweDelegateRegionManager {
e.printStackTrace();
}
FaweAPI.fixLighting(pos1World, new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()), null,
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,
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,
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.IMP.LIGHTING.MODE)
);
TaskManager.IMP.task(whenDone);
}
});
@ -195,7 +256,13 @@ public class FaweDelegateRegionManager {
region.expand(BlockVector3.at(-extendBiome, 0, -extendBiome));
TaskManager.IMP.async(() -> {
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);
FlatRegionVisitor visitor = new FlatRegionVisitor(region, replace);
try {
@ -209,24 +276,50 @@ public class FaweDelegateRegionManager {
});
}
public boolean copyRegion(final @NonNull Location pos1,
final @NonNull Location pos2,
final @NonNull Location pos3,
final @NonNull Runnable whenDone) {
public boolean copyRegion(
final @NonNull Location pos1,
final @NonNull Location pos2,
final @NonNull Location pos3,
final @NonNull Runnable whenDone
) {
TaskManager.IMP.async(() -> {
synchronized (FaweDelegateRegionManager.class) {
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorldName()));
World pos3World = BukkitAdapter.adapt(getWorld(pos3.getWorldName()));
EditSession from = new EditSessionBuilder(pos1World).checkMemory(false).fastmode(true).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()));
EditSession from = new EditSessionBuilder(pos1World)
.checkMemory(false)
.fastmode(true)
.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 {
Operations.completeLegacy(copy);
to.flushQueue();
FaweAPI.fixLighting(pos1World,
new CuboidRegion(pos3.getBlockVector3(), pos3.getBlockVector3().add(pos2.getBlockVector3().subtract(pos1.getBlockVector3()))),
null, RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.IMP.LIGHTING.MODE));
new CuboidRegion(
pos3.getBlockVector3(),
pos3.getBlockVector3().add(pos2.getBlockVector3().subtract(pos1.getBlockVector3()))
),
null, RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.IMP.LIGHTING.MODE)
);
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}
@ -240,8 +333,17 @@ public class FaweDelegateRegionManager {
TaskManager.IMP.async(() -> {
synchronized (FaweDelegateRegionManager.class) {
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorldName()));
try (EditSession editSession = new EditSessionBuilder(pos1World).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()));
try (EditSession editSession = new EditSessionBuilder(pos1World)
.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.flushQueue();
}
@ -250,4 +352,5 @@ public class FaweDelegateRegionManager {
});
return true;
}
}

Datei anzeigen

@ -3,6 +3,10 @@ package com.fastasyncworldedit.bukkit.regions.plotsquared;
import com.fastasyncworldedit.core.Fawe;
import com.fastasyncworldedit.core.FaweAPI;
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.IOUtil;
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.TaskManager;
import com.sk89q.jnbt.CompoundTag;
import com.fastasyncworldedit.core.jnbt.CompressedCompoundTag;
import com.sk89q.jnbt.NBTInputStream;
import com.sk89q.jnbt.NBTOutputStream;
import com.sk89q.jnbt.Tag;
import com.fastasyncworldedit.core.jnbt.CompressedSchematicTag;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
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.SpongeSchematicReader;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
@ -33,8 +33,8 @@ import com.sk89q.worldedit.regions.CuboidRegion;
import net.jpountz.lz4.LZ4BlockInputStream;
import org.anarres.parallelgzip.ParallelGZIPOutputStream;
import org.apache.logging.log4j.Logger;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.EOFException;
@ -56,13 +56,15 @@ public class FaweDelegateSchematicHandler {
private static final AtomicBoolean exportingAll = new AtomicBoolean();
public void paste(final Schematic schematic,
final Plot plot,
final int xOffset,
final int yOffset,
final int zOffset,
final boolean autoHeight,
final RunnableVal<Boolean> whenDone) {
public void paste(
final Schematic schematic,
final Plot plot,
final int xOffset,
final int yOffset,
final int zOffset,
final boolean autoHeight,
final RunnableVal<Boolean> whenDone
) {
Runnable r = () -> {
if (whenDone != null) {
whenDone.value = false;
@ -78,8 +80,8 @@ public class FaweDelegateSchematicHandler {
// Validate dimensions
CuboidRegion region = plot.getLargestRegion();
if (((region.getMaximumPoint().getX() - region.getMinimumPoint().getX() + xOffset + 1) < WIDTH) || (
(region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset + 1) < LENGTH) || (HEIGHT
> 256)) {
(region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset + 1) < LENGTH) || (HEIGHT
> 256)) {
TaskManager.runTask(whenDone);
return;
}
@ -94,8 +96,9 @@ public class FaweDelegateSchematicHandler {
y_offset_actual = yOffset + ((ClassicPlotWorld) pw).PLOT_HEIGHT;
} else {
y_offset_actual = yOffset + 1 + PlotSquared.platform().worldUtil()
.getHighestBlockSynchronous(plot.getWorldName(), region.getMinimumPoint().getX() + 1,
region.getMinimumPoint().getZ() + 1);
.getHighestBlockSynchronous(plot.getWorldName(), region.getMinimumPoint().getX() + 1,
region.getMinimumPoint().getZ() + 1
);
}
}
} else {
@ -103,10 +106,10 @@ public class FaweDelegateSchematicHandler {
}
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)
.fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build()) {
.fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build()) {
final Clipboard clipboard = schematic.getClipboard();
clipboard.paste(editSession, to, true, false, true);
if (whenDone != null) {
@ -135,20 +138,20 @@ public class FaweDelegateSchematicHandler {
if (cTag instanceof CompressedSchematicTag) {
Clipboard clipboard = (Clipboard) cTag.getSource();
try (OutputStream stream = new FileOutputStream(tmp);
NBTOutputStream output = new NBTOutputStream(
new BufferedOutputStream(new ParallelGZIPOutputStream(stream)))) {
NBTOutputStream output = new NBTOutputStream(
new BufferedOutputStream(new ParallelGZIPOutputStream(stream)))) {
new FastSchematicWriter(output).write(clipboard);
}
} else {
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());
IOUtil.copy(is, output);
}
}
} else {
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();
output.writeNamedTag("Schematic", map.getOrDefault("Schematic", tag));
}
@ -193,7 +196,7 @@ public class FaweDelegateSchematicHandler {
public Schematic getSchematic(@Nonnull InputStream is) {
try {
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();
return new Schematic(clip);
} catch (IOException e) {
@ -203,7 +206,7 @@ public class FaweDelegateSchematicHandler {
}
try {
SpongeSchematicReader schematicReader =
new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(is)));
new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(is)));
Clipboard clip = schematicReader.read();
return new Schematic(clip);
} catch (IOException e2) {
@ -213,17 +216,18 @@ public class FaweDelegateSchematicHandler {
}
try {
MCEditSchematicReader schematicReader =
new MCEditSchematicReader(new NBTInputStream(new GZIPInputStream(is)));
new MCEditSchematicReader(new NBTInputStream(new GZIPInputStream(is)));
Clipboard clip = schematicReader.read();
return new Schematic(clip);
} catch (IOException e3) {
e.printStackTrace();
LOGGER.warn(
is + " | " + is.getClass().getCanonicalName() + " is not in GZIP format : " + e
.getMessage());
is + " | " + is.getClass().getCanonicalName() + " is not in GZIP format : " + e
.getMessage());
}
}
}
return null;
}
}

Datei anzeigen

@ -2,6 +2,7 @@ package com.fastasyncworldedit.bukkit.regions.plotsquared;
import com.fastasyncworldedit.core.Fawe;
import com.fastasyncworldedit.core.FaweCache;
import com.fastasyncworldedit.core.math.MutableBlockVector3;
import com.fastasyncworldedit.core.queue.IQueueChunk;
import com.fastasyncworldedit.core.queue.IQueueExtent;
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.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.fastasyncworldedit.core.math.MutableBlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
@ -29,7 +29,7 @@ public class FaweQueueCoordinator extends QueueCoordinator {
public final IQueueExtent<IQueueChunk> instance;
private final World world;
private BlockVector3 mutable = new MutableBlockVector3();
private final BlockVector3 mutable = new MutableBlockVector3();
private boolean setbiome = false;
public FaweQueueCoordinator(World world) {
@ -202,4 +202,5 @@ public class FaweQueueCoordinator extends QueueCoordinator {
public boolean isSettingTiles() {
return false;
}
}

Datei anzeigen

@ -12,10 +12,10 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer;
@CommandDeclaration(command = "trimchunks",
permission = "plots.admin",
description = "Delete unmodified portions of your plotworld",
requiredType = RequiredType.PLAYER,
category = CommandCategory.ADMINISTRATION)
permission = "plots.admin",
description = "Delete unmodified portions of your plotworld",
requiredType = RequiredType.PLAYER,
category = CommandCategory.ADMINISTRATION)
public class FaweTrim extends SubCommand {
private boolean ran = false;
@ -28,7 +28,7 @@ public class FaweTrim extends SubCommand {
}
if (strings.length != 2) {
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>"));
return false;
}
@ -52,4 +52,5 @@ public class FaweTrim extends SubCommand {
});
return true;
}
}

Datei anzeigen

@ -11,6 +11,7 @@ import java.util.ArrayList;
import static com.google.common.base.Preconditions.checkNotNull;
public class PlotRegionFilter extends CuboidRegionFilter {
private final 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()));
}
}
}

Datei anzeigen

@ -35,43 +35,53 @@ import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors;
@CommandDeclaration(command = "generatebiome",
permission = "plots.generatebiome",
category = CommandCategory.APPEARANCE,
requiredType = RequiredType.PLAYER,
description = "Generate a biome in your plot",
aliases = {"bg", "gb"},
usage = "/plots generatebiome <biome>")
permission = "plots.generatebiome",
category = CommandCategory.APPEARANCE,
requiredType = RequiredType.PLAYER,
description = "Generate a biome in your plot",
aliases = {"bg", "gb"},
usage = "/plots generatebiome <biome>")
public class PlotSetBiome extends Command {
public PlotSetBiome() {
super(MainCommand.getInstance(), true);
}
@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(), TranslatableCaption.of("errors.not_in_plot"));
checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.generatebiome"),
TranslatableCaption.of("permission.no_plot_perms"));
checkTrue(
plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.generatebiome"),
TranslatableCaption.of("permission.no_plot_perms")
);
if (plot.getRunning() != 0) {
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
return null;
}
checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"),
Templates.of("value", getUsage()));
Templates.of("value", getUsage())
);
final Set<CuboidRegion> regions = plot.getRegions();
BiomeRegistry biomeRegistry =
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries()
.getBiomeRegistry();
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries()
.getBiomeRegistry();
Collection<BiomeType> knownBiomes = BiomeTypes.values();
final BiomeType biome = Biomes.findBiomeByName(knownBiomes, args[0], biomeRegistry);
if (biome == null) {
String biomes = StringMan.join(BiomeType.REGISTRY.values(),
TranslatableCaption.of("blocklist.block_list_separator").getComponent(player));
String biomes = StringMan.join(
BiomeType.REGISTRY.values(),
TranslatableCaption.of("blocklist.block_list_separator").getComponent(player)
);
player.sendMessage(TranslatableCaption.of("biome.need_biome"));
player.sendMessage(TranslatableCaption.of("commandconfig.subcommand_set_options_header"),
Templates.of("values", biomes));
player.sendMessage(
TranslatableCaption.of("commandconfig.subcommand_set_options_header"),
Templates.of("values", biomes)
);
return CompletableFuture.completedFuture(false);
}
confirm.run(this, () -> {
@ -82,9 +92,9 @@ public class PlotSetBiome extends Command {
plot.addRunning();
TaskManager.IMP.async(() -> {
EditSession session =
new EditSessionBuilder(BukkitAdapter.adapt(Bukkit.getWorld(plot.getArea().getWorldName())))
.autoQueue(false).checkMemory(false).allowedRegionsEverywhere()
.player(BukkitAdapter.adapt(Bukkit.getPlayer(player.getUUID()))).limitUnlimited().build();
new EditSessionBuilder(BukkitAdapter.adapt(Bukkit.getWorld(plot.getArea().getWorldName())))
.autoQueue(false).checkMemory(false).allowedRegionsEverywhere()
.player(BukkitAdapter.adapt(Bukkit.getPlayer(player.getUUID()))).limitUnlimited().build();
long seed = ThreadLocalRandom.current().nextLong();
for (CuboidRegion region : regions) {
session.regenerate(region, biome, seed);
@ -105,4 +115,5 @@ public class PlotSetBiome extends Command {
.map(value -> new Command(null, false, value, "", RequiredType.PLAYER, null) {
}).collect(Collectors.toList());
}
}

Datei anzeigen

@ -69,9 +69,9 @@ public class PlotSquaredFeature extends FaweMaskManager {
}
UUID uid = player.getUniqueId();
return !plot.getFlag(NoWorldeditFlag.class) && (plot.isOwner(uid) || type == MaskType.MEMBER && (
plot.getTrusted().contains(uid) || plot.getTrusted().contains(DBFunc.EVERYONE)
|| (plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE)) && player
.hasPermission("fawe.plotsquared.member")) || player.hasPermission("fawe.plotsquared.admin"));
plot.getTrusted().contains(uid) || plot.getTrusted().contains(DBFunc.EVERYONE)
|| (plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE)) && player
.hasPermission("fawe.plotsquared.member")) || player.hasPermission("fawe.plotsquared.admin"));
}
@Override
@ -90,7 +90,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
if (regions.size() == 1) {
CuboidRegion region = regions.iterator().next();
if (region.getMinimumPoint().getX() == Integer.MIN_VALUE
&& region.getMaximumPoint().getX() == Integer.MAX_VALUE) {
&& region.getMaximumPoint().getX() == Integer.MAX_VALUE) {
regions.clear();
}
}
@ -116,8 +116,9 @@ public class PlotSquaredFeature extends FaweMaskManager {
} else {
World world = FaweAPI.getWorld(area.getWorldName());
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()))).collect(Collectors.toList());
r -> new CuboidRegion(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);
}
@ -140,4 +141,5 @@ public class PlotSquaredFeature extends FaweMaskManager {
}
return null;
}
}

Datei anzeigen

@ -23,7 +23,7 @@ import static org.bukkit.Bukkit.getWorld;
public class FaweChunkManager extends ChunkManager {
private ChunkManager parent;
private final ChunkManager parent;
public FaweChunkManager(ChunkManager parent) {
this.parent = parent;
@ -50,7 +50,13 @@ public class FaweChunkManager extends ChunkManager {
}
@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) {
parent.swap(pos1, pos2, pos3, pos4, whenDone);
}
@ -60,11 +66,29 @@ public class FaweChunkManager extends ChunkManager {
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
World pos3World = BukkitAdapter.adapt(getWorld(pos3.getWorld()));
WorldEdit.getInstance().getEditSessionFactory().getEditSession(
pos1World,-1);
EditSession sessionA = new EditSessionBuilder(pos1World).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(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()));
pos1World, -1);
EditSession sessionA = new EditSessionBuilder(pos1World)
.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(
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 copyB = new ForwardExtentCopy(sessionB, regionB, sessionA, regionA.getMinimumPoint());
try {
@ -89,10 +113,30 @@ public class FaweChunkManager extends ChunkManager {
synchronized (FaweChunkManager.class) {
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
World pos3World = BukkitAdapter.adapt(getWorld(pos3.getWorld()));
EditSession from = new EditSessionBuilder(pos1World).checkMemory(false).fastmode(true).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()));
EditSession from = new EditSessionBuilder(pos1World)
.checkMemory(false)
.fastmode(true)
.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 {
Operations.completeLegacy(copy);
to.flushQueue();
@ -111,10 +155,11 @@ public class FaweChunkManager extends ChunkManager {
synchronized (FaweChunkManager.class) {
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
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(
BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()),
BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()),
BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ())
);
editSession.regenerate(region);
editSession.flushQueue();
}
@ -123,4 +168,5 @@ public class FaweChunkManager extends ChunkManager {
});
return true;
}
}

Datei anzeigen

@ -3,13 +3,13 @@ package com.fastasyncworldedit.bukkit.regions.plotsquaredv4;
import com.fastasyncworldedit.core.Fawe;
import com.fastasyncworldedit.core.FaweAPI;
import com.fastasyncworldedit.core.FaweCache;
import com.fastasyncworldedit.core.math.MutableBlockVector3;
import com.fastasyncworldedit.core.queue.IQueueChunk;
import com.fastasyncworldedit.core.queue.IQueueExtent;
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.fastasyncworldedit.core.math.MutableBlockVector3;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
@ -20,7 +20,7 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
public final IQueueExtent<IQueueChunk> instance;
private final World world;
private BlockVector3 mutable = new MutableBlockVector3();
private final BlockVector3 mutable = new MutableBlockVector3();
public FaweLocalBlockQueue(String 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));
return true;
}
}

Datei anzeigen

@ -3,6 +3,9 @@ package com.fastasyncworldedit.bukkit.regions.plotsquaredv4;
import com.fastasyncworldedit.core.FaweAPI;
import com.fastasyncworldedit.core.FaweCache;
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.IOUtil;
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.block.LocalBlockQueue;
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.Tag;
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.Clipboard;
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.regions.CuboidRegion;
import com.sk89q.worldedit.world.World;
@ -43,6 +43,7 @@ import java.util.UUID;
import static org.bukkit.Bukkit.getWorld;
public class FaweSchematicHandler extends SchematicHandler {
@Override
public boolean restoreTile(LocalBlockQueue queue, CompoundTag compoundTag, int x, int y, int z) {
if (queue instanceof FaweLocalBlockQueue) {
@ -59,8 +60,17 @@ public class FaweSchematicHandler extends SchematicHandler {
Location pos1 = corners[0];
Location pos2 = corners[1];
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 EditSession editSession = new EditSessionBuilder(adaptedWorld).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
final CuboidRegion region = new CuboidRegion(
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);
@ -84,17 +94,20 @@ public class FaweSchematicHandler extends SchematicHandler {
CompressedCompoundTag cTag = (CompressedCompoundTag) tag;
if (cTag instanceof CompressedSchematicTag) {
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);
}
} 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());
IOUtil.copy(is, stream);
}
}
} 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();
output.writeNamedTag("Schematic", map.getOrDefault("Schematic", tag));
}
@ -138,4 +151,5 @@ public class FaweSchematicHandler extends SchematicHandler {
}
}, whenDone);
}
}

Datei anzeigen

@ -26,7 +26,8 @@ public class FaweTrim extends SubCommand {
return false;
}
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>");
return false;
}
@ -53,4 +54,5 @@ public class FaweTrim extends SubCommand {
});
return true;
}
}

Datei anzeigen

@ -11,6 +11,7 @@ import java.util.ArrayList;
import static com.google.common.base.Preconditions.checkNotNull;
public class PlotRegionFilter extends CuboidRegionFilter {
private final 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()));
}
}
}

Datei anzeigen

@ -24,11 +24,12 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes;
import com.sk89q.worldedit.world.biome.Biomes;
import com.sk89q.worldedit.world.registry.BiomeRegistry;
import org.bukkit.Bukkit;
import java.util.Collection;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadLocalRandom;
import org.bukkit.Bukkit;
@CommandDeclaration(
command = "generatebiome",
@ -40,29 +41,40 @@ import org.bukkit.Bukkit;
usage = "/plots generatebiome <biome>"
)
public class PlotSetBiome extends Command {
public PlotSetBiome() {
super(MainCommand.getInstance(), true);
}
@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);
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) {
Captions.WAIT_FOR_TIMER.send(player);
return null;
}
checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage());
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();
final BiomeType biome = Biomes.findBiomeByName(knownBiomes, args[0], biomeRegistry);
if (biome == null) {
String biomes = StringMan
.join(BiomeType.REGISTRY.values(), Captions.BLOCK_LIST_SEPARATOR.getTranslated());
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);
}
confirm.run(this, () -> {
@ -90,4 +102,5 @@ public class PlotSetBiome extends Command {
return CompletableFuture.completedFuture(true);
}
}

Datei anzeigen

@ -1,9 +1,9 @@
package com.fastasyncworldedit.bukkit.regions.plotsquaredv4;
import com.fastasyncworldedit.core.FaweAPI;
import com.fastasyncworldedit.core.regions.RegionWrapper;
import com.fastasyncworldedit.core.regions.FaweMask;
import com.fastasyncworldedit.core.regions.FaweMaskManager;
import com.fastasyncworldedit.core.regions.RegionWrapper;
import com.fastasyncworldedit.core.regions.filter.RegionFilter;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
@ -97,11 +97,11 @@ public class PlotSquaredFeature extends FaweMaskManager {
}
UUID uid = player.getUniqueId();
return !Flags.NO_WORLDEDIT.isTrue(plot) && (plot.isOwner(uid)
|| type == MaskType.MEMBER && (plot.getTrusted().contains(uid) || plot.getTrusted()
.contains(DBFunc.EVERYONE)
|| (plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE))
&& player.hasPermission("fawe.plotsquared.member")) || player
.hasPermission("fawe.plotsquared.admin"));
|| type == MaskType.MEMBER && (plot.getTrusted().contains(uid) || plot.getTrusted()
.contains(DBFunc.EVERYONE)
|| (plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE))
&& player.hasPermission("fawe.plotsquared.member")) || player
.hasPermission("fawe.plotsquared.admin"));
}
@Override
@ -119,7 +119,9 @@ public class PlotSquaredFeature extends FaweMaskManager {
regions = WEManager.getMask(pp);
if (regions.size() == 1) {
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();
}
}
@ -132,7 +134,14 @@ public class PlotSquaredFeature extends FaweMaskManager {
int max = area != null ? Math.min(255, area.MAX_BUILD_HEIGHT) : 255;
final HashSet<RegionWrapper> faweRegions = new HashSet<>();
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 BlockVector3 pos1 = BlockVector3.at(region.getMinimumX(), min, region.getMinimumZ());
@ -148,8 +157,12 @@ public class PlotSquaredFeature extends FaweMaskManager {
} else {
World world = FaweAPI.getWorld(area.worldname);
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())))
.collect(Collectors.toList());
.map(r -> new CuboidRegion(
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);
}
@ -172,4 +185,5 @@ public class PlotSquaredFeature extends FaweMaskManager {
}
return null;
}
}

Datei anzeigen

@ -1,8 +1,7 @@
package com.fastasyncworldedit.bukkit.util;
import com.fastasyncworldedit.core.Fawe;
import com.fastasyncworldedit.bukkit.FaweBukkit;
import com.fastasyncworldedit.bukkit.util.ItemUtil;
import com.fastasyncworldedit.core.Fawe;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
@ -12,6 +11,7 @@ import org.bukkit.inventory.ItemStack;
import javax.annotation.Nullable;
public class BukkitItemStack extends BaseItemStack {
private ItemStack stack;
private Object nativeItem;
private boolean loadedNBT;
@ -75,4 +75,5 @@ public class BukkitItemStack extends BaseItemStack {
}
super.setNbtData(nbtData);
}
}

Datei anzeigen

@ -7,6 +7,7 @@ import org.bukkit.Server;
import java.lang.reflect.Method;
public class BukkitReflectionUtils {
/**
* Prefix of Bukkit classes.
*/
@ -55,4 +56,5 @@ public class BukkitReflectionUtils {
final String packageName = Bukkit.getServer().getClass().getPackage().getName();
return packageName.substring(packageName.lastIndexOf('.') + 1);
}
}

Datei anzeigen

@ -4,6 +4,7 @@ import com.fastasyncworldedit.core.util.TaskManager;
import org.apache.commons.lang.mutable.MutableInt;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import javax.annotation.Nonnull;
public class BukkitTaskManager extends TaskManager {
@ -52,4 +53,5 @@ public class BukkitTaskManager extends TaskManager {
Bukkit.getScheduler().cancelTask(task);
}
}
}

Datei anzeigen

@ -1,7 +1,6 @@
package com.fastasyncworldedit.bukkit.util;
import com.fastasyncworldedit.core.util.ReflectionUtils;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
@ -39,7 +38,10 @@ public class ItemUtil {
this.fieldHandle = ReflectionUtils.setAccessible(classCraftItemStack.getDeclaredField("handle"));
Class<?> classNBTTagCompound = BukkitReflectionUtils.getNmsClass("NBTTagCompound");
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) {
@ -56,7 +58,6 @@ public class ItemUtil {
}
public CompoundTag getNBT(ItemStack item) {
try {
if (!item.hasItemMeta()) {
@ -113,4 +114,5 @@ public class ItemUtil {
}
return null;
}
}

Datei anzeigen

@ -2,6 +2,7 @@ package com.fastasyncworldedit.bukkit.util;
import com.google.common.collect.ComparisonChain;
import org.bukkit.Bukkit;
import javax.annotation.Nonnull;
/**
@ -119,19 +120,28 @@ public class MinecraftVersion implements Comparable<MinecraftVersion> {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MinecraftVersion that = (MinecraftVersion) o;
if (getMajor() != that.getMajor()) return false;
if (getMinor() != that.getMinor()) return false;
if (getMajor() != that.getMajor()) {
return false;
}
if (getMinor() != that.getMinor()) {
return false;
}
return getRelease() == that.getRelease();
}
/**
* 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.
*/

Datei anzeigen

@ -5,15 +5,17 @@ import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
public class VaultUtil {
public final Permission permission;
public VaultUtil() {
final RegisteredServiceProvider<Permission> permissionProvider =
Bukkit.getServer().getServicesManager().getRegistration(Permission.class);
Bukkit.getServer().getServicesManager().getRegistration(Permission.class);
if (permissionProvider != null) {
this.permission = permissionProvider.getProvider();
} else {
this.permission = null;
}
}
}

Datei anzeigen

@ -14,4 +14,5 @@ public class WorldUnloadedException extends WorldEditException {
public WorldUnloadedException() {
super(Caption.of("worldedit.error.world-unloaded"));
}
}

Datei anzeigen

@ -20,13 +20,14 @@ import org.inventivetalent.mapmanager.controller.MultiMapController;
import org.inventivetalent.mapmanager.manager.MapManager;
import org.inventivetalent.mapmanager.wrapper.MapWrapper;
import javax.annotation.Nullable;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Collection;
import javax.annotation.Nullable;
public class BukkitImageViewer implements ImageViewer {
private final MapManager mapManager;
private final Player player;
private BufferedImage last;
@ -148,7 +149,13 @@ public class BukkitImageViewer implements ImageViewer {
last = image;
int width = frames.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);
MultiMapController controller = (MultiMapController) mapWrapper.getController();
controller.addViewer(player);
@ -169,7 +176,13 @@ public class BukkitImageViewer implements ImageViewer {
image = drawable.draw();
}
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);
MapController controller = mapWrapper.getController();
controller.addViewer(player);
@ -199,4 +212,5 @@ public class BukkitImageViewer implements ImageViewer {
public void close() throws IOException {
last = null;
}
}

Datei anzeigen

@ -25,12 +25,12 @@ import com.sk89q.worldedit.internal.util.LogManagerCompat;
import org.apache.logging.log4j.Logger;
import org.bukkit.plugin.Plugin;
import javax.annotation.Nullable;
import java.security.CodeSource;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.annotation.Nullable;
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("** 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("** 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("** This may have happened because the developer is using\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());
}
}

Datei anzeigen

@ -29,4 +29,5 @@ public interface CommandInspector {
String getFullText(Command command);
boolean testPermission(CommandSender sender, Command command);
}

Datei anzeigen

@ -37,8 +37,10 @@ import java.util.Set;
public class CommandRegistration {
static {
Bukkit.getServer().getHelpMap().registerHelpTopicFactory(DynamicPluginCommand.class,
new DynamicPluginCommandHelpTopic.Factory());
Bukkit.getServer().getHelpMap().registerHelpTopicFactory(
DynamicPluginCommand.class,
new DynamicPluginCommandHelpTopic.Factory()
);
}
protected final Plugin plugin;
@ -72,8 +74,14 @@ public class CommandRegistration {
return false;
}
for (CommandInfo command : registered) {
DynamicPluginCommand cmd = new DynamicPluginCommand(command.getAliases(),
command.getDesc(), "/" + command.getAliases()[0] + " " + command.getUsage(), executor, command.getRegisteredWith(), plugin);
DynamicPluginCommand cmd = new DynamicPluginCommand(
command.getAliases(),
command.getDesc(),
"/" + command.getAliases()[0] + " " + command.getUsage(),
executor,
command.getRegisteredWith(),
plugin
);
cmd.setPermissions(command.getPermissions());
commandMap.register(plugin.getDescription().getName(), cmd);
}
@ -91,7 +99,7 @@ public class CommandRegistration {
CommandMap commandMap = ReflectionUtil.getField(plugin.getServer().getPluginManager(), "commandMap");
if (commandMap == null) {
Bukkit.getServer().getLogger().severe(plugin.getDescription().getName()
+ ": Could not retrieve server CommandMap, using fallback instead!");
+ ": Could not retrieve server CommandMap, using fallback instead!");
fallbackCommands = commandMap = new SimpleCommandMap(Bukkit.getServer());
Bukkit.getServer().getPluginManager().registerEvents(new FallbackRegistrationListener(fallbackCommands), plugin);
} else {
@ -108,7 +116,7 @@ public class CommandRegistration {
if (knownCommands == null || aliases == null) {
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();
if (cmd instanceof DynamicPluginCommand && ((DynamicPluginCommand) cmd).getOwner().equals(executor)) {
i.remove();

Datei anzeigen

@ -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);

Datei anzeigen

@ -33,8 +33,8 @@ import java.util.Arrays;
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")
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 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));
this.owner = owner;
this.owningPlugin = plugin;
@ -118,4 +125,5 @@ public class DynamicPluginCommand extends org.bukkit.command.Command implements
}
return super.testPermissionSilent(sender);
}
}

Datei anzeigen

@ -139,10 +139,12 @@ public class DynamicPluginCommandHelpTopic extends HelpTopic {
}
public static class Factory implements HelpTopicFactory<DynamicPluginCommand> {
@Override
public HelpTopic createTopic(DynamicPluginCommand command) {
return new DynamicPluginCommandHelpTopic(command);
}
}
}

Datei anzeigen

@ -31,6 +31,7 @@ import java.util.Map;
import java.util.Set;
public class ConfigurationPermissionsResolver implements PermissionsResolver {
private final YAMLProcessor config;
private final Map<String, Set<String>> userPermissionsCache = new HashMap<>();
private final Set<String> defaultPermissionsCache = new HashSet<>();
@ -41,14 +42,14 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
}
public static YAMLNode generateDefaultPerms(YAMLNode section) {
section.setProperty("groups.default.permissions", new String[] {
"worldedit.reload",
"worldedit.selection",
"worlds.creative.worldedit.region"
section.setProperty("groups.default.permissions", new String[]{
"worldedit.reload",
"worldedit.selection",
"worlds.creative.worldedit.region"
});
section.setProperty("groups.admins.permissions", new String[] { "*" });
section.setProperty("users.sk89q.permissions", new String[] { "worldedit" });
section.setProperty("users.sk89q.groups", new String[] { "admins" });
section.setProperty("groups.admins.permissions", new String[]{"*"});
section.setProperty("users.sk89q.permissions", new String[]{"worldedit"});
section.setProperty("users.sk89q.groups", new String[]{"admins"});
return section;
}

Datei anzeigen

@ -174,4 +174,5 @@ public class DinnerPermsResolver implements PermissionsResolver {
public String getDetectionMessage() {
return "Using the Bukkit Permissions API.";
}
}

Datei anzeigen

@ -20,10 +20,11 @@
package com.sk89q.wepif;
import com.sk89q.util.yaml.YAMLProcessor;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import org.apache.logging.log4j.Logger;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
@ -123,7 +124,7 @@ public class FlatFilePermissionsResolver implements PermissionsResolver {
defaultPermissionsCache = userGroupPermissions.get("default");
}
BufferedReader buff = null;
BufferedReader buff = null;
try {
FileReader input = new FileReader(this.userFile);

Datei anzeigen

@ -28,6 +28,7 @@ import org.bukkit.World;
import org.bukkit.permissions.Permissible;
public class GroupManagerResolver extends DinnerPermsResolver {
private final WorldsHolder worldsHolder;
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
@ -128,4 +129,5 @@ public class GroupManagerResolver extends DinnerPermsResolver {
public String getDetectionMessage() {
return "GroupManager detected! Using GroupManager for permissions.";
}
}

Datei anzeigen

@ -134,7 +134,7 @@ public class NijiPermissionsResolver implements PermissionsResolver {
} catch (Throwable t) {
String group = Permissions.Security.getGroup(player.getWorld().getName(), player.getName());
if (group != null) {
groups = new String[] { group };
groups = new String[]{group};
}
}
if (groups == null) {

Datei anzeigen

@ -27,6 +27,7 @@ import ru.tehkode.permissions.PermissionManager;
import ru.tehkode.permissions.PermissionUser;
public class PermissionsExResolver extends DinnerPermsResolver {
private final PermissionManager manager;
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
@ -90,4 +91,5 @@ public class PermissionsExResolver extends DinnerPermsResolver {
public String getDetectionMessage() {
return "PermissionsEx detected! Using PermissionsEx for permissions.";
}
}

Datei anzeigen

@ -22,6 +22,7 @@ package com.sk89q.wepif;
import org.bukkit.OfflinePlayer;
public interface PermissionsProvider {
boolean hasPermission(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);
String[] getGroups(OfflinePlayer player);
}

Datei anzeigen

@ -20,7 +20,9 @@
package com.sk89q.wepif;
public interface PermissionsResolver extends PermissionsProvider {
void load();
String getDetectionMessage();
}

Datei anzeigen

@ -41,23 +41,23 @@ import java.util.List;
public class PermissionsResolverManager implements PermissionsResolver {
private static final String CONFIG_HEADER = "#\r\n"
+ "# WEPIF Configuration File\r\n"
+ "#\r\n"
+ "# This file handles permissions configuration for every plugin using WEPIF\r\n"
+ "#\r\n"
+ "# About editing this file:\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"
+ "# must configure it to \"replace tabs with spaces.\" In Notepad++, this can\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"
+ "# in categories (like \"enforce-single-session\" is in the \"protection\"\r\n"
+ "# category.\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"
+ "# and see if it gives \"ERROR:\".\r\n"
+ "# - Lines starting with # are comments and so they are ignored.\r\n"
+ "\r\n";
+ "# WEPIF Configuration File\r\n"
+ "#\r\n"
+ "# This file handles permissions configuration for every plugin using WEPIF\r\n"
+ "#\r\n"
+ "# About editing this file:\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"
+ "# must configure it to \"replace tabs with spaces.\" In Notepad++, this can\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"
+ "# in categories (like \"enforce-single-session\" is in the \"protection\"\r\n"
+ "# category.\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"
+ "# and see if it gives \"ERROR:\".\r\n"
+ "# - Lines starting with # are comments and so they are ignored.\r\n"
+ "\r\n";
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<>();
@SuppressWarnings("unchecked")
protected Class<? extends PermissionsResolver>[] availableResolvers = new Class[] {
PluginPermissionsResolver.class,
PermissionsExResolver.class,
bPermissionsResolver.class,
GroupManagerResolver.class,
NijiPermissionsResolver.class,
VaultResolver.class,
DinnerPermsResolver.class,
FlatFilePermissionsResolver.class
protected Class<? extends PermissionsResolver>[] availableResolvers = new Class[]{
PluginPermissionsResolver.class,
PermissionsExResolver.class,
bPermissionsResolver.class,
GroupManagerResolver.class,
NijiPermissionsResolver.class,
VaultResolver.class,
DinnerPermsResolver.class,
FlatFilePermissionsResolver.class
};
protected PermissionsResolverManager(Plugin plugin) {
@ -221,7 +221,7 @@ public class PermissionsResolverManager implements PermissionsResolver {
} else {
List<String> disabledResolvers = config.getStringList("resolvers.disabled", new ArrayList<>());
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();
Class<?> next = null;
try {
@ -242,11 +242,11 @@ public class PermissionsResolverManager implements PermissionsResolver {
for (Class<?> clazz : availableResolvers) {
if (!stagedEnabled.contains(clazz.getSimpleName())
&& !disabledResolvers.contains(clazz.getSimpleName())) {
&& !disabledResolvers.contains(clazz.getSimpleName())) {
disabledResolvers.add(clazz.getSimpleName());
LOGGER.info("New permissions resolver: "
+ clazz.getSimpleName() + " detected. "
+ "Added to disabled resolvers list.");
+ clazz.getSimpleName() + " detected. "
+ "Added to disabled resolvers list.");
isUpdated = true;
}
}
@ -272,9 +272,11 @@ public class PermissionsResolverManager implements PermissionsResolver {
}
public static class MissingPluginException extends Exception {
}
class ServerListener implements org.bukkit.event.Listener {
@EventHandler
public void onPluginEnable(PluginEnableEvent event) {
Plugin plugin = event.getPlugin();
@ -303,6 +305,7 @@ public class PermissionsResolverManager implements PermissionsResolver {
void register(Plugin plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
}
}

Datei anzeigen

@ -32,7 +32,8 @@ public class PluginPermissionsResolver implements PermissionsResolver {
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
// Looking for service
RegisteredServiceProvider<PermissionsProvider> serviceProvider = server.getServicesManager().getRegistration(PermissionsProvider.class);
RegisteredServiceProvider<PermissionsProvider> serviceProvider = server.getServicesManager().getRegistration(
PermissionsProvider.class);
if (serviceProvider != null) {
return new PluginPermissionsResolver(serviceProvider.getProvider(), serviceProvider.getPlugin());

Datei anzeigen

@ -19,11 +19,11 @@
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.blocks.BaseItemStack;
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.extension.input.ParserContext;
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.entity.Player;
import org.bukkit.inventory.ItemStack;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;
@ -89,7 +89,7 @@ public enum BukkitAdapter {
* Checks equality between a WorldEdit BlockType and a Bukkit Material.
*
* @param blockType The WorldEdit BlockType
* @param type The Bukkit Material
* @param type The Bukkit Material
* @return If they are equal
*/
public static boolean equals(BlockType blockType, Material type) {
@ -184,11 +184,16 @@ public enum BukkitAdapter {
return null;
}
switch (face) {
case NORTH: return Direction.NORTH;
case SOUTH: return Direction.SOUTH;
case WEST: return Direction.WEST;
case EAST: return Direction.EAST;
case DOWN: return Direction.DOWN;
case NORTH:
return Direction.NORTH;
case SOUTH:
return Direction.SOUTH;
case WEST:
return Direction.WEST;
case EAST:
return Direction.EAST;
case DOWN:
return Direction.DOWN;
case UP:
default:
return Direction.UP;
@ -220,7 +225,8 @@ public enum BukkitAdapter {
adapt(location.getWorld()),
position,
location.getYaw(),
location.getPitch());
location.getPitch()
);
}
/**
@ -236,13 +242,14 @@ public enum BukkitAdapter {
adapt((World) location.getExtent()),
position.getX(), position.getY(), position.getZ(),
location.getYaw(),
location.getPitch());
location.getPitch()
);
}
/**
* 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
* @return a Bukkit location
*/
@ -251,13 +258,14 @@ public enum BukkitAdapter {
checkNotNull(position);
return new org.bukkit.Location(
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.
*
* @param world the Bukkit world
* @param world the Bukkit world
* @param position the WorldEdit position
* @return a Bukkit location
*/
@ -266,13 +274,14 @@ public enum BukkitAdapter {
checkNotNull(position);
return new org.bukkit.Location(
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.
*
* @param world the Bukkit world
* @param world the Bukkit world
* @param location the WorldEdit location
* @return a Bukkit location
*/
@ -283,7 +292,8 @@ public enum BukkitAdapter {
world,
location.getX(), location.getY(), location.getZ(),
location.getYaw(),
location.getPitch());
location.getPitch()
);
}
/**
@ -392,8 +402,8 @@ public enum BukkitAdapter {
//FAWE end
}
private static EnumMap<Material, BlockType> materialBlockTypeCache = new EnumMap<>(Material.class);
private static EnumMap<Material, ItemType> materialItemTypeCache = new EnumMap<>(Material.class);
private static final EnumMap<Material, BlockType> materialBlockTypeCache = new EnumMap<>(Material.class);
private static final EnumMap<Material, ItemType> materialItemTypeCache = new EnumMap<>(Material.class);
/**
* Converts a Material to a BlockType.
@ -421,8 +431,8 @@ public enum BukkitAdapter {
//FAWE end
}
private static Int2ObjectMap<BlockState> blockStateCache = new Int2ObjectOpenHashMap<>();
private static Map<String, BlockState> blockStateStringCache = new HashMap<>();
private static final Int2ObjectMap<BlockState> blockStateCache = new Int2ObjectOpenHashMap<>();
private static final Map<String, BlockState> blockStateStringCache = new HashMap<>();
/**
* Create a WorldEdit BlockState from a Bukkit BlockData.
@ -436,7 +446,7 @@ public enum BukkitAdapter {
//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.

Datei anzeigen

@ -40,7 +40,7 @@ class BukkitBiomeRegistry implements BiomeRegistry {
@Override
public Component getRichName(BiomeType biomeType) {
return TranslatableComponent.of(
TranslationManager.makeTranslationKey("biome", biomeType.getId())
TranslationManager.makeTranslationKey("biome", biomeType.getId())
);
}

Datei anzeigen

@ -39,8 +39,9 @@ public class BukkitBlockCategoryRegistry implements BlockCategoryRegistry {
public Set<BlockType> getCategorisedByName(String category) {
String[] split = category.split(":");
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);
return getFromBukkitTag(tag);
}
}

Datei anzeigen

@ -33,10 +33,8 @@ import com.sk89q.worldedit.util.formatting.text.adapter.bukkit.TextAdapter;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.command.BlockCommandSender;
import javax.annotation.Nonnull;
import java.nio.charset.StandardCharsets;
import java.util.Locale;
@ -192,11 +190,13 @@ public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements
updateActive();
} else {
// we should update it eventually
Bukkit.getScheduler().callSyncMethod(plugin,
Bukkit.getScheduler().callSyncMethod(
plugin,
() -> {
updateActive();
return null;
});
}
);
}
return active;
}
@ -212,4 +212,5 @@ public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements
}
};
}
}

Datei anzeigen

@ -20,8 +20,8 @@
package com.sk89q.worldedit.bukkit;
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.util.formatting.text.Component;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
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.block.data.BlockData;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import java.util.OptionalInt;
import javax.annotation.Nullable;
public class BukkitBlockRegistry extends BundledBlockRegistry {
@ -144,6 +144,7 @@ public class BukkitBlockRegistry extends BundledBlockRegistry {
public boolean isTranslucent() {
return material.isTransparent();
}
}
//FAWE start

Datei anzeigen

@ -77,11 +77,12 @@ class BukkitCommandInspector implements CommandInspector {
if (mapping.isPresent()) {
InjectedValueStore store = MapBackedValueStore.create();
store.injectValue(Key.of(Actor.class), context ->
Optional.of(plugin.wrapCommandSender(sender)));
Optional.of(plugin.wrapCommandSender(sender)));
return mapping.get().getCondition().satisfied(store);
} else {
LOGGER.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
return false;
}
}
}

Datei anzeigen

@ -30,9 +30,9 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import javax.annotation.Nullable;
import java.util.Locale;
import java.util.UUID;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@ -114,7 +114,8 @@ public class BukkitCommandSender extends AbstractNonPlayerActor {
}
//FAWE start
@Override public void setPermission(String permission, boolean value) {
@Override
public void setPermission(String permission, boolean value) {
}
//FAWE end
@ -162,4 +163,5 @@ public class BukkitCommandSender extends AbstractNonPlayerActor {
}
};
}
}

Datei anzeigen

@ -34,7 +34,8 @@ public class BukkitConfiguration extends YAMLConfiguration {
public boolean noOpPermissions = false;
public boolean commandBlockSupport = false;
@Unreported private final WorldEditPlugin plugin;
@Unreported
private final WorldEditPlugin plugin;
public BukkitConfiguration(YAMLProcessor config, WorldEditPlugin plugin) {
super(config, LogManager.getLogger(plugin.getLogger().getName()));
@ -72,4 +73,5 @@ public class BukkitConfiguration extends YAMLConfiguration {
public Path getWorkingDirectoryPath() {
return plugin.getDataFolder().toPath();
}
}

Datei anzeigen

@ -27,12 +27,10 @@ import com.sk89q.worldedit.entity.metadata.EntityProperties;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.NullWorld;
import com.sk89q.worldedit.world.entity.EntityTypes;
import org.bukkit.entity.EntityType;
import java.lang.ref.WeakReference;
import java.util.Locale;
import javax.annotation.Nullable;
import java.lang.ref.WeakReference;
import static com.google.common.base.Preconditions.checkNotNull;
@ -136,4 +134,5 @@ public class BukkitEntity implements Entity {
return null;
}
}
}

Datei anzeigen

@ -170,4 +170,5 @@ class BukkitEntityProperties implements EntityProperties {
public boolean isWaterCreature() {
return entity instanceof WaterMob;
}
}

Datei anzeigen

@ -39,8 +39,9 @@ public class BukkitItemCategoryRegistry implements ItemCategoryRegistry {
public Set<ItemType> getCategorisedByName(String category) {
String[] split = category.split(":");
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);
return getFromBukkitTag(tag);
}
}

Datei anzeigen

@ -29,6 +29,7 @@ import java.util.ArrayList;
import java.util.Collection;
class BukkitItemRegistry extends BundledItemRegistry {
@Override
public Component getRichName(ItemType itemType) {
if (WorldEditPlugin.getInstance().getBukkitImplAdapter() != null) {

Datei anzeigen

@ -21,8 +21,8 @@ package com.sk89q.worldedit.bukkit;
import com.fastasyncworldedit.core.configuration.Caption;
import com.fastasyncworldedit.core.configuration.Settings;
import com.fastasyncworldedit.core.util.task.RunnableVal;
import com.fastasyncworldedit.core.util.TaskManager;
import com.fastasyncworldedit.core.util.task.RunnableVal;
import com.sk89q.util.StringUtil;
import com.sk89q.wepif.VaultResolver;
import com.sk89q.worldedit.WorldEdit;
@ -63,14 +63,14 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.permissions.PermissionAttachment;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class BukkitPlayer extends AbstractPlayerActor {
@ -236,7 +236,14 @@ public class BukkitPlayer extends AbstractPlayerActor {
}
org.bukkit.World finalWorld = world;
//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
@ -263,7 +270,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
public boolean hasPermission(String perm) {
return (!plugin.getLocalConfiguration().noOpPermissions && player.isOp())
|| plugin.getPermissionsResolver().hasPermission(
player.getWorld().getName(), player, perm);
player.getWorld().getName(), player, perm);
}
//FAWE start
@ -333,7 +340,8 @@ public class BukkitPlayer extends AbstractPlayerActor {
getWorld(),
position,
nativeLocation.getYaw(),
nativeLocation.getPitch());
nativeLocation.getPitch()
);
}
@Override
@ -350,9 +358,11 @@ public class BukkitPlayer extends AbstractPlayerActor {
public void sendAnnouncements() {
if (WorldEditPlugin.getInstance().getLifecycledBukkitImplAdapter() == null) {
//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)
.clickEvent(ClickEvent.openUrl("https://intellectualsites.github.io/download/fawe.html"))));
.clickEvent(ClickEvent.openUrl("https://intellectualsites.github.io/download/fawe.html"))
));
//FAWE end
}
}

Datei anzeigen

@ -19,13 +19,13 @@
package com.sk89q.worldedit.bukkit;
import com.fastasyncworldedit.core.extent.inventory.SlottableBlockBag;
import com.sk89q.worldedit.blocks.BaseItem;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.extent.inventory.BlockBagException;
import com.sk89q.worldedit.extent.inventory.OutOfBlocksException;
import com.sk89q.worldedit.extent.inventory.OutOfSpaceException;
import com.fastasyncworldedit.core.extent.inventory.SlottableBlockBag;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.block.BlockState;
import org.bukkit.entity.Player;
@ -35,7 +35,7 @@ import org.bukkit.inventory.ItemStack;
public class BukkitPlayerBlockBag extends BlockBag implements SlottableBlockBag {
//FAWE end
private Player player;
private final Player player;
private ItemStack[] items;
/**
@ -194,7 +194,11 @@ public class BukkitPlayerBlockBag extends BlockBag implements SlottableBlockBag
@Override
public void setItem(int slot, BaseItem block) {
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);
}
//FAWE end

Datei anzeigen

@ -23,7 +23,6 @@ import com.sk89q.worldedit.world.registry.BiomeRegistry;
import com.sk89q.worldedit.world.registry.BlockCategoryRegistry;
import com.sk89q.worldedit.world.registry.BlockRegistry;
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.ItemRegistry;

Datei anzeigen

@ -45,8 +45,9 @@ import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.enginehub.piston.CommandManager;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumMap;
@ -55,7 +56,6 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import static com.sk89q.worldedit.util.formatting.WorldEditText.reduceToText;
@ -116,8 +116,7 @@ public class BukkitServerInterface extends AbstractPlatform implements MultiUser
if (!type.startsWith("minecraft:")) {
return false;
}
@SuppressWarnings("deprecation")
final EntityType entityType = EntityType.fromName(type.substring(10));
@SuppressWarnings("deprecation") final EntityType entityType = EntityType.fromName(type.substring(10));
return entityType != null && entityType.isAlive();
}
@ -175,22 +174,29 @@ public class BukkitServerInterface extends AbstractPlatform implements MultiUser
BukkitCommandInspector inspector = new BukkitCommandInspector(plugin, dispatcher);
dynamicCommands.register(dispatcher.getAllCommands()
.map(command -> {
String[] permissionsArray = command.getCondition()
.as(PermissionCondition.class)
.map(PermissionCondition::getPermissions)
.map(s -> s.toArray(new String[0]))
.orElseGet(() -> new String[0]);
.map(command -> {
String[] permissionsArray = command.getCondition()
.as(PermissionCondition.class)
.map(PermissionCondition::getPermissions)
.map(s -> s.toArray(new String[0]))
.orElseGet(() -> new String[0]);
String[] aliases = Stream.concat(
Stream.of(command.getName()),
command.getAliases().stream()
).toArray(String[]::new);
// TODO Handle localisation correctly
return new CommandInfo(reduceToText(command.getUsage(), WorldEdit.getInstance().getConfiguration().defaultLocale),
reduceToText(command.getDescription(), WorldEdit.getInstance().getConfiguration().defaultLocale), aliases,
inspector, permissionsArray);
}).collect(Collectors.toList()));
String[] aliases = Stream.concat(
Stream.of(command.getName()),
command.getAliases().stream()
).toArray(String[]::new);
// TODO Handle localisation correctly
return new CommandInfo(
reduceToText(
command.getUsage(),
WorldEdit.getInstance().getConfiguration().defaultLocale
),
reduceToText(command.getDescription(), WorldEdit.getInstance().getConfiguration().defaultLocale),
aliases,
inspector,
permissionsArray
);
}).collect(Collectors.toList()));
}
@Override
@ -264,7 +270,8 @@ public class BukkitServerInterface extends AbstractPlatform implements MultiUser
//FAWE start
@Override
public @Nonnull RelighterFactory getRelighterFactory() {
public @Nonnull
RelighterFactory getRelighterFactory() {
if (this.relighterFactory == null) {
this.relighterFactory = this.plugin.getBukkitImplAdapter().getRelighterFactory();
LOGGER.info("Using " + this.relighterFactory.getClass().getCanonicalName() + " as relighter factory.");

Datei anzeigen

@ -177,6 +177,7 @@ public class BukkitWorld extends AbstractWorld {
}
//FAWE start
/**
* 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
}
return type != null && world.generateTree(BukkitAdapter.adapt(world, pt), bukkitType,
new EditSessionBlockChangeDelegate(editSession));
new EditSessionBlockChangeDelegate(editSession)
);
}
@Override
@ -505,7 +507,7 @@ public class BukkitWorld extends AbstractWorld {
} catch (Exception e) {
if (block instanceof BaseBlock && ((BaseBlock) block).getNbt() != null) {
LOGGER.warn("Tried to set a corrupt tile entity at " + position.toString()
+ ": " + ((BaseBlock) block).getNbt(), e);
+ ": " + ((BaseBlock) block).getNbt(), e);
} else {
LOGGER.warn("Failed to set block via adapter, falling back to generic", e);
}
@ -527,8 +529,10 @@ public class BukkitWorld extends AbstractWorld {
}
@Override
public Set<SideEffect> applySideEffects(BlockVector3 position, com.sk89q.worldedit.world.block.BlockState previousType,
SideEffectSet sideEffectSet) {
public Set<SideEffect> applySideEffects(
BlockVector3 position, com.sk89q.worldedit.world.block.BlockState previousType,
SideEffectSet sideEffectSet
) {
if (worldNativeAccess != null) {
worldNativeAccess.applySideEffects(position, previousType, sideEffectSet);
return Sets.intersection(

Datei anzeigen

@ -23,7 +23,6 @@ import com.sk89q.worldedit.LocalSession;
import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
/**

Datei anzeigen

@ -29,7 +29,7 @@ import org.bukkit.block.data.BlockData;
*/
public class EditSessionBlockChangeDelegate implements BlockChangeDelegate {
private EditSession editSession;
private final EditSession editSession;
public EditSessionBlockChangeDelegate(EditSession editSession) {
this.editSession = editSession;

Datei anzeigen

@ -76,13 +76,17 @@ public class WorldEditListener implements Listener {
public void onPlayerCommandSend(PlayerCommandSendEvent event) {
InjectedValueStore store = MapBackedValueStore.create();
store.injectValue(Key.of(Actor.class), context ->
Optional.of(plugin.wrapCommandSender(event.getPlayer())));
CommandManager commandManager = plugin.getWorldEdit().getPlatformManager().getPlatformCommandManager().getCommandManager();
Optional.of(plugin.wrapCommandSender(event.getPlayer())));
CommandManager commandManager = plugin
.getWorldEdit()
.getPlatformManager()
.getPlatformCommandManager()
.getCommandManager();
event.getCommands().removeIf(name ->
// remove if in the manager and not satisfied
commandManager.getCommand(name)
.filter(command -> !command.getCondition().satisfied(store))
.isPresent()
// remove if in the manager and not satisfied
commandManager.getCommand(name)
.filter(command -> !command.getCondition().satisfied(store))
.isPresent()
);
}
@ -151,4 +155,5 @@ public class WorldEditListener implements Listener {
public void onPlayerQuit(PlayerQuitEvent event) {
plugin.getWorldEdit().getEventBus().post(new SessionIdleEvent(new BukkitPlayer.SessionKeyImpl(event.getPlayer())));
}
}

Datei anzeigen

@ -117,9 +117,10 @@ public class WorldEditPlugin extends JavaPlugin {
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
for (Plugin p : plugins) {
if (p.getName().equals("WorldEdit")) {
LOGGER.warn("You installed WorldEdit alongside FastAsyncWorldEdit. That is unneeded and will cause unforeseen issues, " +
"because FastAsyncWorldEdit already provides WorldEdit. " +
"Stop your server and delete the 'worldedit-bukkit' jar from your plugins folder.");
LOGGER.warn(
"You installed WorldEdit alongside FastAsyncWorldEdit. That is unneeded and will cause unforeseen issues, " +
"because FastAsyncWorldEdit already provides WorldEdit. " +
"Stop your server and delete the 'worldedit-bukkit' jar from your plugins folder.");
}
}
//FAWE end
@ -142,7 +143,7 @@ public class WorldEditPlugin extends JavaPlugin {
//FAWE start - Modify WorldEdit config name
config = new BukkitConfiguration(new YAMLProcessor(new File(getDataFolder(), "config-legacy.yml"), true), this);
//FAWE end
//FAWE start - Setup permission attachments
permissionAttachmentManager = new BukkitPermissionAttachmentManager(this);
//FAWE end
@ -202,7 +203,8 @@ public class WorldEditPlugin extends JavaPlugin {
getServer().getPluginManager().registerEvents(new WorldInitListener(), this);
} else {
//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/");
//FAWE end
try {
@ -235,7 +237,7 @@ public class WorldEditPlugin extends JavaPlugin {
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent(platform));
}
@SuppressWarnings({ "deprecation", "unchecked" })
@SuppressWarnings({"deprecation", "unchecked"})
private void initializeRegistries() {
// Biome
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()));
}
} 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 {
//FAWE start - Identify as FAWE
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() + ") "
+ "that handles the world editing.");
+ "but it seems that you have another implementation of FastAsyncWorldEdit installed (" + platform.getPlatformName() + ") "
+ "that handles the world editing.");
//FAWE end
}
this.adapter.invalidate();
@ -443,7 +446,7 @@ public class WorldEditPlugin extends JavaPlugin {
/**
* Remember an edit session.
*
* @param player a player
* @param player a player
* @param editSession an edit session
*/
public void remember(Player player, EditSession editSession) {
@ -473,8 +476,9 @@ public class WorldEditPlugin extends JavaPlugin {
public PermissionsResolverManager getPermissionsResolver() {
return PermissionsResolverManager.getInstance();
}
//FAWE start
/**
* Get the permissions attachment manager in use
*
@ -565,6 +569,7 @@ public class WorldEditPlugin extends JavaPlugin {
}
private class WorldInitListener implements Listener {
private boolean loaded = false;
@EventHandler(priority = EventPriority.LOWEST)
@ -575,9 +580,11 @@ public class WorldEditPlugin extends JavaPlugin {
loaded = true;
setupWorldData();
}
}
private class AsyncTabCompleteListener implements Listener {
AsyncTabCompleteListener() {
}
@ -597,7 +604,8 @@ public class WorldEditPlugin extends JavaPlugin {
// Strip leading slash, if present.
label = label.startsWith("/") ? label.substring(1) : label;
final Optional<org.enginehub.piston.Command> command
= WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().getCommand(label);
= WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().getCommand(
label);
if (!command.isPresent()) {
return;
}
@ -608,5 +616,7 @@ public class WorldEditPlugin extends JavaPlugin {
event.setCompletions(CommandUtil.fixSuggestions(buffer, suggestEvent.getSuggestions()));
event.setHandled(true);
}
}
}

Datei anzeigen

@ -38,4 +38,5 @@ public class AdapterLoadException extends Exception {
public AdapterLoadException(Throwable cause) {
super(cause);
}
}

Datei anzeigen

@ -23,8 +23,8 @@ import com.fastasyncworldedit.bukkit.FaweBukkit;
import com.fastasyncworldedit.bukkit.adapter.IBukkitAdapter;
import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory;
import com.fastasyncworldedit.core.Fawe;
import com.fastasyncworldedit.core.queue.IChunkGet;
import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory;
import com.fastasyncworldedit.core.queue.IChunkGet;
import com.fastasyncworldedit.core.queue.implementation.packet.ChunkPacket;
import com.sk89q.jnbt.AdventureNBTConverter;
import com.sk89q.jnbt.Tag;
@ -59,10 +59,10 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import javax.annotation.Nullable;
import java.util.Map;
import java.util.OptionalInt;
import java.util.Set;
import javax.annotation.Nullable;
/**
* An interface for adapters of various Bukkit implementations.
@ -123,7 +123,7 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
* Create the given entity.
*
* @param location the location
* @param state the state
* @param state the state
* @return the created entity or null
*/
@Nullable
@ -164,8 +164,8 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
/**
* Send the given NBT data to the player.
*
* @param player The player
* @param pos The position
* @param player The player
* @param pos The position
* @param nbtData The NBT Data
*/
void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData);
@ -181,10 +181,10 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
/**
* Simulates a player using an item.
*
* @param world the world
* @param world the world
* @param position the location
* @param item the item to be used
* @param face the direction in which to "face" when using the item
* @param item the item to be used
* @param face the direction in which to "face" when using the item
* @return whether the usage was successful
*/
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.
*
* @param world The world
* @param position The position
* @param world The world
* @param position The position
* @param blockState The blockstate
* @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".
* @param world the world to regen in
* @param region the region to regen
* @param extent the extent to use for setting blocks
*
* @param world the world to regen in
* @param region the region to regen
* @param extent the extent to use for setting blocks
* @param options the regeneration options
* @return true on success, false on failure
*/

Datei anzeigen

@ -47,15 +47,15 @@ public class BukkitImplLoader {
private static final String CLASS_SUFFIX = ".class";
private static final String LOAD_ERROR_MESSAGE =
//FAWE start - exchange WorldEdit to FAWE & suggest to update Fawe & the server software
"\n**********************************************\n"
+ "** This FastAsyncWorldEdit version does not fully support your version of Bukkit.\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"
+ "**\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"
+ "** and block property-related functions.\n"
+ "**********************************************\n";
//FAWE start - exchange WorldEdit to FAWE & suggest to update Fawe & the server software
"\n**********************************************\n"
+ "** This FastAsyncWorldEdit version does not fully support your version of Bukkit.\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"
+ "**\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"
+ "** and block property-related functions.\n"
+ "**********************************************\n";
//FAWE end
/**
@ -164,10 +164,10 @@ public class BukkitImplLoader {
}
} catch (ClassNotFoundException e) {
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) {
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) {
if (className.equals(customCandidate)) {
LOGGER.warn("Failed to load the Bukkit adapter class '" + className + "'", e);

Datei anzeigen

@ -16,81 +16,81 @@
# - If you want to allow blocks, make sure to change "disallowed-blocks" to []
#
limits:
max-blocks-changed:
# Ignored, use FAWE config limits
default: -1
maximum: -1
max-polygonal-points:
default: -1
maximum: 20
max-radius: -1
max-super-pickaxe-size: 5
max-brush-radius: 100
butcher-radius:
default: -1
maximum: -1
disallowed-blocks:
limits :
max-blocks-changed :
# Ignored, use FAWE config limits
default : -1
maximum : -1
max-polygonal-points :
default : -1
maximum : 20
max-radius : -1
max-super-pickaxe-size : 5
max-brush-radius : 100
butcher-radius :
default : -1
maximum : -1
disallowed-blocks :
- "minecraft:wheat"
- "minecraft:fire"
- "minecraft:redstone_wire"
use-inventory:
enable: false
allow-override: true
creative-mode-overrides: false
use-inventory :
enable : false
allow-override : true
creative-mode-overrides : false
logging:
log-commands: false
file: worldedit.log
# 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.
# 2$ : source - a string representing the caller, if available; otherwise, the logger's name.
# 3$ : logger - the logger's name.
# 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.
# 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:
# 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-
format: "[%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s]: %5$s%6$s%n"
logging :
log-commands : false
file : worldedit.log
# 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.
# 2$ : source - a string representing the caller, if available; otherwise, the logger's name.
# 3$ : logger - the logger's name.
# 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.
# 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:
# 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-
format : "[%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s]: %5$s%6$s%n"
super-pickaxe:
drop-items: true
many-drop-items: false
super-pickaxe :
drop-items : true
many-drop-items : false
snapshots:
directory:
snapshots :
directory :
navigation-wand:
item: minecraft:compass
max-distance: 100
navigation-wand :
item : minecraft:compass
max-distance : 100
scripting:
timeout: 3000
dir: craftscripts
scripting :
timeout : 3000
dir : craftscripts
saving:
dir: schematics
saving :
dir : schematics
files:
allow-symbolic-links: false
files :
allow-symbolic-links : false
history:
size: 15
expiration: 10
history :
size : 15
expiration : 10
calculation:
timeout: 100
calculation :
timeout : 100
debugging:
trace-unflushed-sessions: false
debugging :
trace-unflushed-sessions : false
wand-item: minecraft:wooden_axe
shell-save-type:
no-double-slash: false
no-op-permissions: false
debug: false
show-help-on-first-use: true
server-side-cui: true
command-block-support: false
wand-item : minecraft:wooden_axe
shell-save-type :
no-double-slash : false
no-op-permissions : false
debug : false
show-help-on-first-use : true
server-side-cui : true
command-block-support : false

Datei anzeigen

@ -1,233 +1,233 @@
name: FastAsyncWorldEdit
main: com.sk89q.worldedit.bukkit.WorldEditPlugin
version: "${internalVersion}"
load: STARTUP
api-version: 1.15
softdepend: [Vault]
provides: [WorldEdit]
website: https://www.spigotmc.org/resources/13932/
description: Blazingly fast world manipulation for builders, large networks and developers.
authors: [Empire92, MattBDev, IronApollo, dordsor21, NotMyFault]
loadbefore: [WorldGuard, PlotSquared]
database: false
permissions:
fawe.plotsquared:
default: true
children:
fawe.plotsquared.trusted: true
fawe.bypass.regions:
default: false
fawe.bypass:
default: false
children:
fawe.bypass.regions: true
fawe.limit.*: true
fawe.tips:
default: false
fawe.admin:
default: op
fawe.reload:
default: false
fawe.permpack.basic:
default: op
children:
fawe.worldeditregion: true
fawe.cancel: true
worldedit.biome.info: true
worldedit.biome.set: true
worldedit.biome.list: true
worldedit.chunkinfo: true
worldedit.listchunks: true
worldedit.clipboard.cut: true
worldedit.clipboard.paste: true
worldedit.schematic.formats: true
worldedit.schematic.load: true
worldedit.schematic.list: true
worldedit.schematic.save: true
worldedit.clipboard.clear: true
worldedit.clipboard.copy: true
worldedit.clipboard.lazycopy: true
worldedit.clipboard.place: true
worldedit.clipboard.download: true
worldedit.clipboard.flip: true
worldedit.clipboard.rotate: true
worldedit.help: true
worldedit.global-mask: true
worldedit.global-transform: true
worldedit.generation.cylinder: true
worldedit.generation.sphere: true
worldedit.generation.forest: true
worldedit.generation.pumpkins: true
worldedit.generation.pyramid: true
worldedit.generation.shape: true
worldedit.history.undo: true
worldedit.history.redo: true
worldedit.history.rollback: true
worldedit.navigation.unstuck: true
worldedit.navigation.ascend: true
worldedit.navigation.descend: true
worldedit.navigation.ceiling: true
worldedit.navigation.thru.command: true
worldedit.navigation.jumpto.command: true
worldedit.navigation.up: true
worldedit.region.hollow: true
worldedit.region.line: true
worldedit.region.curve: true
worldedit.region.overlay: true
worldedit.region.center: true
worldedit.region.naturalize: true
worldedit.region.walls: true
worldedit.region.faces: true
worldedit.region.smooth: true
worldedit.region.move: true
worldedit.region.forest: true
worldedit.region.replace: true
worldedit.region.stack: true
worldedit.region.set: true
worldedit.selection.pos: true
worldedit.selection.chunk: true
worldedit.selection.hpos: true
worldedit.wand: true
worldedit.wand.toggle: true
worldedit.selection.contract: true
worldedit.selection.outset: true
worldedit.selection.inset: true
worldedit.analysis.distr: true
worldedit.analysis.count: true
worldedit.analysis.sel: true
worldedit.selection.size: true
worldedit.selection.expand: true
worldedit.selection.shift: true
worldedit.snapshots.list: true
worldedit.superpickaxe: true
worldedit.superpickaxe.area: true
worldedit.superpickaxe.recursive: true
worldedit.brush.blendball: true
worldedit.brush.erode: true
worldedit.brush.pull: true
worldedit.brush.circle: true
worldedit.brush.recursive: true
worldedit.brush.line: true
worldedit.brush.spline: true
worldedit.brush.surfacespline: true
worldedit.brush.shatter: true
worldedit.brush.stencil: true
worldedit.brush.height: true
worldedit.brush.layer: true
worldedit.brush.populateschematic: true
worldedit.brush.scatter: true
worldedit.brush.splatter: true
worldedit.brush.scattercommand: true
worldedit.brush.copy: true
worldedit.brush.command: true
worldedit.brush.apply: true
worldedit.brush.sphere: true
worldedit.brush.cylinder: true
worldedit.brush.clipboard: true
worldedit.brush.smooth: true
worldedit.brush.ex: true
worldedit.brush.gravity: true
worldedit.brush.options.range: true
worldedit.brush.options.material: true
worldedit.brush.options.size: true
worldedit.brush.options.mask: true
worldedit.brush.options.smask: true
worldedit.brush.options.transform: true
worldedit.brush.options.scroll: true
worldedit.brush.options.visualize: true
worldedit.tool.deltree: true
worldedit.tool.farwand: true
worldedit.tool.lrbuild: true
worldedit.tool.info: true
worldedit.tool.tree: true
worldedit.tool.replacer: true
worldedit.tool.data-cycler: true
worldedit.tool.flood-fill: true
worldedit.tool.inspect: true
worldedit.fill.recursive: true
worldedit.drain: true
worldedit.fixlava: true
worldedit.fixwater: true
worldedit.removeabove: true
worldedit.removebelow: true
worldedit.removenear: true
worldedit.replacenear: true
worldedit.snow: true
worldedit.thaw: true
worldedit.green: true
worldedit.extinguish: true
worldedit.calc: true
worldedit.fill: true
fawe.voxelbrush:
default: op
children:
voxelsniper.brush.ball: true
voxelsniper.brush.biome: true
voxelsniper.brush.blendball: true
voxelsniper.brush.blenddisc: true
voxelsniper.brush.blendvoxel: true
voxelsniper.brush.blendvoxeldisc: true
voxelsniper.brush.blob: true
voxelsniper.brush.blockreset: true
voxelsniper.brush.blockresetsurface: true
voxelsniper.brush.canyon: true
voxelsniper.brush.canyonselection: true
voxelsniper.brush.checkervoxeldisc: true
voxelsniper.brush.cleansnow: true
voxelsniper.brush.clonestamp: true
voxelsniper.brush.copypasta: true
voxelsniper.brush.cylinder: true
voxelsniper.brush.disc: true
voxelsniper.brush.discface: true
voxelsniper.brush.dome: true
voxelsniper.brush.drain: true
voxelsniper.brush.ellipse: true
voxelsniper.brush.ellipsoid: true
voxelsniper.brush.eraser: true
voxelsniper.brush.erode: true
voxelsniper.brush.extrude: true
voxelsniper.brush.filldown: true
voxelsniper.brush.flatocean: true
voxelsniper.brush.heatray: true
voxelsniper.brush.jaggedline: true
voxelsniper.brush.line: true
voxelsniper.brush.move: true
voxelsniper.brush.ocean: true
voxelsniper.brush.overlay: true
voxelsniper.brush.pull: true
voxelsniper.brush.randomerode: true
voxelsniper.brush.ring: true
voxelsniper.brush.rot2d: true
voxelsniper.brush.rot2dvert: true
voxelsniper.brush.rot3d: true
voxelsniper.brush.ruler: true
voxelsniper.brush.scanner: true
voxelsniper.brush.set: true
voxelsniper.brush.setredstoneflip: true
voxelsniper.brush.setredstonerotate: true
voxelsniper.brush.shellball: true
voxelsniper.brush.shellset: true
voxelsniper.brush.shellvoxel: true
voxelsniper.brush.signoverwrite: true
voxelsniper.brush.snipe: true
voxelsniper.brush.snowcone: true
voxelsniper.brush.spiralstaircase: true
voxelsniper.brush.splatterball: true
voxelsniper.brush.splatterdisc: true
voxelsniper.brush.splatteroverlay: true
voxelsniper.brush.splattervoxel: true
voxelsniper.brush.splattervoxeldisc: true
voxelsniper.brush.spline: true
voxelsniper.brush.stamp: true
voxelsniper.brush.stencil: true
voxelsniper.brush.stencillist: true
voxelsniper.brush.threepointcircle: true
voxelsniper.brush.triangle: true
voxelsniper.brush.underlay: true
voxelsniper.brush.voltmeter: true
voxelsniper.brush.voxel: true
voxelsniper.brush.voxeldisc: true
voxelsniper.brush.voxeldiscface: true
voxelsniper.brush.warp: true
voxelsniper.goto: true
voxelsniper.sniper: true
name : FastAsyncWorldEdit
main : com.sk89q.worldedit.bukkit.WorldEditPlugin
version : "${internalVersion}"
load : STARTUP
api-version : 1.15
softdepend : [ Vault ]
provides : [ WorldEdit ]
website : https://www.spigotmc.org/resources/13932/
description : Blazingly fast world manipulation for builders, large networks and developers.
authors : [ Empire92, MattBDev, IronApollo, dordsor21, NotMyFault ]
loadbefore : [ WorldGuard, PlotSquared ]
database : false
permissions :
fawe.plotsquared :
default : true
children :
fawe.plotsquared.trusted : true
fawe.bypass.regions :
default : false
fawe.bypass :
default : false
children :
fawe.bypass.regions : true
fawe.limit.* : true
fawe.tips :
default : false
fawe.admin :
default : op
fawe.reload :
default : false
fawe.permpack.basic :
default : op
children :
fawe.worldeditregion : true
fawe.cancel : true
worldedit.biome.info : true
worldedit.biome.set : true
worldedit.biome.list : true
worldedit.chunkinfo : true
worldedit.listchunks : true
worldedit.clipboard.cut : true
worldedit.clipboard.paste : true
worldedit.schematic.formats : true
worldedit.schematic.load : true
worldedit.schematic.list : true
worldedit.schematic.save : true
worldedit.clipboard.clear : true
worldedit.clipboard.copy : true
worldedit.clipboard.lazycopy : true
worldedit.clipboard.place : true
worldedit.clipboard.download : true
worldedit.clipboard.flip : true
worldedit.clipboard.rotate : true
worldedit.help : true
worldedit.global-mask : true
worldedit.global-transform : true
worldedit.generation.cylinder : true
worldedit.generation.sphere : true
worldedit.generation.forest : true
worldedit.generation.pumpkins : true
worldedit.generation.pyramid : true
worldedit.generation.shape : true
worldedit.history.undo : true
worldedit.history.redo : true
worldedit.history.rollback : true
worldedit.navigation.unstuck : true
worldedit.navigation.ascend : true
worldedit.navigation.descend : true
worldedit.navigation.ceiling : true
worldedit.navigation.thru.command : true
worldedit.navigation.jumpto.command : true
worldedit.navigation.up : true
worldedit.region.hollow : true
worldedit.region.line : true
worldedit.region.curve : true
worldedit.region.overlay : true
worldedit.region.center : true
worldedit.region.naturalize : true
worldedit.region.walls : true
worldedit.region.faces : true
worldedit.region.smooth : true
worldedit.region.move : true
worldedit.region.forest : true
worldedit.region.replace : true
worldedit.region.stack : true
worldedit.region.set : true
worldedit.selection.pos : true
worldedit.selection.chunk : true
worldedit.selection.hpos : true
worldedit.wand : true
worldedit.wand.toggle : true
worldedit.selection.contract : true
worldedit.selection.outset : true
worldedit.selection.inset : true
worldedit.analysis.distr : true
worldedit.analysis.count : true
worldedit.analysis.sel : true
worldedit.selection.size : true
worldedit.selection.expand : true
worldedit.selection.shift : true
worldedit.snapshots.list : true
worldedit.superpickaxe : true
worldedit.superpickaxe.area : true
worldedit.superpickaxe.recursive : true
worldedit.brush.blendball : true
worldedit.brush.erode : true
worldedit.brush.pull : true
worldedit.brush.circle : true
worldedit.brush.recursive : true
worldedit.brush.line : true
worldedit.brush.spline : true
worldedit.brush.surfacespline : true
worldedit.brush.shatter : true
worldedit.brush.stencil : true
worldedit.brush.height : true
worldedit.brush.layer : true
worldedit.brush.populateschematic : true
worldedit.brush.scatter : true
worldedit.brush.splatter : true
worldedit.brush.scattercommand : true
worldedit.brush.copy : true
worldedit.brush.command : true
worldedit.brush.apply : true
worldedit.brush.sphere : true
worldedit.brush.cylinder : true
worldedit.brush.clipboard : true
worldedit.brush.smooth : true
worldedit.brush.ex : true
worldedit.brush.gravity : true
worldedit.brush.options.range : true
worldedit.brush.options.material : true
worldedit.brush.options.size : true
worldedit.brush.options.mask : true
worldedit.brush.options.smask : true
worldedit.brush.options.transform : true
worldedit.brush.options.scroll : true
worldedit.brush.options.visualize : true
worldedit.tool.deltree : true
worldedit.tool.farwand : true
worldedit.tool.lrbuild : true
worldedit.tool.info : true
worldedit.tool.tree : true
worldedit.tool.replacer : true
worldedit.tool.data-cycler : true
worldedit.tool.flood-fill : true
worldedit.tool.inspect : true
worldedit.fill.recursive : true
worldedit.drain : true
worldedit.fixlava : true
worldedit.fixwater : true
worldedit.removeabove : true
worldedit.removebelow : true
worldedit.removenear : true
worldedit.replacenear : true
worldedit.snow : true
worldedit.thaw : true
worldedit.green : true
worldedit.extinguish : true
worldedit.calc : true
worldedit.fill : true
fawe.voxelbrush :
default : op
children :
voxelsniper.brush.ball : true
voxelsniper.brush.biome : true
voxelsniper.brush.blendball : true
voxelsniper.brush.blenddisc : true
voxelsniper.brush.blendvoxel : true
voxelsniper.brush.blendvoxeldisc : true
voxelsniper.brush.blob : true
voxelsniper.brush.blockreset : true
voxelsniper.brush.blockresetsurface : true
voxelsniper.brush.canyon : true
voxelsniper.brush.canyonselection : true
voxelsniper.brush.checkervoxeldisc : true
voxelsniper.brush.cleansnow : true
voxelsniper.brush.clonestamp : true
voxelsniper.brush.copypasta : true
voxelsniper.brush.cylinder : true
voxelsniper.brush.disc : true
voxelsniper.brush.discface : true
voxelsniper.brush.dome : true
voxelsniper.brush.drain : true
voxelsniper.brush.ellipse : true
voxelsniper.brush.ellipsoid : true
voxelsniper.brush.eraser : true
voxelsniper.brush.erode : true
voxelsniper.brush.extrude : true
voxelsniper.brush.filldown : true
voxelsniper.brush.flatocean : true
voxelsniper.brush.heatray : true
voxelsniper.brush.jaggedline : true
voxelsniper.brush.line : true
voxelsniper.brush.move : true
voxelsniper.brush.ocean : true
voxelsniper.brush.overlay : true
voxelsniper.brush.pull : true
voxelsniper.brush.randomerode : true
voxelsniper.brush.ring : true
voxelsniper.brush.rot2d : true
voxelsniper.brush.rot2dvert : true
voxelsniper.brush.rot3d : true
voxelsniper.brush.ruler : true
voxelsniper.brush.scanner : true
voxelsniper.brush.set : true
voxelsniper.brush.setredstoneflip : true
voxelsniper.brush.setredstonerotate : true
voxelsniper.brush.shellball : true
voxelsniper.brush.shellset : true
voxelsniper.brush.shellvoxel : true
voxelsniper.brush.signoverwrite : true
voxelsniper.brush.snipe : true
voxelsniper.brush.snowcone : true
voxelsniper.brush.spiralstaircase : true
voxelsniper.brush.splatterball : true
voxelsniper.brush.splatterdisc : true
voxelsniper.brush.splatteroverlay : true
voxelsniper.brush.splattervoxel : true
voxelsniper.brush.splattervoxeldisc : true
voxelsniper.brush.spline : true
voxelsniper.brush.stamp : true
voxelsniper.brush.stencil : true
voxelsniper.brush.stencillist : true
voxelsniper.brush.threepointcircle : true
voxelsniper.brush.triangle : true
voxelsniper.brush.underlay : true
voxelsniper.brush.voltmeter : true
voxelsniper.brush.voxel : true
voxelsniper.brush.voxeldisc : true
voxelsniper.brush.voxeldiscface : true
voxelsniper.brush.warp : true
voxelsniper.goto : true
voxelsniper.sniper : true

Datei anzeigen

@ -4,8 +4,8 @@ import com.fastasyncworldedit.bukkit.util.MinecraftVersion;
import org.junit.jupiter.api.Test;
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.assertTrue;
public class MinecraftVersionTest {

Datei anzeigen

@ -30,6 +30,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class DinnerPermsResolverTest {
private DinnerPermsResolver resolver;
@BeforeEach
@ -86,4 +87,5 @@ public class DinnerPermsResolverTest {
assertTrue(resolver.inGroup(permissible, "b"));
assertFalse(resolver.inGroup(permissible, "c"));
}
}

Datei anzeigen

@ -31,15 +31,16 @@ import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import javax.annotation.Nonnull;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import javax.annotation.Nonnull;
public class TestOfflinePermissible implements OfflinePlayer, Permissible {
private boolean op;
private UUID randomUuid = UUID.randomUUID();
@ -190,15 +191,15 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getLastLogin() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getLastLogin() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getLastSeen() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getLastSeen() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void incrementStatistic(@Nonnull Statistic statistic) throws IllegalArgumentException {
@ -212,19 +213,19 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
@Override
public void incrementStatistic(@Nonnull Statistic statistic, int amount)
throws IllegalArgumentException {
throws IllegalArgumentException {
}
@Override
public void decrementStatistic(@Nonnull Statistic statistic, int amount)
throws IllegalArgumentException {
throws IllegalArgumentException {
}
@Override
public void setStatistic(@Nonnull Statistic statistic, int newValue)
throws IllegalArgumentException {
throws IllegalArgumentException {
}
@ -235,73 +236,84 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
@Override
public void incrementStatistic(@Nonnull Statistic statistic, @Nonnull Material material)
throws IllegalArgumentException {
throws IllegalArgumentException {
}
@Override
public void decrementStatistic(@Nonnull Statistic statistic, @Nonnull Material material)
throws IllegalArgumentException {
throws IllegalArgumentException {
}
@Override
public int getStatistic(@Nonnull Statistic statistic, @Nonnull Material material)
throws IllegalArgumentException {
throws IllegalArgumentException {
return 0;
}
@Override
public void incrementStatistic(@Nonnull Statistic statistic, @Nonnull Material material,
int amount) throws IllegalArgumentException {
public void incrementStatistic(
@Nonnull Statistic statistic, @Nonnull Material material,
int amount
) throws IllegalArgumentException {
}
@Override
public void decrementStatistic(@Nonnull Statistic statistic, @Nonnull Material material,
int amount) throws IllegalArgumentException {
public void decrementStatistic(
@Nonnull Statistic statistic, @Nonnull Material material,
int amount
) throws IllegalArgumentException {
}
@Override
public void setStatistic(@Nonnull Statistic statistic, @Nonnull Material material, int newValue)
throws IllegalArgumentException {
throws IllegalArgumentException {
}
@Override
public void incrementStatistic(@Nonnull Statistic statistic, @Nonnull EntityType entityType)
throws IllegalArgumentException {
throws IllegalArgumentException {
}
@Override
public void decrementStatistic(@Nonnull Statistic statistic, @Nonnull EntityType entityType)
throws IllegalArgumentException {
throws IllegalArgumentException {
}
@Override
public int getStatistic(@Nonnull Statistic statistic, @Nonnull EntityType entityType)
throws IllegalArgumentException {
throws IllegalArgumentException {
return 0;
}
@Override
public void incrementStatistic(@Nonnull Statistic statistic, @Nonnull EntityType entityType,
int amount) throws IllegalArgumentException {
public void incrementStatistic(
@Nonnull Statistic statistic, @Nonnull EntityType entityType,
int amount
) throws IllegalArgumentException {
}
@Override
public void decrementStatistic(@Nonnull Statistic statistic, @Nonnull EntityType entityType,
int amount) {
public void decrementStatistic(
@Nonnull Statistic statistic, @Nonnull EntityType entityType,
int amount
) {
}
@Override
public void setStatistic(@Nonnull Statistic statistic, @Nonnull EntityType entityType,
int newValue) {
public void setStatistic(
@Nonnull Statistic statistic, @Nonnull EntityType entityType,
int newValue
) {
}
}

Datei anzeigen

@ -1,5 +1,4 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
plugins {
`java-library`

Datei anzeigen

@ -5,4 +5,5 @@ package com.sk89q.worldedit.cli;
* annoying, if you try to use the CLI as plugin.
*/
public class AccessPoint {
}

Datei anzeigen

@ -30,8 +30,11 @@ public class CLIBlockCategoryRegistry implements BlockCategoryRegistry {
@Override
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)
.collect(Collectors.toSet());
}
}

Datei anzeigen

@ -31,10 +31,10 @@ import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.registry.BundledBlockRegistry;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
public class CLIBlockRegistry extends BundledBlockRegistry {
@ -52,7 +52,11 @@ public class CLIBlockRegistry extends BundledBlockRegistry {
return new EnumProperty(key, values);
}
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);
}
default:
@ -69,4 +73,5 @@ public class CLIBlockRegistry extends BundledBlockRegistry {
(key, value) -> createProperty(value.type, key, value.values);
return ImmutableMap.copyOf(Maps.transformEntries(properties, entryTransform));
}
}

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen