mirror of
https://github.com/PryPurity/WorldBorder.git
synced 2024-11-21 11:25:42 +01:00
1.15 -> 1.16.5 can use this updated version. If you are running on 1.15-> before 1.16, you can safely update to this version now.
This commit is contained in:
parent
ffcf3ab5f8
commit
a9243a2e50
7
.github/ISSUE_TEMPLATE/bug_report.md
vendored
7
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -1,9 +1,6 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: PryPurity
|
||||
name: Bug report about: Create a report to help us improve title: ''
|
||||
labels: bug assignees: PryPurity
|
||||
|
||||
---
|
||||
|
||||
|
12
README.md
12
README.md
@ -1,13 +1,17 @@
|
||||
WorldBorder
|
||||
===========
|
||||
|
||||
Yeah... I plan on updating this plugin.. not a confirmed dev to take up BrettFlan's project, but I will keep worldborder alive somewhat...
|
||||
Yeah... I plan on updating this plugin.. not a confirmed dev to take up BrettFlan's project, but I will keep worldborder
|
||||
alive somewhat...
|
||||
|
||||
Don't come reporting issues if you are not using this version on servers 1.15+ only.
|
||||
|
||||
This plugin is intended to efficiently provide a border for each of your worlds, which only people granted special bypass access are allowed beyond. These borders can be round/elliptic or square/rectangular. As the plugin has been written with performance as the most important goal, it should have no performance impact on your server. Additional world trimming and filling commands are available as well.
|
||||
This plugin is intended to efficiently provide a border for each of your worlds, which only people granted special
|
||||
bypass access are allowed beyond. These borders can be round/elliptic or square/rectangular. As the plugin has been
|
||||
written with performance as the most important goal, it should have no performance impact on your server. Additional
|
||||
world trimming and filling commands are available as well.
|
||||
|
||||
<a href="https://www.spigotmc.org/resources/worldborder-1-15.80466/">Updated Versions, 1.15+</a>
|
||||
|
||||
|
||||
<a href="https://www.spigotmc.org/resources/worldborder.60905/">Original Author/Developer's Spigot page, 1.6 -> 1.14.</a>
|
||||
<a href="https://www.spigotmc.org/resources/worldborder.60905/">Original Author/Developer's Spigot page, 1.6 ->
|
||||
1.14.</a>
|
||||
|
6
pom.xml
6
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.wimbli.WorldBorder</groupId>
|
||||
<artifactId>WorldBorder</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.2</version>
|
||||
<name>WorldBorder</name>
|
||||
<url>https://github.com/PryPurity/WorldBorder</url>
|
||||
<issueManagement>
|
||||
@ -33,7 +33,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.16.3-R0.1-SNAPSHOT</version>
|
||||
<version>1.16.5-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--Dynmap API-->
|
||||
@ -46,7 +46,7 @@
|
||||
<dependency>
|
||||
<groupId>com.destroystokyo.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.16.3-R0.1-SNAPSHOT</version>
|
||||
<version>1.16.5-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -15,7 +15,7 @@ import java.util.*;
|
||||
|
||||
public class BorderCheckTask implements Runnable {
|
||||
// track players who are being handled (moved back inside the border) already; needed since Bukkit is sometimes sending teleport events with the old (now incorrect) location still indicated, which can lead to a loop when we then teleport them thinking they're outside the border, triggering event again, etc.
|
||||
private static Set<String> handlingPlayers = Collections.synchronizedSet(new LinkedHashSet<String>());
|
||||
private static final Set<String> handlingPlayers = Collections.synchronizedSet(new LinkedHashSet<String>());
|
||||
|
||||
// set targetLoc only if not current player location; set returnLocationOnly to true to have new Location returned if they need to be moved to one, instead of directly handling it
|
||||
public static Location checkPlayer(Player player, Location targetLoc, boolean returnLocationOnly, boolean notify) {
|
||||
@ -62,6 +62,7 @@ public class BorderCheckTask implements Runnable {
|
||||
ride.setVelocity(new Vector(0, 0, 0));
|
||||
ride.teleport(rideLoc, TeleportCause.PLUGIN);
|
||||
|
||||
|
||||
if (Config.RemountTicks() > 0) {
|
||||
setPassengerDelayed(ride, player, player.getName(), Config.RemountTicks());
|
||||
handlingVehicle = true;
|
||||
|
@ -24,7 +24,6 @@ public class BorderData {
|
||||
safeOpenBlocks.add(Material.JUNGLE_SAPLING);
|
||||
safeOpenBlocks.add(Material.ACACIA_SAPLING);
|
||||
safeOpenBlocks.add(Material.DARK_OAK_SAPLING);
|
||||
safeOpenBlocks.add(Material.WATER);
|
||||
safeOpenBlocks.add(Material.RAIL);
|
||||
safeOpenBlocks.add(Material.POWERED_RAIL);
|
||||
safeOpenBlocks.add(Material.DETECTOR_RAIL);
|
||||
|
@ -16,8 +16,11 @@ import java.util.logging.Logger;
|
||||
|
||||
|
||||
public class Config {
|
||||
public static final DecimalFormat coord = new DecimalFormat("0.0");
|
||||
private static final int currentCfgVersion = 12;
|
||||
public static volatile DecimalFormat coord = new DecimalFormat("0.0");
|
||||
private static final Runtime rt = Runtime.getRuntime();
|
||||
private static final Map<String, BorderData> borders = Collections.synchronizedMap(new LinkedHashMap<String, BorderData>());
|
||||
private static final Set<UUID> bypassPlayers = Collections.synchronizedSet(new LinkedHashSet<UUID>());
|
||||
public static volatile WorldFillTask fillTask = null;
|
||||
public static volatile WorldTrimTask trimTask = null;
|
||||
// private stuff used within this class
|
||||
@ -25,11 +28,8 @@ public class Config {
|
||||
private static FileConfiguration cfg = null;
|
||||
private static Logger wbLog = null;
|
||||
private static int borderTask = -1;
|
||||
private static Runtime rt = Runtime.getRuntime();
|
||||
// actual configuration values which can be changed
|
||||
private static boolean shapeRound = true;
|
||||
private static Map<String, BorderData> borders = Collections.synchronizedMap(new LinkedHashMap<String, BorderData>());
|
||||
private static Set<UUID> bypassPlayers = Collections.synchronizedSet(new LinkedHashSet<UUID>());
|
||||
private static String message; // raw message without color code formatting
|
||||
private static String messageFmt; // message with color code formatting ("&" changed to funky sort-of-double-dollar-sign for legitimate color/formatting codes)
|
||||
private static String messageClean; // message cleaned of formatting codes
|
||||
@ -292,7 +292,9 @@ public class Config {
|
||||
return knockBack;
|
||||
}
|
||||
|
||||
public static boolean NoPlayersToggle() { return noPlayersToggle; }
|
||||
public static boolean NoPlayersToggle() {
|
||||
return noPlayersToggle;
|
||||
}
|
||||
|
||||
public static void setTimerTicks(int ticks) {
|
||||
timerTicks = ticks;
|
||||
@ -562,7 +564,7 @@ public class Config {
|
||||
return;
|
||||
}
|
||||
// if loading older config which didn't support color codes in border message, make sure default red color code is added at start of it
|
||||
else if (cfgVersion < 8 && !(msg.substring(0, 1).equals("&")))
|
||||
else if (cfgVersion < 8 && msg.charAt(0) != '&')
|
||||
updateMessage("&c" + msg);
|
||||
// otherwise just set border message
|
||||
else
|
||||
|
@ -16,14 +16,14 @@ import java.util.Map.Entry;
|
||||
|
||||
|
||||
public class DynMapFeatures {
|
||||
private static final int lineWeight = 3;
|
||||
private static final double lineOpacity = 1.0;
|
||||
private static final int lineColor = 0xFF0000;
|
||||
private static final Map<String, CircleMarker> roundBorders = new HashMap<String, CircleMarker>();
|
||||
private static final Map<String, AreaMarker> squareBorders = new HashMap<String, AreaMarker>();
|
||||
private static DynmapAPI api;
|
||||
private static MarkerAPI markApi;
|
||||
private static MarkerSet markSet;
|
||||
private static int lineWeight = 3;
|
||||
private static double lineOpacity = 1.0;
|
||||
private static int lineColor = 0xFF0000;
|
||||
private static Map<String, CircleMarker> roundBorders = new HashMap<String, CircleMarker>();
|
||||
private static Map<String, AreaMarker> squareBorders = new HashMap<String, AreaMarker>();
|
||||
|
||||
// Whether re-rendering functionality is available
|
||||
public static boolean renderEnabled() {
|
||||
|
@ -9,8 +9,8 @@ import org.bukkit.event.HandlerList;
|
||||
*/
|
||||
public class WorldBorderFillFinishedEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private World world;
|
||||
private long totalChunks;
|
||||
private final World world;
|
||||
private final long totalChunks;
|
||||
|
||||
public WorldBorderFillFinishedEvent(World world, long totalChunks) {
|
||||
this.world = world;
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.event.HandlerList;
|
||||
*/
|
||||
public class WorldBorderFillStartEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private WorldFillTask fillTask;
|
||||
private final WorldFillTask fillTask;
|
||||
|
||||
public WorldBorderFillStartEvent(WorldFillTask worldFillTask) {
|
||||
this.fillTask = worldFillTask;
|
||||
|
@ -9,8 +9,8 @@ import org.bukkit.event.HandlerList;
|
||||
*/
|
||||
public class WorldBorderTrimFinishedEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private World world;
|
||||
private long totalChunks;
|
||||
private final World world;
|
||||
private final long totalChunks;
|
||||
|
||||
public WorldBorderTrimFinishedEvent(World world, long totalChunks) {
|
||||
this.world = world;
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.event.HandlerList;
|
||||
*/
|
||||
public class WorldBorderTrimStartEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private WorldTrimTask trimTask;
|
||||
private final WorldTrimTask trimTask;
|
||||
|
||||
public WorldBorderTrimStartEvent(WorldTrimTask trimTask) {
|
||||
this.trimTask = trimTask;
|
||||
|
@ -30,11 +30,11 @@ public class UUIDFetcher {
|
||||
public static final long FEBRUARY_2015 = 1422748800000L;
|
||||
private static final String UUID_URL = "https://api.mojang.com/users/profiles/minecraft/%s?at=%d";
|
||||
private static final String NAME_URL = "https://api.mojang.com/user/profiles/%s/names";
|
||||
private static Gson gson = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();
|
||||
private static Map<String, UUID> uuidCache = new HashMap<String, UUID>();
|
||||
private static Map<UUID, String> nameCache = new HashMap<UUID, String>();
|
||||
private static final Gson gson = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();
|
||||
private static final Map<String, UUID> uuidCache = new HashMap<String, UUID>();
|
||||
private static final Map<UUID, String> nameCache = new HashMap<UUID, String>();
|
||||
|
||||
private static ExecutorService pool = Executors.newCachedThreadPool();
|
||||
private static final ExecutorService pool = Executors.newCachedThreadPool();
|
||||
|
||||
private String name;
|
||||
private UUID id;
|
||||
|
@ -10,10 +10,10 @@ import java.util.*;
|
||||
|
||||
|
||||
public class WBCommand implements CommandExecutor {
|
||||
// ref. list of the commands which can have a world name in front of the command itself (ex. /wb _world_ radius 100)
|
||||
private final Set<String> subCommandsWithWorldNames = new LinkedHashSet<String>();
|
||||
// map of all sub-commands with the command name (string) for quick reference
|
||||
public Map<String, WBCmd> subCommands = new LinkedHashMap<String, WBCmd>();
|
||||
// ref. list of the commands which can have a world name in front of the command itself (ex. /wb _world_ radius 100)
|
||||
private Set<String> subCommandsWithWorldNames = new LinkedHashSet<String>();
|
||||
private boolean wasWorldQuotation = false;
|
||||
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.wimbli.WorldBorder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
@ -13,11 +13,11 @@ import java.util.*;
|
||||
// by the way, this region file handler was created based on the divulged region file format: http://mojang.com/2011/02/16/minecraft-save-file-format-in-beta-1-3/
|
||||
|
||||
public class WorldFileData {
|
||||
private transient World world;
|
||||
private final transient World world;
|
||||
private final transient Map<CoordXZ, List<Boolean>> regionChunkExistence = Collections.synchronizedMap(new HashMap<CoordXZ, List<Boolean>>());
|
||||
private transient File regionFolder = null;
|
||||
private transient File[] regionFiles = null;
|
||||
private transient Player notifyPlayer = null;
|
||||
private transient Map<CoordXZ, List<Boolean>> regionChunkExistence = Collections.synchronizedMap(new HashMap<CoordXZ, List<Boolean>>());
|
||||
|
||||
// the constructor is private; use create() method above to create an instance of this class.
|
||||
private WorldFileData(World world, Player notifyPlayer) {
|
||||
|
@ -17,6 +17,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
|
||||
|
||||
public class WorldFillTask implements Runnable {
|
||||
private final transient CoordXZ lastChunk = new CoordXZ(0, 0);
|
||||
// general task-related reference data
|
||||
private transient Server server = null;
|
||||
private transient World world = null;
|
||||
@ -30,7 +31,6 @@ public class WorldFillTask implements Runnable {
|
||||
private transient int chunksPerRun = 1;
|
||||
private transient boolean continueNotice = false;
|
||||
private transient boolean forceLoad = false;
|
||||
|
||||
// these are only stored for saving task to config
|
||||
private transient int fillDistance = 208;
|
||||
private transient int tickFrequency = 1;
|
||||
@ -38,7 +38,6 @@ public class WorldFillTask implements Runnable {
|
||||
private transient int refZ = 0, lastLegZ = 0;
|
||||
private transient int refLength = -1;
|
||||
private transient int refTotal = 0, lastLegTotal = 0;
|
||||
|
||||
// values for the spiral pattern check which fills out the map to the border
|
||||
private transient int x = 0;
|
||||
private transient int z = 0;
|
||||
@ -47,8 +46,6 @@ public class WorldFillTask implements Runnable {
|
||||
private transient int length = -1;
|
||||
private transient int current = 0;
|
||||
private transient boolean insideBorder = true;
|
||||
private transient CoordXZ lastChunk = new CoordXZ(0, 0);
|
||||
|
||||
// for reporting progress back to user occasionally
|
||||
private transient long lastReport = Config.Now();
|
||||
private transient long lastAutosave = Config.Now();
|
||||
@ -462,6 +459,8 @@ public class WorldFillTask implements Runnable {
|
||||
// prod Java with a request to go ahead and do GC to clean unloaded chunks from memory; this seems to work wonders almost immediately
|
||||
// yes, explicit calls to System.gc() are normally bad, but in this case it otherwise can take a long long long time for Java to recover memory
|
||||
System.gc();
|
||||
Runtime.getRuntime().gc();
|
||||
System.runFinalization();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import java.util.List;
|
||||
|
||||
|
||||
public class CmdCommands extends WBCmd {
|
||||
private static int pageSize = 8; // examples to list per page; 10 lines available, 1 for header, 1 for footer
|
||||
private static final int pageSize = 8; // examples to list per page; 10 lines available, 1 for header, 1 for footer
|
||||
|
||||
public CmdCommands() {
|
||||
name = "commands";
|
||||
|
@ -14,7 +14,7 @@ public class CmdShape extends WBCmd {
|
||||
|
||||
addCmdExample(nameEmphasized() + "<round|square> - set the default border shape.");
|
||||
addCmdExample(nameEmphasized() + "<elliptic|rectangular> - same as above.");
|
||||
helpText = "Default value: round/elliptic. The default border shape will be used on all worlds which don't " +
|
||||
helpText = "Default value: square/rectangular. The default border shape will be used on all worlds which don't " +
|
||||
"have an individual shape set using the " + commandEmphasized("wshape") + C_DESC + "command. Elliptic " +
|
||||
"and round work the same, as rectangular and square do. The difference is down to whether the X and Z " +
|
||||
"radius are the same.";
|
||||
|
@ -31,6 +31,10 @@ public abstract class WBCmd {
|
||||
* Helper variables and methods
|
||||
*/
|
||||
public final static List<String> cmdExamplesPlayer = new ArrayList<String>(48); // still, could need to increase later
|
||||
// list of command examples for this command to be displayed as usage reference, separate between players and console
|
||||
// ... these generally should be set indirectly using addCmdExample() within the constructor for each command class
|
||||
public final List<String> cmdExamplePlayer = new ArrayList<String>();
|
||||
public final List<String> cmdExampleConsole = new ArrayList<String>();
|
||||
// command name, command permission; normally the same thing
|
||||
public String name = "";
|
||||
public String permission = null;
|
||||
@ -42,10 +46,6 @@ public abstract class WBCmd {
|
||||
public int maxParams = 9999;
|
||||
// help/explanation text to be shown after command example(s) for this command
|
||||
public String helpText = null;
|
||||
// list of command examples for this command to be displayed as usage reference, separate between players and console
|
||||
// ... these generally should be set indirectly using addCmdExample() within the constructor for each command class
|
||||
public List<String> cmdExamplePlayer = new ArrayList<String>();
|
||||
public List<String> cmdExampleConsole = new ArrayList<String>();
|
||||
|
||||
/*
|
||||
* The guts of the command run in here; needs to be overriden in the subclassed commands
|
||||
|
@ -1,8 +1,8 @@
|
||||
name: WorldBorder
|
||||
authors: [Brettflan, PryPurity]
|
||||
authors: [ Brettflan, PryPurity ]
|
||||
description: Efficient, feature-rich plugin for limiting the size of your worlds.
|
||||
version: 2.1.1
|
||||
api-version: 1.16
|
||||
version: 2.1.2
|
||||
api-version: 1.15
|
||||
main: com.wimbli.WorldBorder.WorldBorder
|
||||
softdepend:
|
||||
- dynmap
|
||||
@ -10,7 +10,7 @@ softdepend:
|
||||
commands:
|
||||
wborder:
|
||||
description: Primary command for WorldBorder.
|
||||
aliases: [wb]
|
||||
aliases: [ wb ]
|
||||
usage: |
|
||||
/<command> - list available commands (show help).
|
||||
/<command> help [command] - get help on command usage.
|
||||
|
Loading…
Reference in New Issue
Block a user