mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-08 09:17:38 +01:00
dat style
CheckStyle is merciless!
This commit is contained in:
parent
a9a5d7467a
commit
48adbec011
@ -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_TOLERANCE = 16;
|
||||||
private static final int SPAWN_LOCATION_SEARCH_RADIUS = 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 {
|
static {
|
||||||
propertyAliases = new HashMap<String, String>();
|
PROPERTY_ALIASES = new HashMap<String, String>();
|
||||||
propertyAliases.put("curr", "currency");
|
PROPERTY_ALIASES.put("curr", "currency");
|
||||||
propertyAliases.put("scaling", "scale");
|
PROPERTY_ALIASES.put("scaling", "scale");
|
||||||
propertyAliases.put("aliascolor", "color");
|
PROPERTY_ALIASES.put("aliascolor", "color");
|
||||||
propertyAliases.put("heal", "autoHeal");
|
PROPERTY_ALIASES.put("heal", "autoHeal");
|
||||||
propertyAliases.put("storm", "allowWeather");
|
PROPERTY_ALIASES.put("storm", "allowWeather");
|
||||||
propertyAliases.put("weather", "allowWeather");
|
PROPERTY_ALIASES.put("weather", "allowWeather");
|
||||||
propertyAliases.put("spawnmemory", "keepSpawnInMemory");
|
PROPERTY_ALIASES.put("spawnmemory", "keepSpawnInMemory");
|
||||||
propertyAliases.put("memory", "keepSpawnInMemory");
|
PROPERTY_ALIASES.put("memory", "keepSpawnInMemory");
|
||||||
propertyAliases.put("mode", "gameMode");
|
PROPERTY_ALIASES.put("mode", "gameMode");
|
||||||
propertyAliases.put("diff", "difficulty");
|
PROPERTY_ALIASES.put("diff", "difficulty");
|
||||||
propertyAliases.put("spawnlocation", "spawn");
|
PROPERTY_ALIASES.put("spawnlocation", "spawn");
|
||||||
propertyAliases.put("animals", "spawning.animals.spawn");
|
PROPERTY_ALIASES.put("animals", "spawning.animals.spawn");
|
||||||
propertyAliases.put("monsters", "spawning.monsters.spawn");
|
PROPERTY_ALIASES.put("monsters", "spawning.monsters.spawn");
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* We have to use setCBWorld(), setPlugin() and initPerms() to prepare this object for use.
|
* 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;
|
private boolean bedRespawn;
|
||||||
@Property
|
@Property
|
||||||
private List<String> worldBlacklist;
|
private List<String> worldBlacklist;
|
||||||
@SuppressWarnings("unused") // it IS used!
|
|
||||||
@Property(serializor = TimePropertySerializor.class, virtualType = Long.class,
|
@Property(serializor = TimePropertySerializor.class, virtualType = Long.class,
|
||||||
description = "Set the time to whatever you want! (Will NOT freeze time)")
|
description = "Set the time to whatever you want! (Will NOT freeze time)")
|
||||||
private VirtualProperty<Long> time = new VirtualProperty<Long>() {
|
private VirtualProperty<Long> time = new VirtualProperty<Long>() {
|
||||||
@ -666,7 +665,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
|
|||||||
* @see SerializationConfig
|
* @see SerializationConfig
|
||||||
*/
|
*/
|
||||||
protected static Map<String, String> getAliases() {
|
protected static Map<String, String> getAliases() {
|
||||||
return propertyAliases;
|
return PROPERTY_ALIASES;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double getDefaultScale(Environment environment) {
|
private static double getDefaultScale(Environment environment) {
|
||||||
|
@ -17,7 +17,6 @@ import com.onarandombox.MultiverseCore.api.MVPlugin;
|
|||||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||||
import com.onarandombox.MultiverseCore.api.MultiverseCoreConfig;
|
import com.onarandombox.MultiverseCore.api.MultiverseCoreConfig;
|
||||||
import com.onarandombox.MultiverseCore.api.MultiverseMessaging;
|
import com.onarandombox.MultiverseCore.api.MultiverseMessaging;
|
||||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
|
||||||
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
|
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
|
||||||
import com.onarandombox.MultiverseCore.commands.AnchorCommand;
|
import com.onarandombox.MultiverseCore.commands.AnchorCommand;
|
||||||
import com.onarandombox.MultiverseCore.commands.CheckCommand;
|
import com.onarandombox.MultiverseCore.commands.CheckCommand;
|
||||||
@ -97,7 +96,6 @@ import java.util.HashMap;
|
|||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
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() {
|
private void initializeBuscript() {
|
||||||
buscript = new Buscript(this);
|
buscript = new Buscript(this);
|
||||||
@ -435,11 +433,11 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
|||||||
/**
|
/**
|
||||||
* Migrate the worlds.yml to SerializationConfig.
|
* Migrate the worlds.yml to SerializationConfig.
|
||||||
*/
|
*/
|
||||||
private void migrateWorldConfig() {
|
private void migrateWorldConfig() { // SUPPRESS CHECKSTYLE: MethodLength
|
||||||
FileConfiguration wconf = YamlConfiguration
|
FileConfiguration wconf = YamlConfiguration
|
||||||
.loadConfiguration(new File(getDataFolder(), "worlds.yml"));
|
.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!");
|
this.log(Level.FINE, "No worlds to migrate!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,6 @@ public interface MVWorldManager {
|
|||||||
*
|
*
|
||||||
* @param oldName Name of world to be copied
|
* @param oldName Name of world to be copied
|
||||||
* @param newName Name of world to be created
|
* @param newName Name of world to be created
|
||||||
* @param env Environment Type
|
|
||||||
* @param generator The Custom generator plugin to use.
|
* @param generator The Custom generator plugin to use.
|
||||||
* @return True if the world is copied successfully, false if not.
|
* @return True if the world is copied successfully, false if not.
|
||||||
*/
|
*/
|
||||||
|
@ -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 + "world" + ChatColor.GREEN + " world_backup");
|
||||||
this.addCommandExample("/mv clone " + ChatColor.GOLD + "skyblock_pristine" + ChatColor.GREEN + " skyblock");
|
this.addCommandExample("/mv clone " + ChatColor.GOLD + "skyblock_pristine" + ChatColor.GREEN + " skyblock");
|
||||||
this.addCommandExample("To clone a world that uses a generator:");
|
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.setPermission("multiverse.core.clone", "Clones a world.", PermissionDefault.OP);
|
||||||
this.worldManager = this.plugin.getMVWorldManager();
|
this.worldManager = this.plugin.getMVWorldManager();
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
package com.onarandombox.MultiverseCore.commands;
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
|
||||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -22,7 +22,6 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerPortalEvent;
|
import org.bukkit.event.player.PlayerPortalEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
@ -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) {
|
public static boolean copyFolder(File source, File target, Logger log) {
|
||||||
InputStream in = null;
|
InputStream in = null;
|
||||||
@ -64,26 +69,22 @@ public class FileUtils {
|
|||||||
for (String child : children) {
|
for (String child : children) {
|
||||||
copyFolder(new File(source, child), new File(target, child), log);
|
copyFolder(new File(source, child), new File(target, child), log);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
in = new FileInputStream(source);
|
in = new FileInputStream(source);
|
||||||
out = new FileOutputStream(target);
|
out = new FileOutputStream(target);
|
||||||
|
|
||||||
byte[] buf = new byte[1024];
|
byte[] buf = new byte[COPY_BLOCK_SIZE];
|
||||||
int len;
|
int len;
|
||||||
while ((len = in.read(buf)) > 0) {
|
while ((len = in.read(buf)) > 0) {
|
||||||
out.write(buf, 0, len);
|
out.write(buf, 0, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
} catch (FileNotFoundException e) {
|
||||||
catch (FileNotFoundException e) {
|
|
||||||
log.warning("Exception while copying file: " + e.getMessage());
|
log.warning("Exception while copying file: " + e.getMessage());
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
log.warning("Exception while copying file: " + e.getMessage());
|
log.warning("Exception while copying file: " + e.getMessage());
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
try {
|
try {
|
||||||
in.close();
|
in.close();
|
||||||
|
@ -158,10 +158,10 @@ public class WorldManager implements MVWorldManager {
|
|||||||
try {
|
try {
|
||||||
// don't keep the alias the same -- that would be useless
|
// don't keep the alias the same -- that would be useless
|
||||||
newWorld.setPropertyValue("alias", newName);
|
newWorld.setPropertyValue("alias", newName);
|
||||||
} catch (PropertyDoesNotExistException e) {
|
} catch (PropertyDoesNotExistException e) {
|
||||||
// this should never happen
|
// this should never happen
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user