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>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>16</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>16</maven.compiler.target>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
@ -33,7 +33,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.16.5-R0.1-SNAPSHOT</version>
|
<version>1.17.1-R0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.milkbowl.vault</groupId>
|
<groupId>net.milkbowl.vault</groupId>
|
||||||
@ -48,8 +48,8 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.seeseemelk</groupId>
|
<groupId>com.github.seeseemelk</groupId>
|
||||||
<artifactId>MockBukkit-v1.16</artifactId>
|
<artifactId>MockBukkit-v1.17</artifactId>
|
||||||
<version>0.24.0</version>
|
<version>1.7.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -58,6 +58,12 @@
|
|||||||
<version>19.0.0</version>
|
<version>19.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.13.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -10,9 +10,9 @@ package net.knarcraft.stargate;
|
|||||||
*/
|
*/
|
||||||
public class RelativeBlockVector {
|
public class RelativeBlockVector {
|
||||||
|
|
||||||
private int right;
|
private final int right;
|
||||||
private int depth;
|
private final int depth;
|
||||||
private int distance;
|
private final int distance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new relative block vector
|
* Instantiates a new relative block vector
|
||||||
|
@ -67,13 +67,13 @@ public class Stargate extends JavaPlugin {
|
|||||||
// Used for debug
|
// Used for debug
|
||||||
public static boolean debug = false;
|
public static boolean debug = false;
|
||||||
public static boolean permDebug = 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.
|
// 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
|
// 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
|
// 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 pluginVersion;
|
||||||
private static String portalFolder;
|
private static String portalFolder;
|
||||||
private static String gateFolder;
|
private static String gateFolder;
|
||||||
@ -656,7 +656,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
File newFile = new File(portalFolder, getServer().getWorlds().get(0).getName() + ".db");
|
File newFile = new File(portalFolder, getServer().getWorlds().get(0).getName() + ".db");
|
||||||
if (!newFile.exists()) {
|
if (!newFile.exists()) {
|
||||||
if (!newFile.getParentFile().mkdirs()) {
|
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> {
|
public class TwoTuple<K, L> {
|
||||||
|
|
||||||
private K firstValue;
|
private final K firstValue;
|
||||||
private L secondValue;
|
private final L secondValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiate a new TwoTuple
|
* Instantiate a new TwoTuple
|
||||||
|
@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
*/
|
*/
|
||||||
public class CommandReload implements CommandExecutor {
|
public class CommandReload implements CommandExecutor {
|
||||||
|
|
||||||
private Stargate plugin;
|
private final Stargate plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates the reload command
|
* Instantiates the reload command
|
||||||
|
@ -15,7 +15,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
*/
|
*/
|
||||||
public class CommandStarGate implements CommandExecutor {
|
public class CommandStarGate implements CommandExecutor {
|
||||||
|
|
||||||
private Stargate plugin;
|
private final Stargate plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates the stargate command
|
* Instantiates the stargate command
|
||||||
|
@ -23,7 +23,7 @@ public class BungeeCordListener implements PluginMessageListener {
|
|||||||
* @param message <p>The message received from the plugin</p>
|
* @param message <p>The message received from the plugin</p>
|
||||||
*/
|
*/
|
||||||
@Override
|
@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
|
//Ignore plugin messages if bungee support is not enabled or some other plugin message is received
|
||||||
if (!Stargate.enableBungee || !channel.equals("BungeeCord")) {
|
if (!Stargate.enableBungee || !channel.equals("BungeeCord")) {
|
||||||
return;
|
return;
|
||||||
|
@ -28,13 +28,13 @@ public class Gate {
|
|||||||
//Gate materials
|
//Gate materials
|
||||||
private Material portalOpenBlock;
|
private Material portalOpenBlock;
|
||||||
private Material portalClosedBlock;
|
private Material portalClosedBlock;
|
||||||
private Material portalButton;
|
private final Material portalButton;
|
||||||
|
|
||||||
// Economy information
|
// Economy information
|
||||||
private int useCost;
|
private final int useCost;
|
||||||
private int createCost;
|
private final int createCost;
|
||||||
private int destroyCost;
|
private final int destroyCost;
|
||||||
private boolean toOwner;
|
private final boolean toOwner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new gate
|
* Instantiates a new gate
|
||||||
|
@ -25,9 +25,9 @@ public class GateHandler {
|
|||||||
private static final Character EXIT = '*';
|
private static final Character EXIT = '*';
|
||||||
private static final Character CONTROL_BLOCK = '-';
|
private static final Character CONTROL_BLOCK = '-';
|
||||||
|
|
||||||
private static Material defaultPortalBlockOpen = Material.NETHER_PORTAL;
|
private static final Material defaultPortalBlockOpen = Material.NETHER_PORTAL;
|
||||||
private static Material defaultPortalBlockClosed = Material.AIR;
|
private static final Material defaultPortalBlockClosed = Material.AIR;
|
||||||
private static Material defaultButton = Material.STONE_BUTTON;
|
private static final Material defaultButton = Material.STONE_BUTTON;
|
||||||
|
|
||||||
private static final HashMap<String, Gate> gates = new HashMap<>();
|
private static final HashMap<String, Gate> gates = new HashMap<>();
|
||||||
private static final HashMap<Material, List<Gate>> controlBlocks = 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 useCost = readConfig(config, fileName, "usecost", -1);
|
||||||
int createCost = readConfig(config, fileName, "createcost", -1);
|
int createCost = readConfig(config, fileName, "createcost", -1);
|
||||||
int destroyCost = readConfig(config, fileName, "destroycost", -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,
|
Gate gate = new Gate(fileName, new GateLayout(layout), types, portalOpenBlock, portalClosedBlock, portalButton, useCost,
|
||||||
createCost, destroyCost, toOwner);
|
createCost, destroyCost, toOwner);
|
||||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class GateLayout {
|
public class GateLayout {
|
||||||
|
|
||||||
private Character [][] layout;
|
private final Character [][] layout;
|
||||||
private final List<RelativeBlockVector> exits = new ArrayList<>();
|
private final List<RelativeBlockVector> exits = new ArrayList<>();
|
||||||
private RelativeBlockVector[] entrances = new RelativeBlockVector[0];
|
private RelativeBlockVector[] entrances = new RelativeBlockVector[0];
|
||||||
private RelativeBlockVector[] border = new RelativeBlockVector[0];
|
private RelativeBlockVector[] border = new RelativeBlockVector[0];
|
||||||
|
@ -59,11 +59,11 @@ public class Portal {
|
|||||||
private String destination;
|
private String destination;
|
||||||
private String lastDestination = "";
|
private String lastDestination = "";
|
||||||
private String network;
|
private String network;
|
||||||
private String ownerName;
|
private final String ownerName;
|
||||||
private UUID ownerUUID;
|
private UUID ownerUUID;
|
||||||
private boolean verified;
|
private boolean verified;
|
||||||
private boolean fixed;
|
private boolean fixed;
|
||||||
private Map<PortalOption, Boolean> options;
|
private final Map<PortalOption, Boolean> options;
|
||||||
|
|
||||||
// In-use information
|
// In-use information
|
||||||
private Player player;
|
private Player player;
|
||||||
|
@ -931,7 +931,7 @@ public class PortalHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
PortalHandler.unregisterPortal(portal, false);
|
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.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class GateLayoutTest {
|
public class GateLayoutTest {
|
||||||
|
|
||||||
@ -40,7 +39,7 @@ public class GateLayoutTest {
|
|||||||
expected.add(new RelativeBlockVector(1, 3, 0));
|
expected.add(new RelativeBlockVector(1, 3, 0));
|
||||||
expected.add(new RelativeBlockVector(2, 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)));
|
exits.forEach((blockVector) -> assertTrue(expected.contains(blockVector)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user