mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-28 05:35:44 +01:00
Code cleanup.
This commit is contained in:
parent
fc8876cf80
commit
b253ff5c64
@ -31,5 +31,4 @@ public class Constants {
|
|||||||
// Admin command
|
// Admin command
|
||||||
public static final String ADMINCOMMAND = "bsadmin";
|
public static final String ADMINCOMMAND = "bsadmin";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -9,6 +9,12 @@ import us.tastybento.bskyblock.BSkyBlock;
|
|||||||
|
|
||||||
public class IslandWorld {
|
public class IslandWorld {
|
||||||
|
|
||||||
|
private static final String MULTIVERSE_SET_GENERATOR = "mv modify set generator ";
|
||||||
|
private static final String MULTIVERSE_IMPORT = "mv import ";
|
||||||
|
private static final String NETHER = "_nether";
|
||||||
|
private static final String THE_END = "_the_end";
|
||||||
|
private static final String CREATING = "Creating ";
|
||||||
|
|
||||||
private BSkyBlock plugin;
|
private BSkyBlock plugin;
|
||||||
private static World islandWorld;
|
private static World islandWorld;
|
||||||
private static World netherWorld;
|
private static World netherWorld;
|
||||||
@ -24,32 +30,32 @@ public class IslandWorld {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (plugin.getServer().getWorld(plugin.getSettings().getWorldName()) == null) {
|
if (plugin.getServer().getWorld(plugin.getSettings().getWorldName()) == null) {
|
||||||
Bukkit.getLogger().info("Creating " + plugin.getName() + "'s Island World...");
|
Bukkit.getLogger().info(CREATING + plugin.getName() + "'s Island World...");
|
||||||
}
|
}
|
||||||
// Create the world if it does not exist
|
// Create the world if it does not exist
|
||||||
islandWorld = WorldCreator.name(plugin.getSettings().getWorldName()).type(WorldType.FLAT).environment(World.Environment.NORMAL).generator(new ChunkGeneratorWorld(plugin))
|
islandWorld = WorldCreator.name(plugin.getSettings().getWorldName()).type(WorldType.FLAT).environment(World.Environment.NORMAL).generator(new ChunkGeneratorWorld(plugin))
|
||||||
.createWorld();
|
.createWorld();
|
||||||
// Make the nether if it does not exist
|
// Make the nether if it does not exist
|
||||||
if (plugin.getSettings().isNetherGenerate()) {
|
if (plugin.getSettings().isNetherGenerate()) {
|
||||||
if (plugin.getServer().getWorld(plugin.getSettings().getWorldName() + "_nether") == null) {
|
if (plugin.getServer().getWorld(plugin.getSettings().getWorldName() + NETHER) == null) {
|
||||||
Bukkit.getLogger().info("Creating " + plugin.getName() + "'s Nether...");
|
Bukkit.getLogger().info(CREATING + plugin.getName() + "'s Nether...");
|
||||||
}
|
}
|
||||||
if (!plugin.getSettings().isNetherIslands()) {
|
if (!plugin.getSettings().isNetherIslands()) {
|
||||||
netherWorld = WorldCreator.name(plugin.getSettings().getWorldName() + "_nether").type(WorldType.NORMAL).environment(World.Environment.NETHER).createWorld();
|
netherWorld = WorldCreator.name(plugin.getSettings().getWorldName() + NETHER).type(WorldType.NORMAL).environment(World.Environment.NETHER).createWorld();
|
||||||
} else {
|
} else {
|
||||||
netherWorld = WorldCreator.name(plugin.getSettings().getWorldName() + "_nether").type(WorldType.FLAT).generator(new ChunkGeneratorWorld(plugin))
|
netherWorld = WorldCreator.name(plugin.getSettings().getWorldName() + NETHER).type(WorldType.FLAT).generator(new ChunkGeneratorWorld(plugin))
|
||||||
.environment(World.Environment.NETHER).createWorld();
|
.environment(World.Environment.NETHER).createWorld();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make the end if it does not exist
|
// Make the end if it does not exist
|
||||||
if (plugin.getSettings().isEndGenerate()) {
|
if (plugin.getSettings().isEndGenerate()) {
|
||||||
if (plugin.getServer().getWorld(plugin.getSettings().getWorldName() + "_the_end") == null) {
|
if (plugin.getServer().getWorld(plugin.getSettings().getWorldName() + THE_END) == null) {
|
||||||
Bukkit.getLogger().info("Creating " + plugin.getName() + "'s End World...");
|
Bukkit.getLogger().info(CREATING + plugin.getName() + "'s End World...");
|
||||||
}
|
}
|
||||||
if (!plugin.getSettings().isEndIslands()) {
|
if (!plugin.getSettings().isEndIslands()) {
|
||||||
endWorld = WorldCreator.name(plugin.getSettings().getWorldName() + "_the_end").type(WorldType.NORMAL).environment(World.Environment.THE_END).createWorld();
|
endWorld = WorldCreator.name(plugin.getSettings().getWorldName() + THE_END).type(WorldType.NORMAL).environment(World.Environment.THE_END).createWorld();
|
||||||
} else {
|
} else {
|
||||||
endWorld = WorldCreator.name(plugin.getSettings().getWorldName() + "_the_end").type(WorldType.FLAT).generator(new ChunkGeneratorWorld(plugin))
|
endWorld = WorldCreator.name(plugin.getSettings().getWorldName() + THE_END).type(WorldType.FLAT).generator(new ChunkGeneratorWorld(plugin))
|
||||||
.environment(World.Environment.THE_END).createWorld();
|
.environment(World.Environment.THE_END).createWorld();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,22 +68,22 @@ public class IslandWorld {
|
|||||||
Bukkit.getLogger().info("Trying to register generator with Multiverse ");
|
Bukkit.getLogger().info("Trying to register generator with Multiverse ");
|
||||||
try {
|
try {
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
||||||
"mv import " + plugin.getSettings().getWorldName() + " normal -g " + plugin.getName());
|
MULTIVERSE_IMPORT + plugin.getSettings().getWorldName() + " normal -g " + plugin.getName());
|
||||||
if (!Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
if (!Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
||||||
"mv modify set generator " + plugin.getName() + " " + plugin.getSettings().getWorldName())) {
|
MULTIVERSE_SET_GENERATOR + plugin.getName() + " " + plugin.getSettings().getWorldName())) {
|
||||||
Bukkit.getLogger().severe("Multiverse is out of date! - Upgrade to latest version!");
|
Bukkit.getLogger().severe("Multiverse is out of date! - Upgrade to latest version!");
|
||||||
}
|
}
|
||||||
if (netherWorld != null && plugin.getSettings().isNetherGenerate() && plugin.getSettings().isNetherIslands()) {
|
if (netherWorld != null && plugin.getSettings().isNetherGenerate() && plugin.getSettings().isNetherIslands()) {
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
||||||
"mv import " + plugin.getSettings().getWorldName() + "_nether nether -g " + plugin.getName());
|
MULTIVERSE_IMPORT + plugin.getSettings().getWorldName() + "_nether nether -g " + plugin.getName());
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
||||||
"mv modify set generator " + plugin.getName() + " " + plugin.getSettings().getWorldName() + "_nether");
|
MULTIVERSE_SET_GENERATOR + plugin.getName() + " " + plugin.getSettings().getWorldName() + NETHER);
|
||||||
}
|
}
|
||||||
if (endWorld != null && plugin.getSettings().isEndGenerate() && plugin.getSettings().isEndIslands()) {
|
if (endWorld != null && plugin.getSettings().isEndGenerate() && plugin.getSettings().isEndIslands()) {
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
||||||
"mv import " + plugin.getSettings().getWorldName() + "_the_end end -g " + plugin.getName());
|
MULTIVERSE_IMPORT + plugin.getSettings().getWorldName() + "_the_end end -g " + plugin.getName());
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
||||||
"mv modify set generator " + plugin.getName() + " " + plugin.getSettings().getWorldName() + "_the_end");
|
MULTIVERSE_SET_GENERATOR + plugin.getName() + " " + plugin.getSettings().getWorldName() + THE_END);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Bukkit.getLogger().severe("Not successfull! Disabling " + plugin.getName() + "!");
|
Bukkit.getLogger().severe("Not successfull! Disabling " + plugin.getName() + "!");
|
||||||
@ -103,7 +109,7 @@ public class IslandWorld {
|
|||||||
*/
|
*/
|
||||||
public World getNetherWorld() {
|
public World getNetherWorld() {
|
||||||
if (plugin.getSettings().isUseOwnGenerator()) {
|
if (plugin.getSettings().isUseOwnGenerator()) {
|
||||||
return Bukkit.getServer().getWorld(plugin.getSettings().getWorldName() + "_nether");
|
return Bukkit.getServer().getWorld(plugin.getSettings().getWorldName() + NETHER);
|
||||||
}
|
}
|
||||||
return netherWorld;
|
return netherWorld;
|
||||||
}
|
}
|
||||||
@ -113,7 +119,7 @@ public class IslandWorld {
|
|||||||
*/
|
*/
|
||||||
public World getEndWorld() {
|
public World getEndWorld() {
|
||||||
if (plugin.getSettings().isUseOwnGenerator()) {
|
if (plugin.getSettings().isUseOwnGenerator()) {
|
||||||
return Bukkit.getServer().getWorld(plugin.getSettings().getWorldName() + "_the_end");
|
return Bukkit.getServer().getWorld(plugin.getSettings().getWorldName() + THE_END);
|
||||||
}
|
}
|
||||||
return endWorld;
|
return endWorld;
|
||||||
}
|
}
|
||||||
|
@ -124,8 +124,7 @@ public final class AddonsManager {
|
|||||||
|
|
||||||
File localeDir = new File(plugin.getDataFolder(), LOCALE_FOLDER + File.separator + addon.getDescription().getName());
|
File localeDir = new File(plugin.getDataFolder(), LOCALE_FOLDER + File.separator + addon.getDescription().getName());
|
||||||
// Obtain any locale files and save them
|
// Obtain any locale files and save them
|
||||||
for (String localeFile : listJarYamlFiles(jar, "locales")) {
|
for (String localeFile : listJarYamlFiles(jar, LOCALE_FOLDER)) {
|
||||||
//plugin.getLogger().info("DEBUG: saving " + localeFile + " from jar");
|
|
||||||
addon.saveResource(localeFile, localeDir, false, true);
|
addon.saveResource(localeFile, localeDir, false, true);
|
||||||
}
|
}
|
||||||
plugin.getLocalesManager().loadLocales(addon.getDescription().getName());
|
plugin.getLocalesManager().loadLocales(addon.getDescription().getName());
|
||||||
|
@ -23,8 +23,6 @@ import us.tastybento.bskyblock.database.objects.Island;
|
|||||||
*/
|
*/
|
||||||
public class SafeSpotTeleport {
|
public class SafeSpotTeleport {
|
||||||
|
|
||||||
//private NMSAbstraction nms;
|
|
||||||
//private BSkyBlock plugin;
|
|
||||||
/**
|
/**
|
||||||
* Teleport to a safe place and if it fails, show a failure message
|
* Teleport to a safe place and if it fails, show a failure message
|
||||||
* @param plugin
|
* @param plugin
|
||||||
@ -58,6 +56,8 @@ public class SafeSpotTeleport {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Teleport to a safe spot on an island
|
* Teleport to a safe spot on an island
|
||||||
|
*
|
||||||
|
* TODO: REFACTOR THIS!
|
||||||
|
|
||||||
* @param plugin
|
* @param plugin
|
||||||
* @param entity
|
* @param entity
|
||||||
|
Loading…
Reference in New Issue
Block a user