Fix compiling

This commit is contained in:
N0tMyFaultOG 2020-12-21 20:33:49 +01:00
parent 397692d113
commit 8c3a0a8275
No known key found for this signature in database
GPG Key ID: 823348042DA95A81
3 changed files with 57 additions and 50 deletions

View File

@ -75,6 +75,8 @@ import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.ConfigurationUtil; import com.plotsquared.core.configuration.ConfigurationUtil;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.Storage; import com.plotsquared.core.configuration.Storage;
import com.plotsquared.core.configuration.caption.ChatFormatter;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.generator.GeneratorWrapper; import com.plotsquared.core.generator.GeneratorWrapper;
import com.plotsquared.core.generator.IndependentPlotGenerator; import com.plotsquared.core.generator.IndependentPlotGenerator;
@ -984,8 +986,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
} }
return map; return map;
})); }));
metrics.addCustomChart(new Metrics.SimplePie("premium", metrics.addCustomChart(new Metrics.SimplePie("premium", () -> PremiumVerification.isPremium() ? "Premium" : "Non-Premium"));
() -> PremiumVerification.isPremium() ? "Premium" : "Non-Premium"));
metrics.addCustomChart(new Metrics.SimplePie("worlds", () -> Settings.Enabled_Components.WORLDS ? "true" : "false")); metrics.addCustomChart(new Metrics.SimplePie("worlds", () -> Settings.Enabled_Components.WORLDS ? "true" : "false"));
metrics.addCustomChart(new Metrics.SimplePie("economy", () -> Settings.Enabled_Components.ECONOMY ? "true" : "false")); metrics.addCustomChart(new Metrics.SimplePie("economy", () -> Settings.Enabled_Components.ECONOMY ? "true" : "false"));
metrics.addCustomChart(new Metrics.SimplePie("plot_expiry", () -> Settings.Enabled_Components.PLOT_EXPIRY ? "true" : "false")); metrics.addCustomChart(new Metrics.SimplePie("plot_expiry", () -> Settings.Enabled_Components.PLOT_EXPIRY ? "true" : "false"));

View File

