Once in a blue moon I need to make it look like I actually do some work on this project...

This commit is contained in:
Rigby 2011-07-13 11:37:52 +01:00
parent 78d2d242f2
commit 889dbf2986
17 changed files with 85 additions and 83 deletions

View File

@ -2,6 +2,7 @@ package com.onarandombox.MultiverseCore;
public class MVConfigMigrator {
private MultiverseCore core;
public MVConfigMigrator(MultiverseCore core) {
this.core = core;
}

View File

@ -60,18 +60,17 @@ public class MVEntityListener extends EntityListener {
if (defender instanceof Player) {
Player player = (Player) defender;
World w = player.getWorld();
if(!this.plugin.isMVWorld(w.getName())) {
if (!this.plugin.isMVWorld(w.getName())) {
//if the world is not handled, we don't care
return;
}
MVWorld world = this.plugin.getMVWorld(w.getName());
if (attacker != null && attacker instanceof Player) {
Player pattacker = (Player) attacker;
if (!world.getPvp() && this.plugin.configMV.getBoolean("fakepvp", false)) {
pattacker.sendMessage(ChatColor.RED + "PVP is disabled in this World.");
event.setCancelled(true);
@ -80,14 +79,14 @@ public class MVEntityListener extends EntityListener {
}
}
}
@Override
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
if(event.isCancelled()) {
if (event.isCancelled()) {
return;
}
RegainReason reason = event.getRegainReason();
if(reason == RegainReason.REGEN && this.plugin.configMV.getBoolean("disableautoheal", false)) {
if (reason == RegainReason.REGEN && this.plugin.configMV.getBoolean("disableautoheal", false)) {
event.setCancelled(true);
return;
}

View File

@ -17,7 +17,7 @@ public class MVPermissions implements PermissionsInterface {
/**
* Constructor FTW
*
*
* @param plugin Pass along the Core Plugin.
*/
public MVPermissions(MultiverseCore plugin) {
@ -31,7 +31,7 @@ public class MVPermissions implements PermissionsInterface {
/**
* Check if a Player can teleport to the Destination world from there current world. This checks against the Worlds Blacklist
*
*
* @param p
* @param w
* @return
@ -57,7 +57,7 @@ public class MVPermissions implements PermissionsInterface {
/**
* Check if the Player has the permissions to enter this world.
*
*
* @param p
* @param w
* @return
@ -97,10 +97,10 @@ public class MVPermissions implements PermissionsInterface {
/**
* Returns true if a player is in a group.
*
* @param player The player to check
*
* @param player The player to check
* @param worldName The world to check in
* @param group The group are we checking
* @param group The group are we checking
* @return True if the player is in the group, false if not.
*/
private boolean inGroup(Player player, String worldName, String group) {

View File

@ -90,8 +90,8 @@ public class MVPlayerListener extends PlayerListener {
String defaultWorld = this.plugin.configMV.getString("defaultspawnworld", "world");
boolean bedRespawn = this.plugin.configMV.getBoolean("bedrespawn", true);
Location bedRespawnLoc = this.plugin.getPlayerSession(event.getPlayer()).getBedRespawnLocation();
if (bedRespawn && bedRespawnLoc != null) {
Location correctedBedRespawn = new Location(bedRespawnLoc.getWorld(), bedRespawnLoc.getX(), bedRespawnLoc.getY() + 1, bedRespawnLoc.getZ());
event.setRespawnLocation(correctedBedRespawn);

View File

@ -48,7 +48,7 @@ public class MVPlayerSession {
/**
* Grab whether the cooldown on Portal use has expired or not.
*
*
* @return
*/
public boolean getTeleportable() {
@ -62,7 +62,7 @@ public class MVPlayerSession {
/**
* Send a Message to the Player as long as enough time has passed since the last message.
*
*
* @param msg
*/
public void message(String msg) {

View File

@ -11,13 +11,13 @@ import com.fernferret.allpay.AllPay;
import com.nijikokun.bukkit.Permissions.Permissions;
public class MVPluginListener extends ServerListener {
MultiverseCore plugin;
public MVPluginListener(MultiverseCore plugin) {
this.plugin = plugin;
}
/**
* Keep an eye out for Plugins which we can utilize.
*/
@ -35,7 +35,7 @@ public class MVPluginListener extends ServerListener {
this.plugin.bank = this.plugin.banker.loadEconPlugin();
}
}
/**
* We'll check if any of the plugins we rely on decide to Disable themselves.
*/
@ -50,5 +50,5 @@ public class MVPluginListener extends ServerListener {
}
// TODO: Disable econ when it disables.
}
}

View File

@ -24,7 +24,7 @@ public class MVTeleport {
/**
* TODO: Sort out JavaDoc
*
*
* @param l
* @param w
* @return
@ -59,7 +59,7 @@ public class MVTeleport {
/**
* This method will be specific to beds, and check on top of the bed then around it.
*
*
* @return
*/
public Location getSafeBedDestination(Location bedLocation) {
@ -78,7 +78,7 @@ public class MVTeleport {
/**
* This function gets a safe place to teleport to.
*
*
* @param world
* @param player
* @return
@ -138,7 +138,7 @@ public class MVTeleport {
/**
* Check the Column given to see if there is an available safe spot.
*
*
* @param world
* @param x
* @param y
@ -159,7 +159,7 @@ public class MVTeleport {
/**
* Find a portal around the given location and return a new location.
*
*
* @param location
* @return
*/

View File

@ -10,22 +10,22 @@ import org.bukkit.World.Environment;
import org.bukkit.util.config.Configuration;
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);
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;
@ -135,7 +135,7 @@ public class MVWorld {
public String getColoredWorldString() {
ChatColor color = this.getAliasColor();
if(color == null) {
if (color == null) {
if (this.environment == Environment.NETHER) {
color = ChatColor.RED;
} else if (this.environment == Environment.NORMAL) {
@ -332,7 +332,7 @@ public class MVWorld {
/**
* This is the one people have access to. It'll handle the rest.
*
*
* @param name
* @param value
* @return
@ -486,7 +486,7 @@ public class MVWorld {
/**
* Sets the chat color from a string.
*
*
* @param aliasColor
*/
public void setAliasColor(String aliasColor) {

View File

@ -53,7 +53,8 @@ public class MultiverseCore extends JavaPlugin {
public Configuration configWorlds = null;
// Setup the block/player/entity listener.
private MVPlayerListener playerListener = new MVPlayerListener(this);;
private MVPlayerListener playerListener = new MVPlayerListener(this);
;
private MVBlockListener blockListener = new MVBlockListener(this);
private MVEntityListener entityListener = new MVEntityListener(this);
@ -68,7 +69,8 @@ public class MultiverseCore extends JavaPlugin {
private HashMap<String, MVPlayerSession> playerSessions;
private PurgeWorlds worldPurger;
public GenericBank bank = null;
public AllPay banker = new AllPay(this, "[Multiverse-Core] ");;
public AllPay banker = new AllPay(this, "[Multiverse-Core] ");
;
@Override
public void onLoad() {
@ -246,11 +248,11 @@ public class MultiverseCore extends JavaPlugin {
/**
* Add a new World to the Multiverse Setup.
*
* <p/>
* Isn't there a prettier way to do this??!!?!?!
*
*
* @param name World Name
* @param environment Environment Type
* @param env Environment Type
*/
public boolean addWorld(String name, Environment env, String seedString, String generator) {
this.debugLog(Level.CONFIG, "Adding world with: " + name + ", " + env.toString() + ", " + seedString + ", " + generator);
@ -313,7 +315,6 @@ public class MultiverseCore extends JavaPlugin {
this.worldPurger.purgeWorld(null, mvworld);
this.worlds.put(name, mvworld);
return true;
}
private boolean pluginExists(String generator) {
@ -337,7 +338,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* Remove the world from the Multiverse list
*
*
* @param name The name of the world to remove
* @return True if success, false if failure.
*/
@ -351,7 +352,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* Remove the world from the Multiverse list and from the config
*
*
* @param name The name of the world to remove
* @return True if success, false if failure.
*/
@ -364,7 +365,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* Remove the world from the Multiverse list, from the config and deletes the folder
*
*
* @param name The name of the world to remove
* @return True if success, false if failure.
*/
@ -379,7 +380,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* Delete a folder Courtesy of: lithium3141
*
*
* @param file The folder to delete
* @return true if success
*/
@ -413,7 +414,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* Grab the players session if one exists, otherwise create a session then return it.
*
*
* @param player
* @return
*/
@ -428,7 +429,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* Grab and return the Teleport class.
*
*
* @return
*/
public MVTeleport getTeleporter() {
@ -462,7 +463,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* Print messages to the server Log as well as to our DebugLog. 'debugLog' is used to seperate Heroes information from the Servers Log Output.
*
*
* @param level
* @param msg
*/
@ -473,7 +474,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* Print messages to the Debug Log, if the servers in Debug Mode then we also wan't to print the messages to the standard Server Console.
*
*
* @param level
* @param msg
*/
@ -486,7 +487,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* Parse the Authors Array into a readable String with ',' and 'and'.
*
*
* @return
*/
private String getAuthors() {
@ -517,7 +518,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* This code should get moved somewhere more appropriate, but for now, it's here.
*
*
* @param env
* @return
*/
@ -567,7 +568,7 @@ public class MultiverseCore extends JavaPlugin {
/**
* This method ONLY checks the alias of each world.
*
*
* @param name
* @return
*/

View File

@ -25,7 +25,7 @@ public class DeleteCommand extends Command {
@Override
public void runCommand(CommandSender sender, List<String> args) {
Class<?> paramTypes[] = { String.class };
Class<?> paramTypes[] = {String.class};
((MultiverseCore) this.plugin).getCommandHandler().queueCommand(sender, "mvdelete", "deleteWorld", args, paramTypes, "World Deleted!", "World was not deleted!");
}
}

View File

@ -32,7 +32,7 @@ public class HelpCommand extends Command {
@Override
public void runCommand(CommandSender sender, List<String> args) {
sender.sendMessage(ChatColor.AQUA + "====[ Multiverse Help ]====");
int page = 1;
if (args.size() == 1) {
@ -65,7 +65,7 @@ public class HelpCommand extends Command {
sender.sendMessage(ChatColor.AQUA + " Page " + page + " of " + totalPages);
sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
this.showPage(page, sender, availableCommands);
}

View File

@ -15,6 +15,7 @@ enum AddProperties {
enum Action {
Set, Add, Remove, Clear
}
// Color == Aliascolor
enum SetProperties {
alias, animals, monsters, pvp, scaling, aliascolor, color

View File

@ -63,10 +63,9 @@ public class ModifySetCommand extends Command {
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/l54PH");
return;
}
if((property.equalsIgnoreCase("aliascolor") || property.equalsIgnoreCase("color")) && !world.isValidAliasColor(value)) {
if ((property.equalsIgnoreCase("aliascolor") || property.equalsIgnoreCase("color")) && !world.isValidAliasColor(value)) {
sender.sendMessage(value + " is not a valid color. Please see our Github Wiki for the complete color list.");
}
else if (world.setVariable(property, value)) {
} else if (world.setVariable(property, value)) {
sender.sendMessage("Property " + property + " was set to " + value);
} else {
sender.sendMessage("There was an error setting " + property);

View File

@ -32,12 +32,12 @@ public class SleepCommand extends Command {
if (sender instanceof Player) {
p = (Player) sender;
}
if(p == null) {
if (p == null) {
return;
}
MVPlayerSession session = ((MultiverseCore) this.plugin).getPlayerSession(p);
if(session.getBedRespawnLocation() != null) {
if (session.getBedRespawnLocation() != null) {
p.teleport(session.getBedRespawnLocation());
} else {
sender.sendMessage("Hmm this is awkward...");

View File

@ -70,11 +70,11 @@ public class TeleportCommand extends Command {
}
Destination d = Destination.parseDestination(worldName, (MultiverseCore) this.plugin);
if (!(d.getType() == DestinationType.World) || !((MultiverseCore)this.plugin).isMVWorld(d.getName())) {
if (!(d.getType() == DestinationType.World) || !((MultiverseCore) this.plugin).isMVWorld(d.getName())) {
sender.sendMessage("Multiverse does not know about this world: " + worldName);
return;
}
MVWorld world = ((MultiverseCore)this.plugin).getMVWorld(d.getName());
MVWorld world = ((MultiverseCore) this.plugin).getMVWorld(d.getName());
if (teleporter != null && !((MultiverseCore) this.plugin).getPermissions().canEnterWorld(teleporter, world)) {
if (teleportee.equals(teleporter)) {

View File

@ -6,6 +6,7 @@ import java.io.InputStream;
/**
* https://github.com/Nijikokun/iConomy3/blob/master/com/nijiko/coelho/iConomy/iConomy.java
*
* @author Nijikokun & Coelho
*/
public class DefaultConfiguration {

View File

@ -4,32 +4,32 @@ import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
public class MVRespawnEvent extends Event{
public class MVRespawnEvent extends Event {
private static final long serialVersionUID = -2991894063331856687L;
private Player player;
private Location location;
private String respawnMethod;
public MVRespawnEvent(Location spawningAt, Player p, String respawnMethod) {
super("MVRespawn");
this.player = p;
this.location = spawningAt;
this.respawnMethod = respawnMethod;
}
public Player getPlayer() {
return this.player;
}
public String getRespawnMethod() {
return this.respawnMethod;
}
public Location getPlayersRespawnLocation() {
return this.location;
}
public void setRespawnLocation(Location l) {
this.location = l;
}