dat style

CheckStyle is merciless!
This commit is contained in:
main() 2012-08-06 15:34:01 +02:00
parent a9a5d7467a
commit 48adbec011
8 changed files with 37 additions and 42 deletions

View File

@ -60,23 +60,23 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
private static final int SPAWN_LOCATION_SEARCH_TOLERANCE = 16;
private static final int SPAWN_LOCATION_SEARCH_RADIUS = 16;
private static final Map<String, String> propertyAliases;
private static final Map<String, String> PROPERTY_ALIASES;
static {
propertyAliases = new HashMap<String, String>();
propertyAliases.put("curr", "currency");
propertyAliases.put("scaling", "scale");
propertyAliases.put("aliascolor", "color");
propertyAliases.put("heal", "autoHeal");
propertyAliases.put("storm", "allowWeather");
propertyAliases.put("weather", "allowWeather");
propertyAliases.put("spawnmemory", "keepSpawnInMemory");
propertyAliases.put("memory", "keepSpawnInMemory");
propertyAliases.put("mode", "gameMode");
propertyAliases.put("diff", "difficulty");
propertyAliases.put("spawnlocation", "spawn");
propertyAliases.put("animals", "spawning.animals.spawn");
propertyAliases.put("monsters", "spawning.monsters.spawn");
PROPERTY_ALIASES = new HashMap<String, String>();
PROPERTY_ALIASES.put("curr", "currency");
PROPERTY_ALIASES.put("scaling", "scale");
PROPERTY_ALIASES.put("aliascolor", "color");
PROPERTY_ALIASES.put("heal", "autoHeal");
PROPERTY_ALIASES.put("storm", "allowWeather");
PROPERTY_ALIASES.put("weather", "allowWeather");
PROPERTY_ALIASES.put("spawnmemory", "keepSpawnInMemory");
PROPERTY_ALIASES.put("memory", "keepSpawnInMemory");
PROPERTY_ALIASES.put("mode", "gameMode");
PROPERTY_ALIASES.put("diff", "difficulty");
PROPERTY_ALIASES.put("spawnlocation", "spawn");
PROPERTY_ALIASES.put("animals", "spawning.animals.spawn");
PROPERTY_ALIASES.put("monsters", "spawning.monsters.spawn");
}
/*
* We have to use setCBWorld(), setPlugin() and initPerms() to prepare this object for use.
@ -447,7 +447,6 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
private boolean bedRespawn;
@Property
private List<String> worldBlacklist;
@SuppressWarnings("unused") // it IS used!
@Property(serializor = TimePropertySerializor.class, virtualType = Long.class,
description = "Set the time to whatever you want! (Will NOT freeze time)")
private VirtualProperty<Long> time = new VirtualProperty<Long>() {
@ -666,7 +665,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
* @see SerializationConfig
*/
protected static Map<String, String> getAliases() {
return propertyAliases;
return PROPERTY_ALIASES;
}
private static double getDefaultScale(Environment environment) {

View File

@ -17,7 +17,6 @@ import com.onarandombox.MultiverseCore.api.MVPlugin;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseCoreConfig;
import com.onarandombox.MultiverseCore.api.MultiverseMessaging;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
import com.onarandombox.MultiverseCore.commands.AnchorCommand;
import com.onarandombox.MultiverseCore.commands.CheckCommand;
@ -97,7 +96,6 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -312,7 +310,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
}
/**
* Initializes the buscript javascript library
* Initializes the buscript javascript library.
*/
private void initializeBuscript() {
buscript = new Buscript(this);
@ -435,11 +433,11 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
/**
* Migrate the worlds.yml to SerializationConfig.
*/
private void migrateWorldConfig() {
private void migrateWorldConfig() { // SUPPRESS CHECKSTYLE: MethodLength
FileConfiguration wconf = YamlConfiguration
.loadConfiguration(new File(getDataFolder(), "worlds.yml"));
if (!wconf.isConfigurationSection("worlds")) {// empty config
if (!wconf.isConfigurationSection("worlds")) { // empty config
this.log(Level.FINE, "No worlds to migrate!");
return;
}

View File

@ -65,7 +65,6 @@ public interface MVWorldManager {
*
* @param oldName Name of world to be copied
* @param newName Name of world to be created
* @param env Environment Type
* @param generator The Custom generator plugin to use.
* @return True if the world is copied successfully, false if not.
*/

View File

@ -35,7 +35,8 @@ public class CloneCommand extends MultiverseCommand {
this.addCommandExample("/mv clone " + ChatColor.GOLD + "world" + ChatColor.GREEN + " world_backup");
this.addCommandExample("/mv clone " + ChatColor.GOLD + "skyblock_pristine" + ChatColor.GREEN + " skyblock");
this.addCommandExample("To clone a world that uses a generator:");
this.addCommandExample("/mv clone " + ChatColor.GOLD + "CleanRoom" + ChatColor.GREEN + " CleanRoomCopy" + ChatColor.DARK_AQUA + " -g CleanRoomGenerator");
this.addCommandExample("/mv clone " + ChatColor.GOLD + "CleanRoom"
+ ChatColor.GREEN + " CleanRoomCopy" + ChatColor.DARK_AQUA + " -g CleanRoomGenerator");
this.setPermission("multiverse.core.clone", "Clones a world.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}

View File

@ -8,8 +8,6 @@
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -22,7 +22,6 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerQuitEvent;

View File

@ -45,10 +45,15 @@ public class FileUtils {
}
}
private static final int COPY_BLOCK_SIZE = 1024;
/**
* Helper method to copy the world-folder
* Helper method to copy the world-folder.
* @param source Source-File
* @param target Target-File
* @param log A logger that logs the operation
*
* @returns if it had success
* @return if it had success
*/
public static boolean copyFolder(File source, File target, Logger log) {
InputStream in = null;
@ -64,26 +69,22 @@ public class FileUtils {
for (String child : children) {
copyFolder(new File(source, child), new File(target, child), log);
}
}
else {
} else {
in = new FileInputStream(source);
out = new FileOutputStream(target);
byte[] buf = new byte[1024];
byte[] buf = new byte[COPY_BLOCK_SIZE];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
}
return true;
}
catch (FileNotFoundException e) {
} catch (FileNotFoundException e) {
log.warning("Exception while copying file: " + e.getMessage());
}
catch (IOException e) {
} catch (IOException e) {
log.warning("Exception while copying file: " + e.getMessage());
}
finally {
} finally {
if (in != null) {
try {
in.close();

View File

@ -158,10 +158,10 @@ public class WorldManager implements MVWorldManager {
try {
// don't keep the alias the same -- that would be useless
newWorld.setPropertyValue("alias", newName);
} catch (PropertyDoesNotExistException e) {
// this should never happen
throw new RuntimeException(e);
}
} catch (PropertyDoesNotExistException e) {
// this should never happen
throw new RuntimeException(e);
}
return true;
}
}