diff --git a/pom.xml b/pom.xml
index 21257be..0442820 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,39 +7,38 @@
com.github.civclassic
civclassic-parent
- 1.0.0
+ 1.0.1
- sh.okx.railswitch
RailSwitch
jar
- 1.5.1
+ 1.6.0
RailSwitch
https://github.com/civclassic/railswitch
+
+ io.papermc.paper
+ paper
+ 1.17.1-R0.1-SNAPSHOT
+ provided
+
- com.destroystokyo.paper
- paper-api
- 1.16.4-R0.1-SNAPSHOT
- provided
-
-
- vg.civcraft.mc.civmodcore
+ com.github.civclassic
CivModCore
- 1.8.2
+ 1.9.0
provided
- vg.civcraft.mc.namelayer
+ com.github.civclassic
NameLayer
- 2.14.1
+ 2.15.0
provided
- vg.civcraft.mc.citadel
+ com.github.civclassic
Citadel
- 4.1.1
+ 4.2.0
provided
@@ -49,6 +48,10 @@
civ-github-repo
https://raw.githubusercontent.com/CivClassic/artifacts/master/
+
+ papermc
+ https://papermc.io/repo/repository/maven-public/
+
diff --git a/src/main/java/sh/okx/railswitch/RailSwitchPlugin.java b/src/main/java/sh/okx/railswitch/RailSwitchPlugin.java
index eba21af..597dfa6 100644
--- a/src/main/java/sh/okx/railswitch/RailSwitchPlugin.java
+++ b/src/main/java/sh/okx/railswitch/RailSwitchPlugin.java
@@ -6,36 +6,32 @@
import sh.okx.railswitch.settings.SettingsManager;
import sh.okx.railswitch.switches.SwitchListener;
import vg.civcraft.mc.civmodcore.ACivMod;
-import vg.civcraft.mc.civmodcore.command.AikarCommandManager;
+import vg.civcraft.mc.civmodcore.commands.CommandManager;
/**
* The Rail Switch plugin class
*/
public final class RailSwitchPlugin extends ACivMod implements Listener {
- private static AikarCommandManager commands;
+ private CommandManager commandManager;
@Override
public void onEnable() {
- useNewCommandHandler = false;
super.onEnable();
SettingsManager.init(this);
- registerListener(new CitadelGlue());
+ registerListener(new CitadelGlue(this));
registerListener(new SwitchListener());
- commands = new AikarCommandManager(this) {
- @Override
- public void registerCommands() {
- registerCommand(new DestinationCommand());
- }
- };
+ commandManager = new CommandManager(this);
+ commandManager.init();
+ commandManager.registerCommand(new DestinationCommand());
}
@Override
public void onDisable() {
SettingsManager.reset();
- if (commands != null) {
- commands.reset();
- commands = null;
+ if (commandManager != null) {
+ commandManager.reset();
+ commandManager = null;
}
super.onDisable();
}
diff --git a/src/main/java/sh/okx/railswitch/commands/DestinationCommand.java b/src/main/java/sh/okx/railswitch/commands/DestinationCommand.java
index 3877116..766c3bd 100644
--- a/src/main/java/sh/okx/railswitch/commands/DestinationCommand.java
+++ b/src/main/java/sh/okx/railswitch/commands/DestinationCommand.java
@@ -1,17 +1,17 @@
package sh.okx.railswitch.commands;
+import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Optional;
import co.aikar.commands.annotation.Syntax;
import org.bukkit.entity.Player;
import sh.okx.railswitch.settings.SettingsManager;
-import vg.civcraft.mc.civmodcore.command.AikarCommand;
/**
* Continued support for setting and resetting your destination via a command.
*/
-public final class DestinationCommand extends AikarCommand {
+public final class DestinationCommand extends BaseCommand {
@CommandAlias("dest|destination|setdestination|switch|setswitch|setsw")
@Description("Set your rail destination(s)")
diff --git a/src/main/java/sh/okx/railswitch/glue/CitadelGlue.java b/src/main/java/sh/okx/railswitch/glue/CitadelGlue.java
index be403d6..dfea913 100644
--- a/src/main/java/sh/okx/railswitch/glue/CitadelGlue.java
+++ b/src/main/java/sh/okx/railswitch/glue/CitadelGlue.java
@@ -1,11 +1,12 @@
package sh.okx.railswitch.glue;
import org.bukkit.block.Block;
+import org.bukkit.plugin.Plugin;
import vg.civcraft.mc.citadel.Citadel;
import vg.civcraft.mc.citadel.ReinforcementManager;
import vg.civcraft.mc.citadel.model.Reinforcement;
-import vg.civcraft.mc.civmodcore.util.DependencyGlue;
-import vg.civcraft.mc.civmodcore.util.NullUtils;
+import vg.civcraft.mc.civmodcore.utilities.DependencyGlue;
+import vg.civcraft.mc.civmodcore.utilities.NullUtils;
import vg.civcraft.mc.civmodcore.world.WorldUtils;
/**
@@ -15,13 +16,12 @@ public final class CitadelGlue extends DependencyGlue {
private ReinforcementManager manager;
- public CitadelGlue() {
- super("Citadel");
+ public CitadelGlue(Plugin plugin) {
+ super(plugin, "Citadel");
}
- @Override
public boolean isSafeToUse() {
- if (!super.isSafeToUse()) {
+ if (!super.isDependencyEnabled()) {
return false;
}
if (this.manager == null) {
@@ -30,16 +30,6 @@ public boolean isSafeToUse() {
return true;
}
- @Override
- protected void onGlueEnabled() {
- this.manager = Citadel.getInstance().getReinforcementManager();
- }
-
- @Override
- protected void onGlueDisabled() {
- this.manager = null;
- }
-
/**
* Do two blocks, representing the sign and the rail, have the same reinforcement group?
*
@@ -64,4 +54,13 @@ public boolean doSignAndRailHaveSameReinforcement(Block sign, Block rail) {
railReinforcement.getGroup());
}
+ @Override
+ protected void onDependencyEnabled() {
+ this.manager = Citadel.getInstance().getReinforcementManager();
+ }
+
+ @Override
+ protected void onDependencyDisabled() {
+ this.manager = null;
+ }
}
diff --git a/src/main/java/sh/okx/railswitch/settings/DestinationSetting.java b/src/main/java/sh/okx/railswitch/settings/DestinationSetting.java
index b5f0dc4..095298b 100644
--- a/src/main/java/sh/okx/railswitch/settings/DestinationSetting.java
+++ b/src/main/java/sh/okx/railswitch/settings/DestinationSetting.java
@@ -4,7 +4,7 @@
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
-import vg.civcraft.mc.civmodcore.playersettings.impl.StringSetting;
+import vg.civcraft.mc.civmodcore.players.settings.impl.StringSetting;
/**
* Setting representing a player's destination.
diff --git a/src/main/java/sh/okx/railswitch/settings/RailSwitchMenu.java b/src/main/java/sh/okx/railswitch/settings/RailSwitchMenu.java
index 0708d63..3265958 100644
--- a/src/main/java/sh/okx/railswitch/settings/RailSwitchMenu.java
+++ b/src/main/java/sh/okx/railswitch/settings/RailSwitchMenu.java
@@ -2,8 +2,8 @@
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
-import vg.civcraft.mc.civmodcore.playersettings.PlayerSettingAPI;
-import vg.civcraft.mc.civmodcore.playersettings.gui.MenuSection;
+import vg.civcraft.mc.civmodcore.players.settings.PlayerSettingAPI;
+import vg.civcraft.mc.civmodcore.players.settings.gui.MenuSection;
/**
* The menu for RailSwitch. This is what all RailSwitch settings will be registered to.
diff --git a/src/main/java/sh/okx/railswitch/settings/ResetSetting.java b/src/main/java/sh/okx/railswitch/settings/ResetSetting.java
index 8bff68c..5389e00 100644
--- a/src/main/java/sh/okx/railswitch/settings/ResetSetting.java
+++ b/src/main/java/sh/okx/railswitch/settings/ResetSetting.java
@@ -6,8 +6,8 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
-import vg.civcraft.mc.civmodcore.playersettings.gui.MenuSection;
-import vg.civcraft.mc.civmodcore.playersettings.impl.StringSetting;
+import vg.civcraft.mc.civmodcore.players.settings.gui.MenuSection;
+import vg.civcraft.mc.civmodcore.players.settings.impl.StringSetting;
/**
* ResetSetting, a setting that functions more like a GUI button than an actual setting.
diff --git a/src/main/java/sh/okx/railswitch/switches/SwitchListener.java b/src/main/java/sh/okx/railswitch/switches/SwitchListener.java
index 074d8b6..ea4d386 100644
--- a/src/main/java/sh/okx/railswitch/switches/SwitchListener.java
+++ b/src/main/java/sh/okx/railswitch/switches/SwitchListener.java
@@ -14,9 +14,9 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockRedstoneEvent;
+import sh.okx.railswitch.RailSwitchPlugin;
import sh.okx.railswitch.glue.CitadelGlue;
import sh.okx.railswitch.settings.SettingsManager;
-import vg.civcraft.mc.civmodcore.entities.EntityUtils;
import vg.civcraft.mc.civmodcore.world.WorldUtils;
/**
@@ -26,7 +26,7 @@ public class SwitchListener implements Listener {
public static final String WILDCARD = "*";
- public static final CitadelGlue CITADEL_GLUE = new CitadelGlue();
+ public static final CitadelGlue CITADEL_GLUE = new CitadelGlue(RailSwitchPlugin.getPlugin(RailSwitchPlugin.class));
/**
* Event handler for rail switches. Will determine if a switch exists at the target location, and if so will process
@@ -62,7 +62,7 @@ public void onSwitchTrigger(BlockRedstoneEvent event) {
Player player = null; {
double searchDistance = Double.MAX_VALUE;
for (Entity entity : block.getWorld().getNearbyEntities(block.getLocation(), 3, 3, 3)) {
- if (!EntityUtils.isPlayer(entity)) {
+ if (!(entity instanceof Player)) {
continue;
}
Entity vehicle = entity.getVehicle();
@@ -83,7 +83,7 @@ public void onSwitchTrigger(BlockRedstoneEvent event) {
return;
}
// If Citadel is enabled, check that the sign and the rail are on the same group
- if (CITADEL_GLUE.isEnabled()) {
+ if (CITADEL_GLUE.isSafeToUse()) {
if (!CITADEL_GLUE.doSignAndRailHaveSameReinforcement(above, block)) {
return;
}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index bf0f942..ed87e72 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -3,8 +3,8 @@ version: ${project.version}
main: sh.okx.railswitch.RailSwitchPlugin
depend: [CivModCore]
softdepend: [Citadel, NameLayer]
-api-version: 1.14
+api-version: 1.17
authors: [Okx, Protonull]
description: Easily make rail switches for automated destination selection
commands:
- dest: {}
\ No newline at end of file
+ dest: {}