From 30f91733252dd4f322ae2c1a9564eb2434c64a3c Mon Sep 17 00:00:00 2001 From: PryPurity Date: Sun, 21 Jun 2020 15:19:52 -0500 Subject: [PATCH] Paper broke it, i swear. ;c --- .../java/com/wimbli/WorldBorder/Config.java | 4 +- .../com/wimbli/WorldBorder/WorldFileData.java | 62 +++++++++---------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/wimbli/WorldBorder/Config.java b/src/main/java/com/wimbli/WorldBorder/Config.java index 1dc9de9..de97f09 100644 --- a/src/main/java/com/wimbli/WorldBorder/Config.java +++ b/src/main/java/com/wimbli/WorldBorder/Config.java @@ -511,14 +511,14 @@ public class Config { int cfgVersion = cfg.getInt("cfg-version", currentCfgVersion); String msg = cfg.getString("message"); - shapeRound = cfg.getBoolean("round-border", true); + shapeRound = cfg.getBoolean("round-border", false); DEBUG = cfg.getBoolean("debug-mode", false); whooshEffect = cfg.getBoolean("whoosh-effect", true); portalRedirection = cfg.getBoolean("portal-redirection", true); knockBack = cfg.getDouble("knock-back-dist", 3.0); timerTicks = cfg.getInt("timer-delay-ticks", 5); remountDelayTicks = cfg.getInt("remount-delay-ticks", 0); - dynmapEnable = cfg.getBoolean("dynmap-border-enabled", true); + dynmapEnable = cfg.getBoolean("dynmap-border-enabled", false); dynmapMessage = cfg.getString("dynmap-border-message", "The border of the world."); dynmapHideByDefault = cfg.getBoolean("dynmap-border-hideByDefault", false); dynmapPriority = cfg.getInt("dynmap-border-priority", 0); diff --git a/src/main/java/com/wimbli/WorldBorder/WorldFileData.java b/src/main/java/com/wimbli/WorldBorder/WorldFileData.java index ea22832..9060c94 100644 --- a/src/main/java/com/wimbli/WorldBorder/WorldFileData.java +++ b/src/main/java/com/wimbli/WorldBorder/WorldFileData.java @@ -161,37 +161,37 @@ public class WorldFileData { if (!coord.equals(region)) continue; - try { - RandomAccessFile regionData = new RandomAccessFile(this.regionFile(i), "r"); - - // Use of ByteBuffer+IntBuffer for reading file headers to improve performance, as suggested by aikar, reference: - // https://github.com/PaperMC/Paper/blob/b62dfa0bf95ac27ba0fbb3fae18c064e4bb61d50/Spigot-Server-Patches/0086-Reduce-IO-ops-opening-a-new-region-file.patch - ByteBuffer header = ByteBuffer.allocate(8192); - while (header.hasRemaining()) { - if (regionData.getChannel().read(header) == -1) - throw new EOFException(); - } - header.clear(); - IntBuffer headerAsInts = header.asIntBuffer(); - - // first 4096 bytes of region file consists of 4-byte int pointers to chunk data in the file (32*32 chunks = 1024; 1024 chunks * 4 bytes each = 4096) - for (int j = 0; j < 1024; j++) { - // if chunk pointer data is 0, chunk doesn't exist yet; otherwise, it does - if (headerAsInts.get() != 0) - data.set(j, true); - } - // Read timestamps - for (int j = 0; j < 1024; j++) { - // if timestamp is zero, it is protochunk (ignore it) - if ((headerAsInts.get() == 0) && data.get(j)) - data.set(j, false); - } - regionData.close(); - } catch (FileNotFoundException ex) { - sendMessage("Error! Could not open region file to find generated chunks: " + this.regionFile(i).getName()); - } catch (IOException ex) { - sendMessage("Error! Could not read region file to find generated chunks: " + this.regionFile(i).getName()); - } + // try { + // RandomAccessFile regionData = new RandomAccessFile(this.regionFile(i), "r"); +// + // // Use of ByteBuffer+IntBuffer for reading file headers to improve performance, as suggested by aikar, reference: + // // https://github.com/PaperMC/Paper/blob/b62dfa0bf95ac27ba0fbb3fae18c064e4bb61d50/Spigot-Server-Patches/0086-Reduce-IO-ops-opening-a-new-region-file.patch + // ByteBuffer header = ByteBuffer.allocate(8192); + // while (header.hasRemaining()) { + // if (regionData.getChannel().read(header) == -1) + // throw new EOFException(); + // } + // header.clear(); + // IntBuffer headerAsInts = header.asIntBuffer(); +// + // // first 4096 bytes of region file consists of 4-byte int pointers to chunk data in the file (32*32 chunks = 1024; 1024 chunks * 4 bytes each = 4096) + // for (int j = 0; j < 1024; j++) { + // // if chunk pointer data is 0, chunk doesn't exist yet; otherwise, it does + // if (headerAsInts.get() != 0) + // data.set(j, true); + // } + // // Read timestamps + // for (int j = 0; j < 1024; j++) { + // // if timestamp is zero, it is protochunk (ignore it) + // if ((headerAsInts.get() == 0) && data.get(j)) + // data.set(j, false); + // } + // regionData.close(); + // } catch (FileNotFoundException ex) { + // sendMessage("Error! Could not open region file to find generated chunks: " + this.regionFile(i).getName()); + // } catch (IOException ex) { + // sendMessage("Error! Could not read region file to find generated chunks: " + this.regionFile(i).getName()); + // } } regionChunkExistence.put(region, data); // testImage(region, data);