Fixes bug where Warps would not hook with no game modes

https://github.com/BentoBoxWorld/Warps/issues/77
This commit is contained in:
tastybento 2020-05-20 18:57:56 -07:00
parent 75feedbec0
commit 9c4a224c97
2 changed files with 10 additions and 4 deletions

View File

@ -84,7 +84,7 @@ public class Warp extends Addon {
// Save default config.yml // Save default config.yml
this.saveDefaultConfig(); this.saveDefaultConfig();
// Load the plugin's config // Load the plugin's config
if (this.loadSettings() && settings.isAllowInOtherWorlds()) { if (this.loadSettings() && getSettings().isAllowInOtherWorlds()) {
// Load the master warp and warps command // Load the master warp and warps command
new WarpCommand(this); new WarpCommand(this);
new WarpsCommand(this); new WarpsCommand(this);
@ -100,7 +100,7 @@ public class Warp extends Addon {
{ {
super.onReload(); super.onReload();
if (this.hooked) { if (this.hooked || getSettings().isAllowInOtherWorlds()) {
this.warpSignsManager.saveWarpList(); this.warpSignsManager.saveWarpList();
this.loadSettings(); this.loadSettings();
@ -132,13 +132,16 @@ public class Warp extends Addon {
} }
}); });
if (hooked) if (hooked || getSettings().isAllowInOtherWorlds())
{ {
// Start warp signs // Start warp signs
warpSignsManager = new WarpSignsManager(this, this.getPlugin()); warpSignsManager = new WarpSignsManager(this, this.getPlugin());
warpPanelManager = new WarpPanelManager(this); warpPanelManager = new WarpPanelManager(this);
// Load the listener // Load the listener
this.registerListener(new WarpSignsListener(this)); this.registerListener(new WarpSignsListener(this));
} else {
logWarning("Addon did not hook into anything and is not running stand-alone");
this.setState(State.DISABLED);
} }
} }

View File

@ -43,7 +43,10 @@ public class WarpsCommand extends CompositeCommand {
@Override @Override
public boolean execute(User user, String label, List<String> args) { public boolean execute(User user, String label, List<String> args) {
World world = getWorld() == null ? user.getWorld() : getWorld(); World world = getWorld() == null ? user.getWorld() : getWorld();
if (addon.getWarpSignsManager().listWarps(world).isEmpty()) { if (addon
.getWarpSignsManager()
.listWarps(world)
.isEmpty()) {
user.sendMessage("warps.error.no-warps-yet"); user.sendMessage("warps.error.no-warps-yet");
user.sendMessage("warps.warpTip", "[text]", addon.getSettings().getWelcomeLine()); user.sendMessage("warps.warpTip", "[text]", addon.getSettings().getWelcomeLine());
return false; return false;