Testing out the 1.16.1 paper shit, don't you dare use this.

This commit is contained in:
PryPurity 2020-06-28 01:25:37 -05:00
parent cfb818c31b
commit 8ac70874fa
3 changed files with 47 additions and 43 deletions

10
pom.xml
View File

@ -3,18 +3,16 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.wimbli.WorldBorder</groupId> <groupId>com.wimbli.WorldBorder</groupId>
<artifactId>WorldBorder</artifactId> <artifactId>WorldBorder</artifactId>
<version>2.0.5</version> <version>2.0.6</version>
<name>WorldBorder</name> <name>WorldBorder</name>
<url>https://github.com/PryPurity/WorldBorder</url> <url>https://github.com/PryPurity/WorldBorder</url>
<issueManagement> <issueManagement>
<system>GitHub</system> <system>GitHub</system>
<url>https://github.com/PryPurity/WorldBorder/issues</url> <url>https://github.com/PryPurity/WorldBorder/issues</url>
</issueManagement> </issueManagement>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<repositories> <repositories>
<repository> <repository>
<id>spigot-repo</id> <id>spigot-repo</id>
@ -51,6 +49,12 @@
<version>1.0.4</version> <version>1.0.4</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -6,9 +6,9 @@ import org.bukkit.entity.Player;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.*;
import java.io.FileFilter; import java.nio.ByteBuffer;
import java.io.IOException; import java.nio.IntBuffer;
import java.util.List; import java.util.List;
import java.util.*; import java.util.*;
@ -155,46 +155,46 @@ public class WorldFileData {
data.add(Boolean.FALSE); data.add(Boolean.FALSE);
} }
//for (int i = 0; i < regionFiles.length; i++) { for (int i = 0; i < regionFiles.length; i++) {
// CoordXZ coord = regionFileCoordinates(i); CoordXZ coord = regionFileCoordinates(i);
// // is this region file the one we're looking for? // is this region file the one we're looking for?
// if (!coord.equals(region)) if (!coord.equals(region))
// continue; continue;
// //
// try { try {
// RandomAccessFile regionData = new RandomAccessFile(this.regionFile(i), "r"); RandomAccessFile regionData = new RandomAccessFile(this.regionFile(i), "r");
// //
// // Use of ByteBuffer+IntBuffer for reading file headers to improve performance, as suggested by aikar, reference: // 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 // 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); ByteBuffer header = ByteBuffer.allocate(8192);
// while (header.hasRemaining()) { while (header.hasRemaining()) {
// if (regionData.getChannel().read(header) == -1) if (regionData.getChannel().read(header) == -1)
// throw new EOFException(); throw new EOFException();
// } }
// header.clear(); header.clear();
// IntBuffer headerAsInts = header.asIntBuffer(); 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) // 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++) { for (int j = 0; j < 1024; j++) {
// // if chunk pointer data is 0, chunk doesn't exist yet; otherwise, it does // if chunk pointer data is 0, chunk doesn't exist yet; otherwise, it does
// if (headerAsInts.get() != 0) if (headerAsInts.get() != 0)
// data.set(j, true); data.set(j, true);
// } }
// // Read timestamps // Read timestamps
// for (int j = 0; j < 1024; j++) { for (int j = 0; j < 1024; j++) {
// // if timestamp is zero, it is protochunk (ignore it) // if timestamp is zero, it is protochunk (ignore it)
// if ((headerAsInts.get() == 0) && data.get(j)) if ((headerAsInts.get() == 0) && data.get(j))
// data.set(j, false); data.set(j, false);
// } }
// regionData.close(); regionData.close();
// } catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
// sendMessage("Error! Could not open region file to find generated chunks: " + this.regionFile(i).getName()); sendMessage("Error! Could not open region file to find generated chunks: " + this.regionFile(i).getName());
// } catch (IOException ex) { } catch (IOException ex) {
// sendMessage("Error! Could not read region file to find generated chunks: " + this.regionFile(i).getName()); sendMessage("Error! Could not read region file to find generated chunks: " + this.regionFile(i).getName());
// } }
//} }
regionChunkExistence.put(region, data); regionChunkExistence.put(region, data);
// testImage(region, data); testImage(region, data);
return data; return data;
} }

View File

@ -1,7 +1,7 @@
name: WorldBorder name: WorldBorder
authors: [Brettflan, PryPurity] authors: [Brettflan, PryPurity]
description: Efficient, feature-rich plugin for limiting the size of your worlds. description: Efficient, feature-rich plugin for limiting the size of your worlds.
version: 2.0.5 version: 2.0.6
api-version: 1.13 api-version: 1.13
main: com.wimbli.WorldBorder.WorldBorder main: com.wimbli.WorldBorder.WorldBorder
softdepend: softdepend: