Cleans up a bit and changes to compile for java 16 and spigot 1.17
This commit is contained in:
parent
75fbd44af7
commit
daa3c6f868
16
pom.xml
16
pom.xml
@ -14,8 +14,8 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<maven.compiler.source>16</maven.compiler.source>
|
||||
<maven.compiler.target>16</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
@ -33,7 +33,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.16.5-R0.1-SNAPSHOT</version>
|
||||
<version>1.17.1-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
@ -48,8 +48,8 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.seeseemelk</groupId>
|
||||
<artifactId>MockBukkit-v1.16</artifactId>
|
||||
<version>0.24.0</version>
|
||||
<artifactId>MockBukkit-v1.17</artifactId>
|
||||
<version>1.7.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -58,6 +58,12 @@
|
||||
<version>19.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -10,9 +10,9 @@ package net.knarcraft.stargate;
|
||||
*/
|
||||
public class RelativeBlockVector {
|
||||
|
||||
private int right;
|
||||
private int depth;
|
||||
private int distance;
|
||||
private final int right;
|
||||
private final int depth;
|
||||
private final int distance;
|
||||
|
||||
/**
|
||||
* Instantiates a new relative block vector
|
||||
|
@ -67,13 +67,13 @@ public class Stargate extends JavaPlugin {
|
||||
// Used for debug
|
||||
public static boolean debug = false;
|
||||
public static boolean permDebug = false;
|
||||
public static ConcurrentLinkedQueue<Portal> activeList = new ConcurrentLinkedQueue<>();
|
||||
public static final ConcurrentLinkedQueue<Portal> activeList = new ConcurrentLinkedQueue<>();
|
||||
// Used for populating gate open/closed material.
|
||||
public static Queue<BloxPopulator> blockPopulatorQueue = new LinkedList<>();
|
||||
public static final Queue<BloxPopulator> blockPopulatorQueue = new LinkedList<>();
|
||||
// HashMap of player names for Bungee support
|
||||
public static Map<String, String> bungeeQueue = new HashMap<>();
|
||||
public static final Map<String, String> bungeeQueue = new HashMap<>();
|
||||
// World names that contain stargates
|
||||
public static HashSet<String> managedWorlds = new HashSet<>();
|
||||
public static final HashSet<String> managedWorlds = new HashSet<>();
|
||||
private static String pluginVersion;
|
||||
private static String portalFolder;
|
||||
private static String gateFolder;
|
||||
@ -656,7 +656,7 @@ public class Stargate extends JavaPlugin {
|
||||
File newFile = new File(portalFolder, getServer().getWorlds().get(0).getName() + ".db");
|
||||
if (!newFile.exists()) {
|
||||
if (!newFile.getParentFile().mkdirs()) {
|
||||
log.severe("Unable to create portal directory");
|
||||
log.severe("Unable to create portal database folder: " + newFile.getParentFile().getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ package net.knarcraft.stargate;
|
||||
*/
|
||||
public class TwoTuple<K, L> {
|
||||
|
||||
private K firstValue;
|
||||
private L secondValue;
|
||||
private final K firstValue;
|
||||
private final L secondValue;
|
||||
|
||||
/**
|
||||
* Instantiate a new TwoTuple
|
||||
|
@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class CommandReload implements CommandExecutor {
|
||||
|
||||
private Stargate plugin;
|
||||
private final Stargate plugin;
|
||||
|
||||
/**
|
||||
* Instantiates the reload command
|
||||
|
@ -15,7 +15,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class CommandStarGate implements CommandExecutor {
|
||||
|
||||
private Stargate plugin;
|
||||
private final Stargate plugin;
|
||||
|
||||
/**
|
||||
* Instantiates the stargate command
|
||||
|
@ -23,7 +23,7 @@ public class BungeeCordListener implements PluginMessageListener {
|
||||
* @param message <p>The message received from the plugin</p>
|
||||
*/
|
||||
@Override
|
||||
public void onPluginMessageReceived(@NotNull String channel, @NotNull Player unused, @NotNull byte[] message) {
|
||||
public void onPluginMessageReceived(@NotNull String channel, @NotNull Player unused, byte[] message) {
|
||||
//Ignore plugin messages if bungee support is not enabled or some other plugin message is received
|
||||
if (!Stargate.enableBungee || !channel.equals("BungeeCord")) {
|
||||
return;
|
||||
|
@ -28,13 +28,13 @@ public class Gate {
|
||||
//Gate materials
|
||||
private Material portalOpenBlock;
|
||||
private Material portalClosedBlock;
|
||||
private Material portalButton;
|
||||
private final Material portalButton;
|
||||
|
||||
// Economy information
|
||||
private int useCost;
|
||||
private int createCost;
|
||||
private int destroyCost;
|
||||
private boolean toOwner;
|
||||
private final int useCost;
|
||||
private final int createCost;
|
||||
private final int destroyCost;
|
||||
private final boolean toOwner;
|
||||
|
||||
/**
|
||||
* Instantiates a new gate
|
||||
|
@ -25,9 +25,9 @@ public class GateHandler {
|
||||
private static final Character EXIT = '*';
|
||||
private static final Character CONTROL_BLOCK = '-';
|
||||
|
||||
private static Material defaultPortalBlockOpen = Material.NETHER_PORTAL;
|
||||
private static Material defaultPortalBlockClosed = Material.AIR;
|
||||
private static Material defaultButton = Material.STONE_BUTTON;
|
||||
private static final Material defaultPortalBlockOpen = Material.NETHER_PORTAL;
|
||||
private static final Material defaultPortalBlockClosed = Material.AIR;
|
||||
private static final Material defaultButton = Material.STONE_BUTTON;
|
||||
|
||||
private static final HashMap<String, Gate> gates = new HashMap<>();
|
||||
private static final HashMap<Material, List<Gate>> controlBlocks = new HashMap<>();
|
||||
@ -162,7 +162,7 @@ public class GateHandler {
|
||||
int useCost = readConfig(config, fileName, "usecost", -1);
|
||||
int createCost = readConfig(config, fileName, "createcost", -1);
|
||||
int destroyCost = readConfig(config, fileName, "destroycost", -1);
|
||||
boolean toOwner = (config.containsKey("toowner") ? Boolean.valueOf(config.get("toowner")) : EconomyHandler.toOwner);
|
||||
boolean toOwner = (config.containsKey("toowner") ? Boolean.parseBoolean(config.get("toowner")) : EconomyHandler.toOwner);
|
||||
|
||||
Gate gate = new Gate(fileName, new GateLayout(layout), types, portalOpenBlock, portalClosedBlock, portalButton, useCost,
|
||||
createCost, destroyCost, toOwner);
|
||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
||||
*/
|
||||
public class GateLayout {
|
||||
|
||||
private Character [][] layout;
|
||||
private final Character [][] layout;
|
||||
private final List<RelativeBlockVector> exits = new ArrayList<>();
|
||||
private RelativeBlockVector[] entrances = new RelativeBlockVector[0];
|
||||
private RelativeBlockVector[] border = new RelativeBlockVector[0];
|
||||
|
@ -59,11 +59,11 @@ public class Portal {
|
||||
private String destination;
|
||||
private String lastDestination = "";
|
||||
private String network;
|
||||
private String ownerName;
|
||||
private final String ownerName;
|
||||
private UUID ownerUUID;
|
||||
private boolean verified;
|
||||
private boolean fixed;
|
||||
private Map<PortalOption, Boolean> options;
|
||||
private final Map<PortalOption, Boolean> options;
|
||||
|
||||
// In-use information
|
||||
private Player player;
|
||||
|
@ -931,7 +931,7 @@ public class PortalHandler {
|
||||
}
|
||||
}
|
||||
PortalHandler.unregisterPortal(portal, false);
|
||||
Stargate.log.info(Stargate.getString("prefix") + "Destroying stargate at " + portal.toString());
|
||||
Stargate.log.info(Stargate.getString("prefix") + "Destroying stargate at " + portal);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -15,7 +15,6 @@ import be.seeseemelk.mockbukkit.MockBukkit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class GateLayoutTest {
|
||||
|
||||
@ -40,7 +39,7 @@ public class GateLayoutTest {
|
||||
expected.add(new RelativeBlockVector(1, 3, 0));
|
||||
expected.add(new RelativeBlockVector(2, 3, 0));
|
||||
|
||||
Set<RelativeBlockVector> exits = layout.getExits().keySet();
|
||||
List<RelativeBlockVector> exits = layout.getExits();
|
||||
exits.forEach((blockVector) -> assertTrue(expected.contains(blockVector)));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user