mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Check out PlotWorld.java
This commit is contained in:
parent
75a5a76fe9
commit
5885badc23
@ -110,11 +110,13 @@ public class PlotMain extends JavaPlugin {
|
|||||||
/**
|
/**
|
||||||
* All loaded plot worlds
|
* All loaded plot worlds
|
||||||
*/
|
*/
|
||||||
private final static HashMap<String, PlotWorld> worlds = new HashMap<>();
|
private final static HashMap<String, PlotWorld> worlds =
|
||||||
|
new HashMap<>();
|
||||||
/**
|
/**
|
||||||
* All world managers
|
* All world managers
|
||||||
*/
|
*/
|
||||||
private final static HashMap<String, PlotManager> managers = new HashMap<>();
|
private final static HashMap<String, PlotManager> managers =
|
||||||
|
new HashMap<>();
|
||||||
/**
|
/**
|
||||||
* settings.properties
|
* settings.properties
|
||||||
*/
|
*/
|
||||||
@ -962,7 +964,6 @@ public class PlotMain extends JavaPlugin {
|
|||||||
|
|
||||||
for (final ConfigurationNode setting : plotworld.getSettingNodes()) {
|
for (final ConfigurationNode setting : plotworld.getSettingNodes()) {
|
||||||
options.put(setting.getConstant(), setting.getValue());
|
options.put(setting.getConstant(), setting.getValue());
|
||||||
//TODO: Make jesse explain wth was going on here
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Entry<String, Object> node : options.entrySet()) {
|
for (final Entry<String, Object> node : options.entrySet()) {
|
||||||
@ -1321,20 +1322,20 @@ public class PlotMain extends JavaPlugin {
|
|||||||
/**
|
/**
|
||||||
* Set all plots
|
* Set all plots
|
||||||
*
|
*
|
||||||
* @param plots New Plot HashMap
|
* @param plots New Plot LinkedHashMap
|
||||||
*/
|
*/
|
||||||
public static void setAllPlotsRaw(final HashMap<String, HashMap<PlotId, Plot>> plots) {
|
public static void setAllPlotsRaw(final LinkedHashMap<String, HashMap<PlotId, Plot>> plots) {
|
||||||
PlotMain.plots = new LinkedHashMap<>(plots);
|
PlotMain.plots = plots;
|
||||||
// PlotMain.plots.putAll(plots);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set all plots
|
* Set all plots
|
||||||
*
|
*
|
||||||
* @param plots New Plot LinkedHashMap
|
* @param plots New Plot HashMap
|
||||||
*/
|
*/
|
||||||
public static void setAllPlotsRaw(final LinkedHashMap<String, HashMap<PlotId, Plot>> plots) {
|
public static void setAllPlotsRaw(final HashMap<String, HashMap<PlotId, Plot>> plots) {
|
||||||
PlotMain.plots = plots;
|
PlotMain.plots = new LinkedHashMap<>(plots);
|
||||||
|
// PlotMain.plots.putAll(plots);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1377,11 +1378,8 @@ public class PlotMain extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
final public void onEnable() {
|
final public void onEnable() {
|
||||||
// Pre-Steps
|
// Setup the logger mechanics
|
||||||
{
|
|
||||||
// Init the logger
|
|
||||||
setupLogger();
|
setupLogger();
|
||||||
|
|
||||||
// Check for outdated java version.
|
// Check for outdated java version.
|
||||||
if (getJavaVersion() < 1.7) {
|
if (getJavaVersion() < 1.7) {
|
||||||
sendConsoleSenderMessage(C.PREFIX.s() + "&cYour java version is outdated. Please update to at least 1.7.");
|
sendConsoleSenderMessage(C.PREFIX.s() + "&cYour java version is outdated. Please update to at least 1.7.");
|
||||||
@ -1389,14 +1387,13 @@ public class PlotMain extends JavaPlugin {
|
|||||||
sendConsoleSenderMessage(C.PREFIX.s() + "&cURL: &6https://java.com/en/download/index.jsp");
|
sendConsoleSenderMessage(C.PREFIX.s() + "&cURL: &6https://java.com/en/download/index.jsp");
|
||||||
Bukkit.getPluginManager().disablePlugin(this);
|
Bukkit.getPluginManager().disablePlugin(this);
|
||||||
return;
|
return;
|
||||||
|
} else if (getJavaVersion() < 1.8) {
|
||||||
|
sendConsoleSenderMessage(C.PREFIX.s() + "&cIt's really recommended to run Java 1.8, as it increases performance");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Setup configurations
|
// Setup configurations
|
||||||
C.setupTranslations();
|
C.setupTranslations();
|
||||||
// Setup configuration
|
// Setup configuration
|
||||||
configs();
|
configs();
|
||||||
|
|
||||||
// Setup metrics
|
// Setup metrics
|
||||||
if (Settings.METRICS) {
|
if (Settings.METRICS) {
|
||||||
try {
|
try {
|
||||||
@ -1410,13 +1407,10 @@ public class PlotMain extends JavaPlugin {
|
|||||||
// We should at least make them feel bad.
|
// We should at least make them feel bad.
|
||||||
sendConsoleSenderMessage("Using metrics will allow us to improve the plugin\nPlease consider it :)");
|
sendConsoleSenderMessage("Using metrics will allow us to improve the plugin\nPlease consider it :)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kill mobs on roads?
|
// Kill mobs on roads?
|
||||||
if (Settings.KILL_ROAD_MOBS) {
|
if (Settings.KILL_ROAD_MOBS) {
|
||||||
killAllEntities();
|
killAllEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enabled<3
|
|
||||||
if (C.ENABLED.s().length() > 0) {
|
if (C.ENABLED.s().length() > 0) {
|
||||||
Broadcast(C.ENABLED);
|
Broadcast(C.ENABLED);
|
||||||
}
|
}
|
||||||
@ -1602,6 +1596,10 @@ public class PlotMain extends JavaPlugin {
|
|||||||
// Looks really cool xD
|
// Looks really cool xD
|
||||||
getUUIDSaver().globalPopulate();
|
getUUIDSaver().globalPopulate();
|
||||||
}
|
}
|
||||||
|
// Now we're finished :D
|
||||||
|
if (C.ENABLED.s().length() > 0) {
|
||||||
|
Broadcast(C.ENABLED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,8 +36,6 @@ public enum Command {
|
|||||||
// (Rating system) (ratings can be stored as the average, and number of
|
// (Rating system) (ratings can be stored as the average, and number of
|
||||||
// ratings)
|
// ratings)
|
||||||
// - /plot rate <number out of 10>
|
// - /plot rate <number out of 10>
|
||||||
// - /plot list <some parameter to list the most popular, and highest rated
|
|
||||||
// plots>
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -434,10 +434,6 @@ public enum C {
|
|||||||
if (manager == null) {
|
if (manager == null) {
|
||||||
manager = new TranslationManager();
|
manager = new TranslationManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: generating a blank file
|
|
||||||
// FIXME: translations aren't customizable
|
|
||||||
// FIXME: Some messages still have the %arg stuff in them
|
|
||||||
if (defaultFile == null) {
|
if (defaultFile == null) {
|
||||||
defaultFile = new YamlTranslationFile(BukkitTranslation.getParent(PlotMain.getPlugin(PlotMain.class)), lang, "PlotSquared", manager)
|
defaultFile = new YamlTranslationFile(BukkitTranslation.getParent(PlotMain.getPlugin(PlotMain.class)), lang, "PlotSquared", manager)
|
||||||
.read();
|
.read();
|
||||||
|
@ -28,22 +28,14 @@ import org.bukkit.block.Biome;
|
|||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.bukkit.Material.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jesse Boyd
|
* @author Jesse Boyd
|
||||||
*/
|
*/
|
||||||
public abstract class PlotWorld {
|
public abstract class PlotWorld {
|
||||||
|
|
||||||
// TODO make this configurable
|
|
||||||
// make non static and static_default_valu + add config option
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public final static ArrayList<Material> BLOCKS = new ArrayList<>(Arrays.asList(new Material[]{ACACIA_STAIRS, BEACON, BEDROCK, BIRCH_WOOD_STAIRS, BOOKSHELF, BREWING_STAND, BRICK, BRICK_STAIRS, BURNING_FURNACE, CAKE_BLOCK, CAULDRON, CLAY_BRICK, CLAY, COAL_BLOCK, COAL_ORE, COBBLE_WALL, COBBLESTONE, COBBLESTONE_STAIRS, COMMAND, DARK_OAK_STAIRS, DAYLIGHT_DETECTOR, DIAMOND_ORE, DIAMOND_BLOCK, DIRT, DISPENSER, DROPPER, EMERALD_BLOCK, EMERALD_ORE, ENCHANTMENT_TABLE, ENDER_PORTAL_FRAME, ENDER_STONE, FURNACE, GLOWSTONE, GOLD_ORE, GOLD_BLOCK, GRASS, GRAVEL, GLASS, HARD_CLAY, HAY_BLOCK, HUGE_MUSHROOM_1, HUGE_MUSHROOM_2, IRON_BLOCK, IRON_ORE, JACK_O_LANTERN, JUKEBOX, JUNGLE_WOOD_STAIRS, LAPIS_BLOCK, LAPIS_ORE, LEAVES, LEAVES_2, LOG, LOG_2, MELON_BLOCK, MOB_SPAWNER, MOSSY_COBBLESTONE, MYCEL, NETHER_BRICK, NETHER_BRICK_STAIRS, NETHERRACK, NOTE_BLOCK, OBSIDIAN, PACKED_ICE, PUMPKIN, QUARTZ_BLOCK, QUARTZ_ORE, QUARTZ_STAIRS, REDSTONE_BLOCK, SANDSTONE, SAND,
|
|
||||||
SANDSTONE_STAIRS, SMOOTH_BRICK, SMOOTH_STAIRS, SNOW_BLOCK, SOUL_SAND, SPONGE, SPRUCE_WOOD_STAIRS, STONE, WOOD, WOOD_STAIRS, WORKBENCH, WOOL, getMaterial(44), getMaterial(126)}));
|
|
||||||
public final static boolean AUTO_MERGE_DEFAULT = false;
|
public final static boolean AUTO_MERGE_DEFAULT = false;
|
||||||
public final static boolean MOB_SPAWNING_DEFAULT = false;
|
public final static boolean MOB_SPAWNING_DEFAULT = false;
|
||||||
public final static Biome PLOT_BIOME_DEFAULT = Biome.FOREST;
|
public final static Biome PLOT_BIOME_DEFAULT = Biome.FOREST;
|
||||||
@ -62,6 +54,64 @@ public abstract class PlotWorld {
|
|||||||
public final static boolean SPAWN_EGGS_DEFAULT = false;
|
public final static boolean SPAWN_EGGS_DEFAULT = false;
|
||||||
public final static boolean SPAWN_CUSTOM_DEFAULT = true;
|
public final static boolean SPAWN_CUSTOM_DEFAULT = true;
|
||||||
public final static boolean SPAWN_BREEDING_DEFAULT = false;
|
public final static boolean SPAWN_BREEDING_DEFAULT = false;
|
||||||
|
// TODO make this configurable
|
||||||
|
// make non static and static_default_valu + add config option
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public static List<Material> BLOCKS; /*= new ArrayList<>(
|
||||||
|
Arrays.asList(
|
||||||
|
new Material[]{
|
||||||
|
ACACIA_STAIRS, BEACON,
|
||||||
|
BEDROCK, BIRCH_WOOD_STAIRS,
|
||||||
|
BOOKSHELF, BREWING_STAND,
|
||||||
|
BRICK, BRICK_STAIRS,
|
||||||
|
BURNING_FURNACE, CAKE_BLOCK,
|
||||||
|
CAULDRON, CLAY_BRICK,
|
||||||
|
CLAY, COAL_BLOCK,
|
||||||
|
COAL_ORE, COBBLE_WALL,
|
||||||
|
COBBLESTONE, COBBLESTONE_STAIRS,
|
||||||
|
COMMAND, DARK_OAK_STAIRS,
|
||||||
|
DAYLIGHT_DETECTOR, DIAMOND_ORE,
|
||||||
|
DIAMOND_BLOCK, DIRT,
|
||||||
|
DISPENSER, DROPPER,
|
||||||
|
EMERALD_BLOCK, EMERALD_ORE,
|
||||||
|
ENCHANTMENT_TABLE, ENDER_PORTAL_FRAME,
|
||||||
|
ENDER_STONE, FURNACE,
|
||||||
|
GLOWSTONE, GOLD_ORE,
|
||||||
|
GOLD_BLOCK, GRASS, GRAVEL, GLASS,
|
||||||
|
HARD_CLAY, HAY_BLOCK,
|
||||||
|
HUGE_MUSHROOM_1, HUGE_MUSHROOM_2,
|
||||||
|
IRON_BLOCK, IRON_ORE,
|
||||||
|
JACK_O_LANTERN, JUKEBOX,
|
||||||
|
JUNGLE_WOOD_STAIRS, LAPIS_BLOCK,
|
||||||
|
LAPIS_ORE, LEAVES,
|
||||||
|
LEAVES_2, LOG, LOG_2,
|
||||||
|
MELON_BLOCK, MOB_SPAWNER,
|
||||||
|
MOSSY_COBBLESTONE, MYCEL,
|
||||||
|
NETHER_BRICK, NETHER_BRICK_STAIRS,
|
||||||
|
NETHERRACK, NOTE_BLOCK,
|
||||||
|
OBSIDIAN, PACKED_ICE,
|
||||||
|
PUMPKIN, QUARTZ_BLOCK,
|
||||||
|
QUARTZ_ORE, QUARTZ_STAIRS,
|
||||||
|
REDSTONE_BLOCK, SANDSTONE,
|
||||||
|
SAND, SANDSTONE_STAIRS,
|
||||||
|
SMOOTH_BRICK, SMOOTH_STAIRS,
|
||||||
|
SNOW_BLOCK, SOUL_SAND,
|
||||||
|
SPONGE, SPRUCE_WOOD_STAIRS,
|
||||||
|
STONE, WOOD,
|
||||||
|
WOOD_STAIRS, WORKBENCH,
|
||||||
|
WOOL, getMaterial(44), getMaterial(126)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);*/
|
||||||
|
|
||||||
|
static {
|
||||||
|
// TODO: Let jesse decide if this is stupid or not
|
||||||
|
BLOCKS = new ArrayList<>();
|
||||||
|
for (Material material : Material.values()) {
|
||||||
|
if (material.isBlock() && material.isSolid())
|
||||||
|
BLOCKS.add(material);
|
||||||
|
}
|
||||||
|
}
|
||||||
public final String worldname;
|
public final String worldname;
|
||||||
public boolean AUTO_MERGE;
|
public boolean AUTO_MERGE;
|
||||||
public boolean MOB_SPAWNING;
|
public boolean MOB_SPAWNING;
|
||||||
|
Loading…
Reference in New Issue
Block a user