geforkt von Mirrors/FastAsyncWorldEdit
Ursprung
38435d50b4
Commit
e0bb1ce853
@ -296,6 +296,11 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
wePlayer.unregister();
|
wePlayer.unregister();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPlatform() {
|
||||||
|
return "bukkit";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UUID getUUID(String name) {
|
public UUID getUUID(String name) {
|
||||||
return Bukkit.getOfflinePlayer(name).getUniqueId();
|
return Bukkit.getOfflinePlayer(name).getUniqueId();
|
||||||
|
@ -15,7 +15,6 @@ import com.boydti.fawe.util.WEManager;
|
|||||||
import com.github.luben.zstd.util.Native;
|
import com.github.luben.zstd.util.Native;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extension.platform.Capability;
|
|
||||||
import com.sk89q.worldedit.session.request.Request;
|
import com.sk89q.worldedit.session.request.Request;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -282,7 +281,7 @@ public class Fawe {
|
|||||||
MainUtil.copyFile(MainUtil.getJarFile(), "lang/strings.json", null);
|
MainUtil.copyFile(MainUtil.getJarFile(), "lang/strings.json", null);
|
||||||
// Setting up config.yml
|
// Setting up config.yml
|
||||||
File file = new File(this.IMP.getDirectory(), "config.yml");
|
File file = new File(this.IMP.getDirectory(), "config.yml");
|
||||||
Settings.IMP.PLATFORM = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getPlatformName();
|
Settings.IMP.PLATFORM = IMP.getPlatform().replace("\"", "");
|
||||||
try (InputStream stream = getClass().getResourceAsStream("/fawe.properties");
|
try (InputStream stream = getClass().getResourceAsStream("/fawe.properties");
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(stream))) {
|
BufferedReader br = new BufferedReader(new InputStreamReader(stream))) {
|
||||||
String versionString = br.readLine();
|
String versionString = br.readLine();
|
||||||
|
@ -31,6 +31,8 @@ public interface IFawe {
|
|||||||
|
|
||||||
public default void registerPacketListener() {}
|
public default void registerPacketListener() {}
|
||||||
|
|
||||||
|
String getPlatform();
|
||||||
|
|
||||||
UUID getUUID(String name);
|
UUID getUUID(String name);
|
||||||
|
|
||||||
String getName(UUID uuid);
|
String getName(UUID uuid);
|
||||||
|
@ -38,15 +38,14 @@ import java.util.function.Supplier;
|
|||||||
@SuppressWarnings("UnstableApiUsage")
|
@SuppressWarnings("UnstableApiUsage")
|
||||||
public abstract class QueueHandler implements Trimable, Runnable {
|
public abstract class QueueHandler implements Trimable, Runnable {
|
||||||
|
|
||||||
private final ForkJoinPool forkJoinPoolPrimary = new ForkJoinPool();
|
private ForkJoinPool forkJoinPoolPrimary = new ForkJoinPool();
|
||||||
private final ForkJoinPool forkJoinPoolSecondary = new ForkJoinPool();
|
private ForkJoinPool forkJoinPoolSecondary = new ForkJoinPool();
|
||||||
private final ThreadPoolExecutor blockingExecutor = FaweCache.IMP.newBlockingExecutor();
|
private ThreadPoolExecutor blockingExecutor = FaweCache.IMP.newBlockingExecutor();
|
||||||
private final ConcurrentLinkedQueue<FutureTask> syncTasks = new ConcurrentLinkedQueue<>();
|
private ConcurrentLinkedQueue<FutureTask> syncTasks = new ConcurrentLinkedQueue<>();
|
||||||
private final ConcurrentLinkedQueue<FutureTask> syncWhenFree = new ConcurrentLinkedQueue<>();
|
private ConcurrentLinkedQueue<FutureTask> syncWhenFree = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
private final Map<World, WeakReference<IChunkCache<IChunkGet>>> chunkGetCache = new HashMap<>();
|
private Map<World, WeakReference<IChunkCache<IChunkGet>>> chunkGetCache = new HashMap<>();
|
||||||
private final CleanableThreadLocal<IQueueExtent<IQueueChunk>> queuePool = new CleanableThreadLocal<>(
|
private CleanableThreadLocal<IQueueExtent<IQueueChunk>> queuePool = new CleanableThreadLocal<>(QueueHandler.this::create);
|
||||||
QueueHandler.this::create);
|
|
||||||
/**
|
/**
|
||||||
* Used to calculate elapsed time in milliseconds and ensure block placement doesn't lag the
|
* Used to calculate elapsed time in milliseconds and ensure block placement doesn't lag the
|
||||||
* server
|
* server
|
||||||
|
@ -53,7 +53,7 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
|||||||
private @Language("SQLite") String DELETE_EDITS_USER = "DELETE FROM `{0}edits` WHERE `player`=? AND `time`>? AND `x2`>=? AND `x1`<=? AND `y2`>=? AND `y1`<=? AND `z2`>=? AND `z1`<=?";
|
private @Language("SQLite") String DELETE_EDITS_USER = "DELETE FROM `{0}edits` WHERE `player`=? AND `time`>? AND `x2`>=? AND `x1`<=? AND `y2`>=? AND `y1`<=? AND `z2`>=? AND `z1`<=?";
|
||||||
private @Language("SQLite") String DELETE_EDIT_USER = "DELETE FROM `{0}edits` WHERE `player`=? AND `id`=?";
|
private @Language("SQLite") String DELETE_EDIT_USER = "DELETE FROM `{0}edits` WHERE `player`=? AND `id`=?";
|
||||||
|
|
||||||
private final ConcurrentLinkedQueue<RollbackOptimizedHistory> historyChanges = new ConcurrentLinkedQueue<>();
|
private ConcurrentLinkedQueue<RollbackOptimizedHistory> historyChanges = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
public RollbackDatabase(World world) throws SQLException, ClassNotFoundException {
|
public RollbackDatabase(World world) throws SQLException, ClassNotFoundException {
|
||||||
super((t, e) -> e.printStackTrace());
|
super((t, e) -> e.printStackTrace());
|
||||||
|
@ -18,7 +18,6 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
|||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,7 +97,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
|||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector2 position, BiomeType newBiome) {
|
public boolean setBiome(BlockVector2 position, BiomeType newBiome) {
|
||||||
BiomeType oldBiome = this.getBiome(position);
|
BiomeType oldBiome = this.getBiome(position);
|
||||||
if (!Objects.equals(oldBiome.getId(), newBiome.getId())) {
|
if (oldBiome.getId() != newBiome.getId()) {
|
||||||
this.changeSet.addBiomeChange(position.getBlockX(), position.getBlockZ(), oldBiome, newBiome);
|
this.changeSet.addBiomeChange(position.getBlockX(), position.getBlockZ(), oldBiome, newBiome);
|
||||||
return getExtent().setBiome(position, newBiome);
|
return getExtent().setBiome(position, newBiome);
|
||||||
} else {
|
} else {
|
||||||
@ -109,7 +108,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
|||||||
@Override
|
@Override
|
||||||
public boolean setBiome(int x, int y, int z, BiomeType newBiome) {
|
public boolean setBiome(int x, int y, int z, BiomeType newBiome) {
|
||||||
BiomeType oldBiome = this.getBiome(BlockVector2.at(x, z));
|
BiomeType oldBiome = this.getBiome(BlockVector2.at(x, z));
|
||||||
if (!Objects.equals(oldBiome.getId(), newBiome.getId())) {
|
if (oldBiome.getId() != newBiome.getId()) {
|
||||||
this.changeSet.addBiomeChange(x, z, oldBiome, newBiome);
|
this.changeSet.addBiomeChange(x, z, oldBiome, newBiome);
|
||||||
return getExtent().setBiome(x, y, z, newBiome);
|
return getExtent().setBiome(x, y, z, newBiome);
|
||||||
} else {
|
} else {
|
||||||
|
@ -16,8 +16,6 @@ import java.nio.file.Files;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Single class paster for the Incendo paste service
|
* Single class paster for the Incendo paste service
|
||||||
@ -62,7 +60,7 @@ public final class IncendoPaster implements Paster {
|
|||||||
return new PasteTask(content);
|
return new PasteTask(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class PasteTask implements Callable<URL> {
|
private final class PasteTask implements Callable<URL> {
|
||||||
|
|
||||||
private PasteTask(String content) {}
|
private PasteTask(String content) {}
|
||||||
|
|
||||||
@ -155,11 +153,14 @@ public final class IncendoPaster implements Paster {
|
|||||||
throw new IllegalStateException(String.format("Server returned status: %d %s",
|
throw new IllegalStateException(String.format("Server returned status: %d %s",
|
||||||
httpURLConnection.getResponseCode(), httpURLConnection.getResponseMessage()));
|
httpURLConnection.getResponseCode(), httpURLConnection.getResponseMessage()));
|
||||||
}
|
}
|
||||||
final String input;
|
final StringBuilder input = new StringBuilder();
|
||||||
try (final BufferedReader inputStream = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()))) {
|
try (final BufferedReader inputStream = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()))) {
|
||||||
input = inputStream.lines().map(line -> line + "\n").collect(Collectors.joining());
|
String line;
|
||||||
|
while ((line = inputStream.readLine()) != null) {
|
||||||
|
input.append(line).append("\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return input;
|
return input.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -214,15 +215,13 @@ public final class IncendoPaster implements Paster {
|
|||||||
"# Welcome to this paste\n# It is meant to provide us at IntellectualSites with better information about your "
|
"# Welcome to this paste\n# It is meant to provide us at IntellectualSites with better information about your "
|
||||||
+ "problem\n");
|
+ "problem\n");
|
||||||
b.append("\n# Server Information\n");
|
b.append("\n# Server Information\n");
|
||||||
assert Fawe.imp() != null;
|
|
||||||
b.append(Fawe.imp().getDebugInfo());
|
b.append(Fawe.imp().getDebugInfo());
|
||||||
b.append("\n# YAY! Now, let's see what we can find in your JVM\n");
|
b.append("\n# YAY! Now, let's see what we can find in your JVM\n");
|
||||||
Runtime runtime = Runtime.getRuntime();
|
Runtime runtime = Runtime.getRuntime();
|
||||||
RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean();
|
RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean();
|
||||||
b.append("Uptime: ").append(TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS))
|
b.append("Uptime: ").append(TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS) + " minutes").append('\n');
|
||||||
.append(" minutes").append('\n');
|
b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024 + " MB").append('\n');
|
||||||
b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024).append(" MB").append('\n');
|
b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024 + " MB").append('\n');
|
||||||
b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024).append(" MB").append('\n');
|
|
||||||
b.append("Java Name: ").append(rb.getVmName()).append('\n');
|
b.append("Java Name: ").append(rb.getVmName()).append('\n');
|
||||||
b.append("Java Version: '").append(System.getProperty("java.version")).append("'\n");
|
b.append("Java Version: '").append(System.getProperty("java.version")).append("'\n");
|
||||||
b.append("Java Vendor: '").append(System.getProperty("java.vendor")).append("'\n");
|
b.append("Java Vendor: '").append(System.getProperty("java.vendor")).append("'\n");
|
||||||
@ -268,14 +267,18 @@ public final class IncendoPaster implements Paster {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String readFile(final File file) throws IOException {
|
private static String readFile(final File file) throws IOException {
|
||||||
final String content;
|
final StringBuilder content = new StringBuilder();
|
||||||
final List<String> lines;
|
final List<String> lines = new ArrayList<>();
|
||||||
try (final BufferedReader reader = new BufferedReader(new FileReader(file))) {
|
try (final BufferedReader reader = new BufferedReader(new FileReader(file))) {
|
||||||
lines = reader.lines().collect(Collectors.toList());
|
String line;
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
lines.add(line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
content = IntStream.range(Math.max(0, lines.size() - 1000), lines.size())
|
for (int i = Math.max(0, lines.size() - 1000); i < lines.size(); i++) {
|
||||||
.mapToObj(i -> lines.get(i) + "\n").collect(Collectors.joining());
|
content.append(lines.get(i)).append("\n");
|
||||||
return content;
|
}
|
||||||
|
return content.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren