Fixes bugs with CompositeCommand world setting.

Removes debug from previous commit.

Relates to https://github.com/BentoBoxWorld/BentoBox/pull/415
This commit is contained in:
tastybento 2018-12-24 20:49:43 -08:00
parent 08ac89e510
commit e5c69e42a6
4 changed files with 9 additions and 12 deletions

View File

@ -85,7 +85,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
/**
* The prefix to be used in this command
*/
private String permissionPrefix = "";
private String permissionPrefix;
/**
* The world that this command operates in. This is an overworld and will cover any associated nether or end
@ -101,7 +101,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
/**
* The top level label
*/
private String topLabel = "";
private String topLabel;
/**
* Cool down tracker
@ -133,11 +133,13 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
setDescription(COMMANDS + label + ".description");
setParametersHelp(COMMANDS + label + ".parameters");
permissionPrefix = (addon != null) ? addon.getPermissionPrefix() : "";
setup();
// Set up world if this is an AddonGameMode
if (addon instanceof GameModeAddon) {
this.world = ((GameModeAddon)addon).getOverWorld();
addon.log("DEBUG: gamemode command - world = " +((GameModeAddon)addon).getOverWorld());
setWorld(((GameModeAddon)addon).getOverWorld());
}
// Run setup
setup();
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
new DefaultHelpCommand(this);
}

View File

@ -153,10 +153,8 @@ public class AddonsManager {
GameModeAddon gameMode = (GameModeAddon)addon;
// Create the gameWorlds
gameMode.createWorlds();
plugin.logDebug("GameModeAddon found! overWorld = " + gameMode.getOverWorld());
plugin.getIWM().addWorld(gameMode.getOverWorld(), gameMode.getWorldSettings());
// Register the schems
plugin.logDebug("Trying to register schems");
plugin.getSchemsManager().loadIslands(gameMode);
}
} catch (Exception e) {

View File

@ -119,7 +119,7 @@ public class LocalesManager {
// We cannot use Bukkit's saveResource, because we want it to go into a specific folder, so...
// Get the last part of the name
int lastIndex = name.lastIndexOf('/');
File targetFile = new File(localeDir, name.substring(lastIndex >= 0 ? lastIndex : 0, name.length()));
File targetFile = new File(localeDir, name.substring(lastIndex >= 0 ? lastIndex : 0));
copyFile(name, targetFile);
}
} catch (IOException e) {

View File

@ -41,12 +41,9 @@ public class SchemsManager {
plugin.logError("Could not make schems folder!");
return;
}
// Save any schems that
// Save any schems that are in the jar
try (JarFile jar = new JarFile(addon.getFile())) {
plugin.getAddonsManager().listJarFiles(jar, "schems", ".schem").forEach(name -> {
plugin.logDebug("Found " + name);
addon.saveResource(name, false);
});
plugin.getAddonsManager().listJarFiles(jar, "schems", ".schem").forEach(name -> addon.saveResource(name, false));
} catch (IOException e) {
plugin.logError("Could not load schem files from addon jar " + e.getMessage());
}