Moved API around, added more docs

This commit is contained in:
Eric Stokes 2011-09-25 10:40:23 -06:00
parent d63c043368
commit 66538ccd02
33 changed files with 409 additions and 200 deletions

View File

@ -9,7 +9,7 @@ package com.onarandombox.MultiverseCore;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
import com.onarandombox.utils.MVDestination;
import com.onarandombox.MultiverseCore.api.MVDestination;
import com.onarandombox.utils.WorldManager;
import com.pneumaticraft.commandhandler.PermissionsInterface;
import org.bukkit.Location;

View File

@ -7,10 +7,10 @@
package com.onarandombox.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import com.onarandombox.utils.BlockSafety;
import com.onarandombox.utils.InvalidDestination;
import com.onarandombox.utils.LocationManipulation;
import com.onarandombox.utils.MVDestination;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Minecart;

View File

@ -7,6 +7,8 @@
package com.onarandombox.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.utils.EnglishChatColor;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
@ -22,52 +24,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.logging.Level;
enum EnglishChatColor {
AQUA("AQUA", ChatColor.AQUA),
BLACK("BLACK", ChatColor.BLACK),
BLUE("BLUE", ChatColor.BLUE),
DARKAQUA("DARKAQUA", ChatColor.DARK_AQUA),
DARKBLUE("DARKBLUE", ChatColor.DARK_BLUE),
DARKGRAY("DARKGRAY", ChatColor.DARK_GRAY),
DARKGREEN("DARKGREEN", ChatColor.DARK_GREEN),
DARKPURPLE("DARKPURPLE", ChatColor.DARK_PURPLE),
DARKRED("DARKRED", ChatColor.DARK_RED),
GOLD("GOLD", ChatColor.GOLD),
GRAY("GRAY", ChatColor.GRAY),
GREEN("GREEN", ChatColor.GREEN),
LIGHTPURPLE("LIGHTPURPLE", ChatColor.LIGHT_PURPLE),
RED("RED", ChatColor.RED),
YELLOW("YELLOW", ChatColor.YELLOW),
WHITE("WHITE", ChatColor.WHITE);
private ChatColor color;
private String text;
EnglishChatColor(String name, ChatColor color) {
this.color = color;
this.text = name;
}
public String getText() {
return this.text;
}
public ChatColor getColor() {
return this.color;
}
public static EnglishChatColor fromString(String text) {
if (text != null) {
for (EnglishChatColor c : EnglishChatColor.values()) {
if (text.equalsIgnoreCase(c.text)) {
return c;
}
}
}
return EnglishChatColor.WHITE;
}
}
public class MVWorld {
public class MVWorld implements MultiverseWorld {
private MultiverseCore plugin; // Hold the Plugin Instance.
private Configuration config; // Hold the Configuration File.
@ -86,13 +44,12 @@ public class MVWorld {
private boolean keepSpawnInMemory; // Does the World have the spawn loaded all the time?
private Boolean pvp; // Does this World allow PVP?
private Boolean fakepvp; // Should this world have fakePVP on? (used for PVP zones)
private Boolean fakePVP; // Should this world have fakePVP on? (used for PVP zones)
private GameMode gameMode = GameMode.SURVIVAL;
private String respawnWorld; // Contains the name of the World to respawn the player to
private List<Integer> blockBlacklist; // Contain a list of Blocks which we won't allow on this World.
private HashMap<String, List<String>> masterList;
@ -100,8 +57,6 @@ public class MVWorld {
private Double price; // How much does it cost to enter this world
private int currency = -1; // What is the currency
private boolean hunger = true;
/** The generator as a string. This is used only for reporting. ex: BukkitFullOfMoon:GenID */
private String generator;
private Permission permission;
private Permission exempt;
@ -116,7 +71,6 @@ public class MVWorld {
// Set local values that CANNOT be changed by user
this.world = world;
this.name = world.getName();
this.generator = generatorString;
this.seed = seed;
this.environment = world.getEnvironment();
@ -125,7 +79,7 @@ public class MVWorld {
// Write these files to the config (once it's saved)
if (generatorString != null) {
config.setProperty("worlds." + this.name + ".generator", this.generator);
config.setProperty("worlds." + this.name + ".generator", generatorString);
}
if (seed != null) {
config.setProperty("worlds." + this.name + ".seed", this.seed);
@ -135,7 +89,8 @@ public class MVWorld {
// Set local values that CAN be changed by the user
this.setAlias(config.getString("worlds." + this.name + ".alias.name", ""));
this.setAliasColor(config.getString("worlds." + this.name + ".alias.color", ChatColor.WHITE.toString()));
this.setPvp(config.getBoolean("worlds." + this.name + ".pvp", true));
this.setFakePVPMode(config.getBoolean("worlds." + this.name + ".fakepvp", false));
this.setPVPMode(config.getBoolean("worlds." + this.name + ".pvp", true));
this.setScaling(config.getDouble("worlds." + this.name + ".scale", this.getDefaultScale(this.environment)));
this.setRespawnToWorld(config.getString("worlds." + this.name + ".respawnworld", ""));
this.setEnableWeather(config.getBoolean("worlds." + this.name + ".allowweather", true));
@ -152,7 +107,6 @@ public class MVWorld {
this.setSpawnInMemory(config.getBoolean("worlds." + this.name + ".keepspawninmemory", true));
this.getWorldBlacklist().addAll(config.getStringList("worlds." + this.name + ".worldblacklist", new ArrayList<String>()));
this.getBlockBlacklist().addAll(config.getIntList("worlds." + this.name + ".blockblacklist", new ArrayList<Integer>()));
this.translateTempSpawn(config);
this.readSpawnFromConfig(this.getCBWorld());
this.canSave = true;
@ -165,6 +119,7 @@ public class MVWorld {
this.plugin.getServer().getPluginManager().addPermission(this.exempt);
addToUpperLists(this.permission);
} catch (IllegalArgumentException e) {
this.plugin.log(Level.SEVERE, "Error when adding Exemption/Access permissions for " + this.name);
}
}
@ -235,16 +190,6 @@ public class MVWorld {
}
public String getColoredWorldString() {
ChatColor color = this.getAliasColor();
if (color == null) {
if (this.environment == Environment.NETHER) {
color = ChatColor.RED;
} else if (this.environment == Environment.NORMAL) {
color = ChatColor.GREEN;
} else if (this.environment == Environment.SKYLANDS) {
color = ChatColor.AQUA;
}
}
return this.getAliasColor() + this.getAlias() + ChatColor.WHITE;
}
@ -269,42 +214,34 @@ public class MVWorld {
private void initLists() {
this.masterList = new HashMap<String, List<String>>();
this.blockBlacklist = new ArrayList<Integer>();
// Only int list, we don't need to add it to the masterlist
this.masterList.put("worldblacklist", new ArrayList<String>());
this.masterList.put("animals", new ArrayList<String>());
this.masterList.put("monsters", new ArrayList<String>());
}
@Override
public boolean clearVariable(String property) {
if (property.equalsIgnoreCase("blockblacklist")) {
this.blockBlacklist.clear();
} else if (this.masterList.keySet().contains(property)) {
if (this.masterList.keySet().contains(property)) {
this.masterList.get(property).clear();
} else {
return false;
}
this.config.setProperty("worlds." + this.name + "." + property.toLowerCase(), this.blockBlacklist);
this.config.setProperty("worlds." + this.name + "." + property.toLowerCase(), new ArrayList<String>());
this.saveConfig();
return true;
}
public boolean addToList(String list, String value) {
if (list.equalsIgnoreCase("blockblacklist")) {
try {
int intVal = Integer.parseInt(value);
return addToList(list, intVal);
} catch (Exception e) {
}
} else if (this.masterList.keySet().contains(list)) {
@Override
public boolean addToVariable(String property, String value) {
if (this.masterList.keySet().contains(property)) {
if (list.equalsIgnoreCase("animals") || list.equalsIgnoreCase("monsters")) {
this.masterList.get(list).add(value.toUpperCase());
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase() + ".exceptions", this.masterList.get(list));
if (property.equalsIgnoreCase("animals") || property.equalsIgnoreCase("monsters")) {
this.masterList.get(property).add(value.toUpperCase());
this.config.setProperty("worlds." + this.name + "." + property.toLowerCase() + ".exceptions", this.masterList.get(property));
this.syncMobs();
} else {
this.masterList.get(list).add(value);
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase(), this.masterList.get(list));
this.masterList.get(property).add(value);
this.config.setProperty("worlds." + this.name + "." + property.toLowerCase(), this.masterList.get(property));
}
saveConfig();
return true;
@ -312,23 +249,17 @@ public class MVWorld {
return false;
}
public boolean removeFromList(String list, String value) {
if (list.equalsIgnoreCase("blockblacklist")) {
try {
int intVal = Integer.parseInt(value);
return removeFromList(list, intVal);
} catch (Exception e) {
}
}
if (this.masterList.keySet().contains(list)) {
@Override
public boolean removeFromVariable(String property, String value) {
if (this.masterList.keySet().contains(property)) {
if (list.equalsIgnoreCase("animals") || list.equalsIgnoreCase("monsters")) {
this.masterList.get(list).remove(value.toUpperCase());
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase() + ".exceptions", this.masterList.get(list));
if (property.equalsIgnoreCase("animals") || property.equalsIgnoreCase("monsters")) {
this.masterList.get(property).remove(value.toUpperCase());
this.config.setProperty("worlds." + this.name + "." + property.toLowerCase() + ".exceptions", this.masterList.get(property));
this.syncMobs();
} else {
this.masterList.get(list).remove(value);
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase(), this.masterList.get(list));
this.masterList.get(property).remove(value);
this.config.setProperty("worlds." + this.name + "." + property.toLowerCase(), this.masterList.get(property));
}
saveConfig();
return true;
@ -336,6 +267,18 @@ public class MVWorld {
return false;
}
/** Deprecated, use {@link #addToVariable(String, String)} now. */
@Deprecated
public boolean addToList(String list, String value) {
return this.addToVariable(list, value);
}
// Deprecated, use {@link #removeFromVariable(String, String)} now.
@Deprecated
public boolean removeFromList(String list, String value) {
return this.removeFromVariable(list, value);
}
private void syncMobs() {
if (this.getAnimalList().isEmpty()) {
@ -351,29 +294,9 @@ public class MVWorld {
this.plugin.getWorldManager().getWorldPurger().purgeWorld(null, this);
}
private boolean addToList(String list, Integer value) {
if (list.equalsIgnoreCase("blockblacklist")) {
this.blockBlacklist.add(value);
this.config.setProperty("worlds." + this.name + ".blockblacklist", this.blockBlacklist);
saveConfig();
}
return false;
}
private boolean removeFromList(String list, Integer value) {
if (list.equalsIgnoreCase("blockblacklist")) {
this.blockBlacklist.remove(value);
this.config.setProperty("worlds." + this.name + ".blockblacklist", this.blockBlacklist);
saveConfig();
}
return false;
}
private boolean setVariable(String name, boolean value) {
if (name.equalsIgnoreCase("pvp")) {
this.setPvp(value);
this.setPVPMode(value);
} else if (name.equalsIgnoreCase("animals")) {
this.setAnimals(value);
} else if (name.equalsIgnoreCase("monsters")) {
@ -395,14 +318,7 @@ public class MVWorld {
saveConfig();
}
/**
* This is the one people have access to. It'll handle the rest.
*
* @param name
* @param value
*
* @return
*/
@Override
public boolean setVariable(String name, String value) {
if (name.equalsIgnoreCase("alias")) {
this.setAlias(value);
@ -422,6 +338,7 @@ public class MVWorld {
this.setCurrency(intValue);
return true;
} catch (Exception e) {
return false;
}
}
if (name.equalsIgnoreCase("price")) {
@ -429,6 +346,7 @@ public class MVWorld {
double doubValue = Double.parseDouble(value);
return this.setPrice(doubValue);
} catch (Exception e) {
return false;
}
}
if (name.equalsIgnoreCase("scale") || name.equalsIgnoreCase("scaling")) {
@ -436,6 +354,7 @@ public class MVWorld {
double doubValue = Double.parseDouble(value);
return this.setScaling(doubValue);
} catch (Exception e) {
return false;
}
}
@ -444,6 +363,7 @@ public class MVWorld {
GameMode mode = GameMode.valueOf(value.toUpperCase());
return this.setGameMode(mode);
} catch (Exception e) {
return false;
}
}
@ -451,9 +371,8 @@ public class MVWorld {
boolean boolValue = Boolean.parseBoolean(value);
return this.setVariable(name, boolValue);
} catch (Exception e) {
return false;
}
return false;
}
public Environment getEnvironment() {
@ -528,9 +447,9 @@ public class MVWorld {
return this.pvp;
}
public void setPvp(Boolean pvp) {
this.fakepvp = this.plugin.getConfig().getBoolean("fakepvp", false);
if (this.fakepvp) {
@Override
public void setPVPMode(Boolean pvp) {
if (this.fakePVP) {
this.world.setPVP(true);
} else {
this.world.setPVP(pvp);
@ -538,11 +457,15 @@ public class MVWorld {
this.pvp = pvp;
this.config.setProperty("worlds." + this.name + ".pvp", pvp);
saveConfig();
}
public List<Integer> getBlockBlacklist() {
return this.blockBlacklist;
@Override
public void setFakePVPMode(Boolean fakePVPMode) {
this.fakePVP = fakePVPMode;
this.config.setProperty("worlds." + this.name + ".fakepvp", this.fakePVP);
// Now that we've set PVP mode, make sure to go through the normal setting too!
// This method will perform the save for us to eliminate one write.
this.setPVPMode(this.pvp);
}
public List<String> getWorldBlacklist() {
@ -564,11 +487,6 @@ public class MVWorld {
return true;
}
/**
* Sets the chat color from a string.
*
* @param aliasColor
*/
public void setAliasColor(String aliasColor) {
EnglishChatColor color = EnglishChatColor.fromString(aliasColor);
if (color == null) {
@ -589,12 +507,7 @@ public class MVWorld {
}
public boolean clearList(String property) {
if (property.equalsIgnoreCase("blockblacklist")) {
this.blockBlacklist.clear();
this.config.setProperty("worlds." + this.name + ".blockblacklist", this.blockBlacklist);
saveConfig();
return true;
} else if (this.masterList.containsKey(property)) {
if (this.masterList.containsKey(property)) {
this.masterList.get(property).clear();
this.config.setProperty("worlds." + this.name + "." + property.toLowerCase(), this.masterList.get(property));
this.syncMobs();
@ -605,7 +518,7 @@ public class MVWorld {
}
public boolean getFakePVP() {
return this.fakepvp;
return this.fakePVP;
}
public String getRespawnToWorld() {

View File

@ -9,6 +9,7 @@ package com.onarandombox.MultiverseCore;
import com.fernferret.allpay.AllPay;
import com.fernferret.allpay.GenericBank;
import com.onarandombox.MultiverseCore.api.LoggablePlugin;
import com.onarandombox.MultiverseCore.commands.*;
import com.onarandombox.MultiverseCore.configuration.DefaultConfig;
import com.onarandombox.MultiverseCore.configuration.MVConfigMigrator;

View File

@ -5,8 +5,13 @@
* with this project. *
******************************************************************************/
package com.onarandombox.utils;
package com.onarandombox.MultiverseCore.api;
public interface FancyText {
/**
* TODO: Write something useful here.
*
* @return And Here.
*/
public String getFancyText();
}

View File

@ -0,0 +1,30 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Server;
import java.util.logging.Level;
/** A simple API to require plugins to have a log method. */
public interface LoggablePlugin {
/**
* Logs a message at the specified level.
*
* @param level The severity of the log.
* @param msg The message to log.
*/
public void log(Level level, String msg);
/**
* Gets the server instance that this plugin is attached to.
*
* @return A {@link Server} instance.
*/
public Server getServer();
}

View File

@ -5,7 +5,7 @@
* with this project. *
******************************************************************************/
package com.onarandombox.utils;
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
@ -15,12 +15,13 @@ import org.bukkit.util.Vector;
/**
* A destination API for Multiverse
* Any plugin can add these to MV and when they are, any action that uses them (portals, MVTP, etc.) can use them!
*
* @author fernferret
*/
public interface MVDestination {
/**
* Returns the identifier or prefix that is required for this destination.
*
* <p/>
* Portals have a prefix of "p" for example and OpenWarp (third party plugin) uses "ow". This is derived from a
* hash and cannot have duplicate values. Read that as your plugin cannot use 'p' because it's already used.
* Please check the wiki when adding a custom destination!
@ -31,35 +32,38 @@ public interface MVDestination {
/**
* Allows you to determine if a Destination is valid for the type it thinks it is.
*
* <p/>
* An example of this would be the exact destination. A valid string would be: e:0,0,0 where an invalid one would
* be e:1:2:3. The first string would return true the second would return false. This is simply a convenience method
* be e:1:2:3. The first string would return true the second would return false. This is simply a convenience
* method
* and does not even NEED to be called, but it's highly recommended if you're teleporting, but it's mainly for
* Multiverse Internal use.
*
* @param plugin The plugin who the type belongs to.
* @param plugin The plugin who the type belongs to.
* @param destination The destination string. ex: p:MyPortal:nw
*
* @return True if the destination is valid, false if not.
*/
public boolean isThisType(JavaPlugin plugin, String destination);
/**
* Returns the location a specific entity will spawn at.
*
* <p/>
* To just retrieve the location as it is stored you can just pass null, but be warned some destinations may return
* null back to you if you do this. It is always safer to pass an actual entity. This is used so things like
* minecarts can be teleported.
*
* <p/>
* Do not forget to use {@link #getVelocity()} as destinations can use this too!
*
* @param entity The entity to be teleported.
*
* @return The location of the entity.
*/
public Location getLocation(Entity entity);
/**
* Returns the velocity vector for this destination.
*
* <p/>
* Plugins wishing to fully support MVDestinations MUST implement this.
*
* @return A vector representing the speed/direction the player should travel when arriving
@ -68,20 +72,20 @@ public interface MVDestination {
/**
* Sets the destination string.
*
* <p/>
* This should be used when you want to tell this destination object about a change in where it should take people.
* The destination param should be match the result from {@link #getIdentifier()}. A valid example would be that if
* {@link #getIdentifier()} returned "ow" our destination string could be "ow:TownCenter" but could not be
* "p:HomePortal"
*
* @param plugin The plugin who the type belongs to.
* @param plugin The plugin who the type belongs to.
* @param destination The destination string. ex: p:MyPortal:nw
*/
public void setDestination(JavaPlugin plugin, String destination);
/**
* Returns true if the destination is valid and players will be taken to it.
*
* <p/>
* Even if destinations are in the correct format (p:MyPortal) MyPortal may not exist, and therefore this would
* return false.
*
@ -91,7 +95,7 @@ public interface MVDestination {
/**
* Gives you a general friendly description of the type of destination.
*
* <p/>
* For example, the PlayerDestination sets this to "Player". You can use this to show where a player will be taken.
*
* @return A friendly string description of the type of destination.
@ -100,7 +104,7 @@ public interface MVDestination {
/**
* Gives you a specific name of the destination.
*
* <p/>
* For example, the PlayerDestination sets this to The Player's Name.
*
* @return A friendly string stating the name of the destination.
@ -110,7 +114,7 @@ public interface MVDestination {
/**
* Returns a string that can easily be saved in the config that contains all the details needed to rebuild this
* destination.
*
* <p/>
* ex: e:0,0,0:50:50
*
* @return The savable config string.
@ -119,9 +123,9 @@ public interface MVDestination {
/**
* Returns the permissions string required to go here.
*
* <p/>
* ex: multiverse.access.world
*
* <p/>
* NOTE: This is NOT the permission to use the teleport command.
*
* @return the permissions string required to go here.
@ -130,7 +134,7 @@ public interface MVDestination {
/**
* Should the Multiverse SafeTeleporter be used?
*
* <p/>
* If not, MV will blindly take people to the location specified.
*
* @return True if the SafeTeleporter will be used, false if not.

View File

@ -0,0 +1,35 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import com.onarandombox.MultiverseCore.MultiverseCore;
public interface MVPlugin extends LoggablePlugin {
/**
* Adds This plugin's version information to the buffer and returns the new string.
*
* @param buffer The string that contains Core and all other MV plugins' versions.
*
* @return A modified buffer that contains this MVPlugin's version information.
*/
public String dumpVersionInfo(String buffer);
/**
* Gets the reference to MultiverseCore.
*
* @return A valid {@link MultiverseCore}.
*/
public MultiverseCore getCore();
/**
* Sets the reference to MultiverseCore.
*
* @param core A valid {@link MultiverseCore}.
*/
public void setCore(MultiverseCore core);
}

View File

@ -7,7 +7,146 @@
package com.onarandombox.MultiverseCore.api;
import org.bukkit.World;
/** The API for a Multiverse Handled World. */
public interface MultiverseWorld {
/**
* Returns the Bukkit world object that this world describes.
*
* @return A {@link World}
*/
public World getCBWorld();
/**
* Adds the property to the given value. The property must be a {@link com.onarandombox.MultiverseCore.commands.SetProperties}.
*
* @param property The name of a {@link com.onarandombox.MultiverseCore.commands.SetProperties} to set.
* @param value A value in string representation, it will be parsed to the correct type.
*
* @return True if the value was set, false if not.
*/
public boolean setVariable(String property, String value);
/**
* Removes all values from the given property. The property must be a {@link com.onarandombox.MultiverseCore.commands.AddProperties}.
*
* @param property The name of a {@link com.onarandombox.MultiverseCore.commands.AddProperties} to clear.
*
* @return True if it was cleared, false if not.
*/
public boolean clearVariable(String property);
/**
* Adds a value to the given property. The property must be a {@link com.onarandombox.MultiverseCore.commands.AddProperties}.
*
* @param property The name of a {@link com.onarandombox.MultiverseCore.commands.AddProperties} to add a value to.
* @param value A value in string representation, it will be parsed to the correct type.
*
* @return True if the value was added, false if not.
*/
public boolean addToVariable(String property, String value);
/**
* Removes a value from the given property. The property must be a {@link com.onarandombox.MultiverseCore.commands.AddProperties}.
*
* @param property The name of a {@link com.onarandombox.MultiverseCore.commands.AddProperties} to remove a value
* from.
* @param value A value in string representation, it will be parsed to the correct type.
*
* @return True if the value was removed, false if not.
*/
public boolean removeFromVariable(String property, String value);
/**
* Gets the environment of this world.
*
* @return A {@link org.bukkit.World.Environment}.
*/
public World.Environment getEnvironment();
/**
* Sets the environment of a world.
* <p/>
* Note: This will ONLY take effect once the world is unloaded/reloaded.
*
* @param environment A {@link org.bukkit.World.Environment}.
*/
public void setEnvironment(World.Environment environment);
/**
* Gets the world seed of this world.
*
* @return The Long version of the seed.
*/
public Long getSeed();
/**
* Sets the seed of this world.
*
* @param seed A Long that is the seed.
*/
public void setSeed(Long seed);
/**
* Gets the name of this world. This cannot be changed.
*
* @return The name of the world as a String.
*/
public String getName();
/**
* Gets the alias of this world.
* <p/>
* This alias allows users to have a world named "world" but show up in the list as "FernIsland"
*
* @return The alias of the world as a String.
*/
public String getAlias();
/**
* Sets the alias of the world.
*
* @param alias A string that is the new alias.
*/
public void setAlias(String alias);
/**
* Returns a very nicely colored string (using Alias and Color if they are set).
*
* @return A nicely colored string.
*/
public String getColoredWorldString();
/**
* Gets whether or not animals are allowed to spawn in this world.
*
* @return True if ANY animal can, false if no animals can spawn.
*/
public Boolean allowAnimalSpawning();
/**
* Gets whether or not monsters are allowed to spawn in this world.
*
* @return True if ANY monster can, false if no monsters can spawn.
*/
public Boolean allowMonsterSpawning();
/**
* Turn pvp on or off. This setting is used to set the world's PVP mode, and thus relies on fakePVP
*
* @param pvpMode True to enable PVP damage, false to disable it.
*/
public void setPVPMode(Boolean pvpMode);
/**
* In order to allow players to have PVP zones, allow them to use the old style. I actually can't remember why this
* method is needed.
* <p/>
* May get deprecated soon.
*
* @param fakePVPMode True to enable canceling of PVP event, false to disable it (default).
*/
public void setFakePVPMode(Boolean fakePVPMode);
}

View File

@ -9,6 +9,7 @@ package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.FancyText;
import com.onarandombox.utils.*;
import org.bukkit.ChatColor;
import org.bukkit.Location;

View File

@ -9,6 +9,7 @@ package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.enums.Action;
import com.onarandombox.utils.WorldManager;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;

View File

@ -9,6 +9,7 @@ package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.enums.Action;
import com.onarandombox.utils.WorldManager;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;

View File

@ -8,6 +8,9 @@
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.enums.Action;
import com.onarandombox.MultiverseCore.enums.AddProperties;
import com.onarandombox.MultiverseCore.enums.SetProperties;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.Permission;
@ -17,19 +20,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
enum AddProperties {
blockblacklist, playerwhitelist, playerblacklist, worldblacklist, animals, monsters
}
enum Action {
Set, Add, Remove, Clear
}
// Color == Aliascolor
enum SetProperties {
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn, currency, curr, price, scale, spawnmemory, memory, weather, storm, gamemode, mode, hunger
}
public class ModifyCommand extends MultiverseCommand {
public ModifyCommand(MultiverseCore plugin) {

View File

@ -9,6 +9,7 @@ package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.enums.Action;
import com.onarandombox.utils.WorldManager;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;

View File

@ -9,6 +9,7 @@ package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.enums.Action;
import com.onarandombox.utils.WorldManager;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;

View File

@ -9,6 +9,7 @@ package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MVTeleport;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import com.onarandombox.MultiverseCore.event.MVTeleportEvent;
import com.onarandombox.utils.*;
import org.bukkit.ChatColor;

View File

@ -7,7 +7,7 @@
package com.onarandombox.MultiverseCore.configuration;
import com.onarandombox.MultiverseCore.LoggablePlugin;
import com.onarandombox.MultiverseCore.api.LoggablePlugin;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.config.Configuration;

View File

@ -5,14 +5,13 @@
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore;
package com.onarandombox.MultiverseCore.enums;
import org.bukkit.Server;
import java.util.logging.Level;
public interface LoggablePlugin {
public void log(Level level, String msg);
public Server getServer();
/**
* Multiverse 2
*
* @author fernferret
*/
public enum Action {
Set, Add, Remove, Clear
}

View File

@ -5,12 +5,13 @@
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore;
package com.onarandombox.MultiverseCore.enums;
public interface MVPlugin extends LoggablePlugin {
public String dumpVersionInfo(String buffer);
public MultiverseCore getCore();
public void setCore(MultiverseCore core);
/**
* Multiverse 2
*
* @author fernferret
*/
public enum AddProperties {
blockblacklist, playerwhitelist, playerblacklist, worldblacklist, animals, monsters
}

View File

@ -0,0 +1,17 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.enums;
/**
* Multiverse 2
*
* @author fernferret
*/ // Color == Aliascolor
public enum SetProperties {
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn, currency, curr, price, scale, spawnmemory, memory, weather, storm, gamemode, mode, hunger
}

View File

@ -7,7 +7,7 @@
package com.onarandombox.MultiverseCore.event;
import com.onarandombox.utils.MVDestination;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -7,6 +7,7 @@
package com.onarandombox.utils;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;

View File

@ -10,6 +10,7 @@ package com.onarandombox.utils;
import java.util.Arrays;
import java.util.List;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;

View File

@ -7,12 +7,12 @@
package com.onarandombox.utils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import com.onarandombox.MultiverseCore.commands.TeleportCommand;
import com.pneumaticraft.commandhandler.Command;
import org.bukkit.permissions.Permission;

View File

@ -0,0 +1,60 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.utils;
import org.bukkit.ChatColor;
/**
* Multiverse 2
*
* @author fernferret
*/
public enum EnglishChatColor {
AQUA("AQUA", ChatColor.AQUA),
BLACK("BLACK", ChatColor.BLACK),
BLUE("BLUE", ChatColor.BLUE),
DARKAQUA("DARKAQUA", ChatColor.DARK_AQUA),
DARKBLUE("DARKBLUE", ChatColor.DARK_BLUE),
DARKGRAY("DARKGRAY", ChatColor.DARK_GRAY),
DARKGREEN("DARKGREEN", ChatColor.DARK_GREEN),
DARKPURPLE("DARKPURPLE", ChatColor.DARK_PURPLE),
DARKRED("DARKRED", ChatColor.DARK_RED),
GOLD("GOLD", ChatColor.GOLD),
GRAY("GRAY", ChatColor.GRAY),
GREEN("GREEN", ChatColor.GREEN),
LIGHTPURPLE("LIGHTPURPLE", ChatColor.LIGHT_PURPLE),
RED("RED", ChatColor.RED),
YELLOW("YELLOW", ChatColor.YELLOW),
WHITE("WHITE", ChatColor.WHITE);
private ChatColor color;
private String text;
EnglishChatColor(String name, ChatColor color) {
this.color = color;
this.text = name;
}
public String getText() {
return this.text;
}
public ChatColor getColor() {
return this.color;
}
public static EnglishChatColor fromString(String text) {
if (text != null) {
for (EnglishChatColor c : EnglishChatColor.values()) {
if (text.equalsIgnoreCase(c.text)) {
return c;
}
}
}
return EnglishChatColor.WHITE;
}
}

View File

@ -10,6 +10,7 @@ package com.onarandombox.utils;
import java.util.Arrays;
import java.util.List;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;

View File

@ -7,6 +7,8 @@
package com.onarandombox.utils;
import com.onarandombox.MultiverseCore.api.FancyText;
public class FancyHeader implements FancyText {
private FancyColorScheme colors;

View File

@ -7,6 +7,8 @@
package com.onarandombox.utils;
import com.onarandombox.MultiverseCore.api.FancyText;
public class FancyMessage implements FancyText {
private String title;
private String message;

View File

@ -7,6 +7,7 @@
package com.onarandombox.utils;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Entity;

View File

@ -9,14 +9,13 @@ package com.onarandombox.utils;
import java.util.logging.Level;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Location;
import org.bukkit.TravelAgent;
import org.bukkit.entity.Player;
import com.onarandombox.MultiverseCore.MVTeleport;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.utils.CannonDestination;
import com.onarandombox.utils.MVDestination;
public class MVTravelAgent implements TravelAgent {
private MVDestination destination;

View File

@ -7,6 +7,7 @@
package com.onarandombox.utils;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;

View File

@ -45,7 +45,7 @@ public class PurgeWorlds {
* @param sender
* @param world
*/
public void purgeWorld(CommandSender sender, MVWorld world) {
public void purgeWorld(@org.jetbrains.annotations.Nullable CommandSender sender, MVWorld world) {
if (world == null) {
return;
}

View File

@ -7,6 +7,7 @@
package com.onarandombox.utils;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;