@ -27,6 +27,7 @@ package com.plotsquared.core.command;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import com.google.inject.Inject;
import com.intellectualsites.paster.IncendoPaster; import com.intellectualsites.paster.IncendoPaster;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
@ -47,59 +48,68 @@ import java.nio.file.Files;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@CommandDeclaration(command = "debugpaste", @CommandDeclaration(command = "debugpaste",
aliases = "dp", aliases = "dp",
usage = "/plot debugpaste", usage = "/plot debugpaste",
permission = "plots.debugpaste", permission = "plots.debugpaste",
category = CommandCategory.DEBUG, category = CommandCategory.DEBUG,
confirmation = true, confirmation = true,
requiredType = RequiredType.NONE) requiredType = RequiredType.NONE)
public class DebugPaste extends SubCommand { public class DebugPaste extends SubCommand {
private final File configFile;
private final File worldfile;
@Inject public DebugPaste(@ConfigFile @Nonnull final File configFile,
@WorldFile @Nonnull final File worldFile) {
this.configFile = configFile;
this.worldfile = worldFile;
}
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) { @Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
TaskManager.runTaskAsync(() -> { TaskManager.runTaskAsync(() -> {
try { try {
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
b.append( b.append(
"# 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\n"); + "problem\n\n");
b.append("# PlotSquared Information\n"); b.append("# PlotSquared Information\n");
b.append("PlotSquared Version: ").append(PlotSquared.get().getVersion()) b.append("PlotSquared Version: ").append(PlotSquared.get().getVersion())
.append("\n"); .append("\n");
b.append("Resource ID: ").append(PremiumVerification.getResourceID()).append("\n"); b.append("Resource ID: ").append(PremiumVerification.getResourceID()).append("\n");
b.append("Download ID: ").append(PremiumVerification.getDownloadID()).append("\n"); b.append("Download ID: ").append(PremiumVerification.getDownloadID()).append("\n");
b.append("This PlotSquared version is licensed to the spigot user ") b.append("This PlotSquared version is licensed to the spigot user ")
.append(PremiumVerification.getUserID()).append("\n\n"); .append(PremiumVerification.getUserID()).append("\n\n");
b.append("# Server Information\n"); b.append("# Server Information\n");
b.append("Server Version: ").append(PlotSquared.platform().serverImplementation()) b.append("Server Version: ").append(PlotSquared.platform().serverImplementation())
.append("\n"); .append("\n");
b.append("online_mode: ").append(!Settings.UUID.OFFLINE).append(';') b.append("online_mode: ").append(!Settings.UUID.OFFLINE).append(';')
.append(!Settings.UUID.OFFLINE).append('\n'); .append(!Settings.UUID.OFFLINE).append('\n');
b.append(PlotSquared.platform().pluginsFormatted()); b.append(PlotSquared.platform().pluginsFormatted());
b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n"); b.append("\n\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: ") b.append("Uptime: ")
.append(TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS)) .append(TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS))
.append(" minutes") .append(" minutes")
.append('\n'); .append('\n');
b.append("JVM Flags: ").append(rb.getInputArguments()).append('\n'); b.append("JVM Flags: ").append(rb.getInputArguments()).append('\n');
b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024).append(" MB") b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024).append(" MB")
.append('\n'); .append('\n');
b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024).append(" MB") b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024).append(" MB")
.append('\n'); .append('\n');
b.append("Total Memory: ").append(runtime.totalMemory() / 1024 / 1024).append(" MB") b.append("Total Memory: ").append(runtime.totalMemory() / 1024 / 1024).append(" MB")
.append('\n'); .append('\n');
b.append("Available Processors: ").append(runtime.availableProcessors()).append('\n'); b.append("Available Processors: ").append(runtime.availableProcessors()).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")) b.append("Java Version: '").append(System.getProperty("java.version"))
.append("'\n"); .append("'\n");
b.append("Java Vendor: '").append(System.getProperty("java.vendor")).append("'\n"); b.append("Java Vendor: '").append(System.getProperty("java.vendor")).append("'\n");
b.append("Operating System: '").append(System.getProperty("os.name")).append("'\n"); b.append("Operating System: '").append(System.getProperty("os.name")).append("'\n");
b.append("OS Version: ").append(System.getProperty("os.version")).append('\n'); b.append("OS Version: ").append(System.getProperty("os.version")).append('\n');
b.append("OS Arch: ").append(System.getProperty("os.arch")).append('\n'); b.append("OS Arch: ").append(System.getProperty("os.arch")).append('\n');
b.append("# Okay :D Great. You are now ready to create your bug report!"); b.append("# Okay :D Great. You are now ready to create your bug report!");
b.append( b.append(
"\n# You can do so at https://issues.intellectualsites.com/projects/ps"); "\n# You can do so at https://issues.intellectualsites.com/projects/ps");
b.append("\n# or via our Discord at https://discord.gg/KxkjDVg"); b.append("\n# or via our Discord at https://discord.gg/KxkjDVg");
final IncendoPaster incendoPaster = new IncendoPaster("plotsquared"); final IncendoPaster incendoPaster = new IncendoPaster("plotsquared");
@ -107,11 +117,12 @@ public class DebugPaste extends SubCommand {
try { try {
final File logFile = final File logFile =
new File(PlotSquared.platform().getDirectory(), "../../logs/latest.log"); new File(PlotSquared.platform().getDirectory(), "../../logs/latest.log");
if (Files.size(logFile.toPath()) > 14_000_000) { if (Files.size(logFile.toPath()) > 14_000_000) {
throw new IOException("The latest.log is larger than 14MB. Please reboot your server and submit a new paste."); throw new IOException("The latest.log is larger than 14MB. Please reboot your server and submit a new paste.");
} }
incendoPaster.addFile(logFile); incendoPaster
.addFile(logFile);
} catch (IOException ignored) { } catch (IOException ignored) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugpaste.latest_log"), TranslatableCaption.of("debugpaste.latest_log"),
@ -120,14 +131,13 @@ public class DebugPaste extends SubCommand {
} }
try { try {
incendoPaster.addFile(PlotSquared.get().configFile); incendoPaster.addFile(this.configFile);
} catch (final IllegalArgumentException ignored) {
incendoPaster.addFile(PlotSquared.get().worldsFile);
} catch (final IllegalArgumentException ignored) { } catch (final IllegalArgumentException ignored) {
player.sendMessage(TranslatableCaption.of("debugpaste.empty_file"), player.sendMessage(TranslatableCaption.of("debugpaste.empty_file"),
Template.of("file", "settings.yml")); Template.of("file", "settings.yml"));
} }
incendoPaster.addFile(PlotSquared.get().translationFile); try {
incendoPaster.addFile(this.worldfile);
} catch (final IllegalArgumentException ignored) { } catch (final IllegalArgumentException ignored) {
player.sendMessage(TranslatableCaption.of("debugpaste.empty_file"), player.sendMessage(TranslatableCaption.of("debugpaste.empty_file"),
Template.of("file", "worlds.yml")); Template.of("file", "worlds.yml"));
@ -135,7 +145,7 @@ public class DebugPaste extends SubCommand {
try { try {
final File MultiverseWorlds = new File(PlotSquared.platform().getDirectory(), final File MultiverseWorlds = new File(PlotSquared.platform().getDirectory(),
"../Multiverse-Core/worlds.yml"); "../Multiverse-Core/worlds.yml");
incendoPaster.addFile(MultiverseWorlds); incendoPaster.addFile(MultiverseWorlds);
} catch (final IOException ignored) { } catch (final IOException ignored) {
player.sendMessage(TranslatableCaption.of("debugpaste.skip_multiverse"), player.sendMessage(TranslatableCaption.of("debugpaste.skip_multiverse"),
@ -145,12 +155,12 @@ public class DebugPaste extends SubCommand {
try { try {
final String rawResponse = incendoPaster.upload(); final String rawResponse = incendoPaster.upload();
final JsonObject jsonObject = final JsonObject jsonObject =
new JsonParser().parse(rawResponse).getAsJsonObject(); new JsonParser().parse(rawResponse).getAsJsonObject();
if (jsonObject.has("created")) { if (jsonObject.has("created")) {
final String pasteId = jsonObject.get("paste_id").getAsString(); final String pasteId = jsonObject.get("paste_id").getAsString();
final String link = final String link =
String.format("https://athion.net/ISPaster/paste/view/%s", pasteId); String.format("https://athion.net/ISPaster/paste/view/%s", pasteId);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugpaste.debug_report_created"), TranslatableCaption.of("debugpaste.debug_report_created"),
Template.of("url", link) Template.of("url", link)

View File

@ -330,24 +330,20 @@ public abstract class SchematicHandler {
// Paste schematic here // Paste schematic here
final QueueCoordinator queue = plot.getArea().getQueue(); final QueueCoordinator queue = plot.getArea().getQueue();
for (int ry = 0; ry < Math.min(256, HEIGHT); ry++) { for (int ry = 0; ry < Math.min(256, HEIGHT); ry++) {
int yy = y_offset_actual + ry; int yy = y_offset_actual + ry;
if (yy > 255) { if (yy > 255) {
continue; continue;
} }
for (int rz = zzb - p1z; rz <= (zzt - p1z); rz++) { for (int rz = 0; rz <= blockArrayClipboard.getDimensions().getZ(); rz++) {
for (int rx = xxb - p1x; rx <= (xxt - p1x); rx++) { for (int rx = 0; rx < blockArrayClipboard.getDimensions().getX(); rx++) {
int xx = p1x + rx; int xx = p1x + rx;
int zz = p1z + rz; int zz = p1z + rz;
BaseBlock id = blockArrayClipboard BaseBlock id = blockArrayClipboard.getFullBlock(BlockVector3.at(rx, ry, rz));
.getFullBlock(BlockVector3.at(rx, ry, rz)); queue.setBlock(xx, yy, zz, id);
queue.setBlock(xx, yy, zz, id); if (ry == 0) {
if (ry == 0) { BiomeType biome = blockArrayClipboard.getBiome(BlockVector3.at(rx, ry, rz));
BiomeType biome = queue.setBiome(xx, yy, zz, biome);
blockArrayClipboard.getBiome(BlockVector2.at(rx, rz));
queue.setBiome(xx, zz, biome);
}
}
} }
} }
} }