Remove console debug. Improved comments and JavaDoc.

This commit is contained in:
tastybento 2018-12-24 21:10:49 -08:00
parent e5c69e42a6
commit 86c13fa60e
3 changed files with 14 additions and 8 deletions

View File

@ -1,6 +1,3 @@
/**
*
*/
package world.bentobox.bentobox.api.addons; package world.bentobox.bentobox.api.addons;
import org.bukkit.Location; import org.bukkit.Location;
@ -10,8 +7,9 @@ import world.bentobox.bentobox.api.configuration.WorldSettings;
import world.bentobox.bentobox.util.Util; import world.bentobox.bentobox.util.Util;
/** /**
* Defines the addon as a game mode. A game mode creates worlds, registers world settings and schems. * Defines the addon as a game mode.
* @author tastybento * A game mode creates worlds, registers world settings and has schems in a jar folder.
* @author tastybento, Postlovitch
* *
*/ */
public abstract class GameModeAddon extends Addon { public abstract class GameModeAddon extends Addon {
@ -23,7 +21,7 @@ public abstract class GameModeAddon extends Addon {
/** /**
* Make the worlds for this GameMode in this method. BentoBox will call it * Make the worlds for this GameMode in this method. BentoBox will call it
* after onLoad() and before onEnable(). * after onLoad() and before onEnable().
* {@link #islandWorld} must be created, * {@link #islandWorld} must be created and assigned,
* {@link #netherWorld} and {@link #endWorld} are optional and may be null. * {@link #netherWorld} and {@link #endWorld} are optional and may be null.
*/ */
public abstract void createWorlds(); public abstract void createWorlds();
@ -42,14 +40,23 @@ public abstract class GameModeAddon extends Addon {
return Util.sameWorld(loc.getWorld(), islandWorld); return Util.sameWorld(loc.getWorld(), islandWorld);
} }
/**
* @return over world
*/
public World getOverWorld() { public World getOverWorld() {
return islandWorld; return islandWorld;
} }
/**
* @return nether world, or null if it does not exist
*/
public World getNetherWorld() { public World getNetherWorld() {
return netherWorld; return netherWorld;
} }
/**
* @return end world, or null if it does not exist
*/
public World getEndWorld() { public World getEndWorld() {
return endWorld; return endWorld;
} }

View File

@ -135,7 +135,6 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
permissionPrefix = (addon != null) ? addon.getPermissionPrefix() : ""; permissionPrefix = (addon != null) ? addon.getPermissionPrefix() : "";
// Set up world if this is an AddonGameMode // Set up world if this is an AddonGameMode
if (addon instanceof GameModeAddon) { if (addon instanceof GameModeAddon) {
addon.log("DEBUG: gamemode command - world = " +((GameModeAddon)addon).getOverWorld());
setWorld(((GameModeAddon)addon).getOverWorld()); setWorld(((GameModeAddon)addon).getOverWorld());
} }
// Run setup // Run setup

View File

@ -148,7 +148,7 @@ public class AddonsManager {
loaders.put(addon, addonClassLoader); loaders.put(addon, addonClassLoader);
// Run the onLoad. // Run the onLoad.
addon.onLoad(); addon.onLoad();
// If this is a GameMode, get the GameWorld // If this is a GameModeAddon create the worlds, register it and load the schems
if (addon instanceof GameModeAddon) { if (addon instanceof GameModeAddon) {
GameModeAddon gameMode = (GameModeAddon)addon; GameModeAddon gameMode = (GameModeAddon)addon;
// Create the gameWorlds // Create the gameWorlds