Merge branch 'master' into vehicles
This commit is contained in:
commit
3ac6270897
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
|
||||||
|
@ -6,7 +6,7 @@ import net.knarcraft.stargate.event.StargateAccessEvent;
|
|||||||
import net.knarcraft.stargate.listener.BlockEventListener;
|
import net.knarcraft.stargate.listener.BlockEventListener;
|
||||||
import net.knarcraft.stargate.listener.BungeeCordListener;
|
import net.knarcraft.stargate.listener.BungeeCordListener;
|
||||||
import net.knarcraft.stargate.listener.EntityEventListener;
|
import net.knarcraft.stargate.listener.EntityEventListener;
|
||||||
import net.knarcraft.stargate.listener.PlayerEventsListener;
|
import net.knarcraft.stargate.listener.PlayerEventListener;
|
||||||
import net.knarcraft.stargate.listener.PluginEventListener;
|
import net.knarcraft.stargate.listener.PluginEventListener;
|
||||||
import net.knarcraft.stargate.listener.VehicleEventListener;
|
import net.knarcraft.stargate.listener.VehicleEventListener;
|
||||||
import net.knarcraft.stargate.listener.WorldEventListener;
|
import net.knarcraft.stargate.listener.WorldEventListener;
|
||||||
@ -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;
|
||||||
@ -535,7 +535,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
log.info(pluginDescriptionFile.getName() + " v." + pluginDescriptionFile.getVersion() + " is enabled.");
|
log.info(pluginDescriptionFile.getName() + " v." + pluginDescriptionFile.getVersion() + " is enabled.");
|
||||||
|
|
||||||
// Register events before loading gates to stop weird things happening.
|
// Register events before loading gates to stop weird things happening.
|
||||||
pm.registerEvents(new PlayerEventsListener(), this);
|
pm.registerEvents(new PlayerEventListener(), this);
|
||||||
pm.registerEvents(new BlockEventListener(), this);
|
pm.registerEvents(new BlockEventListener(), this);
|
||||||
|
|
||||||
pm.registerEvents(new VehicleEventListener(), this);
|
pm.registerEvents(new VehicleEventListener(), this);
|
||||||
@ -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;
|
||||||
|
@ -31,7 +31,7 @@ import java.util.Objects;
|
|||||||
* This listener listens to any player-related events related to stargates
|
* This listener listens to any player-related events related to stargates
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class PlayerEventsListener implements Listener {
|
public class PlayerEventListener implements Listener {
|
||||||
|
|
||||||
private static long eventTime;
|
private static long eventTime;
|
||||||
private static PlayerInteractEvent previousEvent;
|
private static PlayerInteractEvent previousEvent;
|
||||||
@ -208,10 +208,7 @@ public class PlayerEventsListener implements Listener {
|
|||||||
* @return <p>True if the player should be denied</p>
|
* @return <p>True if the player should be denied</p>
|
||||||
*/
|
*/
|
||||||
private boolean cannotAccessPortal(Player player, Portal portal) {
|
private boolean cannotAccessPortal(Player player, Portal portal) {
|
||||||
boolean deny = false;
|
boolean deny = !Stargate.canAccessNetwork(player, portal.getNetwork());
|
||||||
if (!Stargate.canAccessNetwork(player, portal.getNetwork())) {
|
|
||||||
deny = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Stargate.canAccessPortal(player, portal, deny)) {
|
if (!Stargate.canAccessPortal(player, portal, deny)) {
|
||||||
Stargate.sendMessage(player, Stargate.getString("denyMsg"));
|
Stargate.sendMessage(player, Stargate.getString("denyMsg"));
|
@ -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];
|
||||||
|
@ -64,11 +64,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user