New code format

This commit is contained in:
Eric Stokes 2011-09-25 09:14:17 -06:00
parent 65dce752d4
commit d63c043368
21 changed files with 101 additions and 115 deletions

View File

@ -7,10 +7,10 @@
package com.onarandombox.MultiverseCore;
import java.util.logging.Level;
import org.bukkit.Server;
import java.util.logging.Level;
public interface LoggablePlugin {
public void log(Level level, String msg);

View File

@ -7,20 +7,19 @@
package com.onarandombox.MultiverseCore;
import java.util.List;
import java.util.logging.Level;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
import com.onarandombox.utils.MVDestination;
import com.onarandombox.utils.WorldManager;
import com.pneumaticraft.commandhandler.PermissionsInterface;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
import com.onarandombox.utils.MVDestination;
import com.onarandombox.utils.WorldManager;
import com.pneumaticraft.commandhandler.PermissionsInterface;
import java.util.List;
import java.util.logging.Level;
public class MVPermissions implements PermissionsInterface {
@ -48,6 +47,7 @@ public class MVPermissions implements PermissionsInterface {
*
* @param p
* @param w
*
* @return
*/
public Boolean canTravelFromWorld(Player p, MVWorld w) {
@ -81,6 +81,7 @@ public class MVPermissions implements PermissionsInterface {
*
* @param p
* @param w
*
* @return
*/
public Boolean canEnterWorld(Player p, MVWorld w) {
@ -252,6 +253,7 @@ public class MVPermissions implements PermissionsInterface {
* If the given permission was 'multiverse.core.tp.self', this would return 'multiverse.core.tp.*'.
*
* @param seperated
*
* @return
*/
private String getParentPerm(String[] seperated) {

View File

@ -7,11 +7,11 @@
package com.onarandombox.MultiverseCore;
import java.util.Date;
import org.bukkit.entity.Player;
import org.bukkit.util.config.Configuration;
import java.util.Date;
public class MVPlayerSession {
private Player player; // Player holder, may be unnecessary.
@ -28,9 +28,7 @@ public class MVPlayerSession {
// this.bedSpawn = null;
}
/**
* Update the Teleport time.
*/
/** Update the Teleport time. */
public void teleport() {
this.teleportLast = (new Date()).getTime();
}
@ -52,6 +50,7 @@ public class MVPlayerSession {
public void setCachedHunger() {
this.cachedHunger = this.player.getFoodLevel();
}
public int getCachedHunger() {
return this.cachedHunger;
}

View File

@ -9,6 +9,8 @@ package com.onarandombox.MultiverseCore;
public interface MVPlugin extends LoggablePlugin {
public String dumpVersionInfo(String buffer);
public MultiverseCore getCore();
public void setCore(MultiverseCore core);
}

View File

@ -7,8 +7,10 @@
package com.onarandombox.MultiverseCore;
import java.util.logging.Level;
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;
@ -16,10 +18,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Vehicle;
import org.bukkit.util.Vector;
import com.onarandombox.utils.BlockSafety;
import com.onarandombox.utils.InvalidDestination;
import com.onarandombox.utils.LocationManipulation;
import com.onarandombox.utils.MVDestination;
import java.util.logging.Level;
public class MVTeleport {
@ -113,6 +112,7 @@ public class MVTeleport {
*
* @param l
* @param radius
*
* @return
*/
private Location checkAroundLocation(Location l, int diameter) {
@ -196,6 +196,7 @@ public class MVTeleport {
*
* @param e
* @param l
*
* @return
*/
@Deprecated
@ -209,9 +210,9 @@ public class MVTeleport {
}
/**
*
* @param e
* @param l
*
* @return
*/
@Deprecated
@ -225,8 +226,7 @@ public class MVTeleport {
if (!this.bs.canSpawnCartSafely(m)) {
return null;
}
}
else if (e instanceof Vehicle) {
} else if (e instanceof Vehicle) {
Vehicle v = (Vehicle) e;
if (!this.bs.canSpawnVehicleSafely(v)) {
return null;
@ -246,8 +246,7 @@ public class MVTeleport {
Player p = (Player) e;
this.plugin.getMessaging().sendMessage(p, "No safe locations found!");
this.plugin.log(Level.FINER, "No safe location found for " + p.getName());
}
else if (e.getPassenger() instanceof Player) {
} else if (e.getPassenger() instanceof Player) {
Player p = (Player) e.getPassenger();
this.plugin.getMessaging().sendMessage(p, "No safe locations found!");
this.plugin.log(Level.FINER, "No safe location found for " + p.getName());
@ -257,9 +256,12 @@ public class MVTeleport {
}
/**
* Safely teleport the entity to the MVDestination. This will perform checks to see if the place is safe, and if it's not, will adjust the final destination accordingly.
* Safely teleport the entity to the MVDestination. This will perform checks to see if the place is safe, and if
* it's not, will adjust the final destination accordingly.
*
* @param e Entity to teleport
* @param d Destination to teleport them to
*
* @return true for success, false for failure
*/
public boolean safelyTeleport(Entity e, MVDestination d) {
@ -289,6 +291,7 @@ public class MVTeleport {
*
* @param e The entity to spawn
* @param d The MVDestination to take the entity to.
*
* @return A new location to spawn the entity at.
*/
public Location getSafeLocation(Entity e, MVDestination d) {
@ -302,8 +305,7 @@ public class MVTeleport {
if (!this.bs.canSpawnCartSafely(m)) {
return null;
}
}
else if (e instanceof Vehicle) {
} else if (e instanceof Vehicle) {
Vehicle v = (Vehicle) e;
if (!this.bs.canSpawnVehicleSafely(v)) {
return null;
@ -323,8 +325,7 @@ public class MVTeleport {
Player p = (Player) e;
this.plugin.getMessaging().sendMessage(p, "No safe locations found!");
this.plugin.log(Level.FINER, "No safe location found for " + p.getName());
}
else if (e.getPassenger() instanceof Player) {
} else if (e.getPassenger() instanceof Player) {
Player p = (Player) e.getPassenger();
this.plugin.getMessaging().sendMessage(p, "No safe locations found!");
this.plugin.log(Level.FINER, "No safe location found for " + p.getName());

View File

@ -11,6 +11,7 @@ import org.getspout.spoutapi.SpoutManager;
public class SpoutInterface {
private SpoutManager spoutManager;
public SpoutInterface() {
this.spoutManager = SpoutManager.getInstance();
}

View File

@ -7,9 +7,7 @@
package com.onarandombox.MultiverseCore.api;
/**
* The API for a Multiverse Handled World.
*/
/** The API for a Multiverse Handled World. */
public interface MultiverseWorld {
}

View File

@ -67,6 +67,5 @@ public class CreateCommand extends MultiverseCommand {
} else {
sender.sendMessage(ChatColor.RED + "FAILED.");
}
return;
}
}

View File

@ -43,8 +43,7 @@ public class HelpCommand extends MultiverseCommand {
String filter = "";
if (args.size() == 0)
{
if (args.size() == 0) {
filter = "";
page = 1;
} else if (args.size() == 1) {

View File

@ -10,8 +10,6 @@ package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.utils.*;
// Will use when we can compile with JDK 6
//import com.sun.xml.internal.ws.util.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
@ -21,6 +19,9 @@ import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
// Will use when we can compile with JDK 6
//import com.sun.xml.internal.ws.util.StringUtils;
public class InfoCommand extends MultiverseCommand {
private WorldManager worldManager;
@ -50,8 +51,7 @@ public class InfoCommand extends MultiverseCommand {
sender.sendMessage("You must enter a" + ChatColor.LIGHT_PURPLE + " world" + ChatColor.WHITE + " from the console!");
return;
}
}
else if (args.size() == 1) {
} else if (args.size() == 1) {
if (this.worldManager.getMVWorld(args.get(0)) != null) {
// then we have a world!
worldName = args.get(0);
@ -69,8 +69,7 @@ public class InfoCommand extends MultiverseCommand {
return;
}
}
}
else if (args.size() == 2) {
} else if (args.size() == 2) {
worldName = args.get(0);
try {
pageNum = Integer.parseInt(args.get(1)) - 1;

View File

@ -8,7 +8,6 @@
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MVTeleport;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.event.MVTeleportEvent;
import com.onarandombox.utils.*;
@ -82,7 +81,6 @@ public class TeleportCommand extends MultiverseCommand {
MVDestination d = df.getDestination(destinationName);
MVTeleportEvent teleportEvent = new MVTeleportEvent(d, teleportee, teleporter);
this.plugin.getServer().getPluginManager().callEvent(teleportEvent);
if (teleportEvent.isCancelled()) {

View File

@ -7,19 +7,19 @@
package com.onarandombox.MultiverseCore.configuration;
import com.onarandombox.MultiverseCore.LoggablePlugin;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.config.Configuration;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.config.Configuration;
import com.onarandombox.MultiverseCore.LoggablePlugin;
public abstract class MVConfigMigrator {
public List<String> createdDefaults = new ArrayList<String>();
public abstract boolean migrate(String name, File folder);
protected final void migrateListItem(Configuration newConfig, Configuration oldConfig, String key, String oldProperty, String newProperty) {

View File

@ -7,14 +7,13 @@
package com.onarandombox.MultiverseCore.configuration;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.util.config.Configuration;
import java.io.File;
import java.util.List;
import java.util.logging.Level;
import org.bukkit.util.config.Configuration;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class MVCoreConfigMigrator extends MVConfigMigrator {
private MultiverseCore core;

View File

@ -7,10 +7,10 @@
package com.onarandombox.MultiverseCore.event;
import java.util.List;
import org.bukkit.event.Event;
import java.util.List;
public class MVConfigMigrateEvent extends Event {
private static final long serialVersionUID = 3647950355746345397L;
private List<String> configsLoaded;

View File

@ -7,10 +7,10 @@
package com.onarandombox.MultiverseCore.event;
import java.util.List;
import org.bukkit.event.Event;
import java.util.List;
public class MVConfigReloadEvent extends Event {
private static final long serialVersionUID = 3647950355746345397L;
private List<String> configsLoaded;

View File

@ -7,17 +7,17 @@
package com.onarandombox.MultiverseCore.event;
import com.onarandombox.utils.MVDestination;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import com.onarandombox.utils.MVDestination;
/**
* Event that gets called when a player use the /mvtp command
* @author fernferret
*
* @author fernferret
*/
public class MVTeleportEvent extends Event implements Cancellable {
private static final long serialVersionUID = 854826818438649269L;

View File

@ -12,6 +12,7 @@ import org.bukkit.event.Event;
public class MVVersionRequestEvent extends Event {
private String pasteBinBuffer;
public MVVersionRequestEvent(String pasteBinBuffer) {
super("MVVersion");
this.pasteBinBuffer = pasteBinBuffer;
@ -20,6 +21,7 @@ public class MVVersionRequestEvent extends Event {
public String getPasteBinBuffer() {
return this.pasteBinBuffer;
}
public void setPasteBinBuffer(String buffer) {
this.pasteBinBuffer = buffer;
}

View File

@ -7,25 +7,18 @@
package com.onarandombox.MultiverseCore.listeners;
import java.util.List;
import java.util.logging.Level;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.utils.WorldManager;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.entity.Animals;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
import org.bukkit.entity.*;
import org.bukkit.event.entity.*;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.utils.WorldManager;
import java.util.List;
import java.util.logging.Level;
//import org.bukkit.event.entity.ExplosionPrimedEvent;
@ -54,7 +47,9 @@ public class MVEntityListener extends EntityListener {
}
/**
* Event - When a Entity is Damaged, we first sort out whether it is of importance to us, such as EntityVSEntity or EntityVSProjectile. Then we grab the attacked and defender and check if its a player. Then deal with the PVP Aspect.
* Event - When a Entity is Damaged, we first sort out whether it is of importance to us, such as EntityVSEntity or
* EntityVSProjectile. Then we grab the attacked and defender and check if its a player. Then deal with the PVP
* Aspect.
*/
@Override
public void onEntityDamage(EntityDamageEvent event) {
@ -107,9 +102,7 @@ public class MVEntityListener extends EntityListener {
}
}
/**
* Handle Animal/Monster Spawn settings, seems like a more concrete method than using CraftBukkit.
*/
/** Handle Animal/Monster Spawn settings, seems like a more concrete method than using CraftBukkit. */
@Override
public void onCreatureSpawn(CreatureSpawnEvent event) {

View File

@ -7,16 +7,15 @@
package com.onarandombox.MultiverseCore.listeners;
import java.util.Arrays;
import java.util.logging.Level;
import com.fernferret.allpay.AllPay;
import com.nijikokun.bukkit.Permissions.Permissions;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import com.fernferret.allpay.AllPay;
import com.nijikokun.bukkit.Permissions.Permissions;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.util.Arrays;
import java.util.logging.Level;
public class MVPluginListener extends ServerListener {
@ -26,9 +25,7 @@ public class MVPluginListener extends ServerListener {
this.plugin = plugin;
}
/**
* Keep an eye out for Plugins which we can utilize.
*/
/** Keep an eye out for Plugins which we can utilize. */
@Override
public void onPluginEnable(PluginEnableEvent event) {
/**
@ -54,9 +51,7 @@ public class MVPluginListener extends ServerListener {
}
}
/**
* We'll check if any of the plugins we rely on decide to Disable themselves.
*/
/** We'll check if any of the plugins we rely on decide to Disable themselves. */
@Override
public void onPluginDisable(PluginDisableEvent event) {
/**

View File

@ -7,13 +7,12 @@
package com.onarandombox.MultiverseCore.listeners;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.event.weather.ThunderChangeEvent;
import org.bukkit.event.weather.WeatherChangeEvent;
import org.bukkit.event.weather.WeatherListener;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class MVWeatherListener extends WeatherListener {
private MultiverseCore plugin;