mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Added some docs
This commit is contained in:
parent
9ebb277ff0
commit
2c01982a48
@ -115,6 +115,7 @@ public class SlimefunStartup extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Looks like you are using an unsupported Minecraft Version
|
||||||
if (!compatibleVersion) {
|
if (!compatibleVersion) {
|
||||||
System.err.println("### Slimefun failed to load!");
|
System.err.println("### Slimefun failed to load!");
|
||||||
System.err.println("###");
|
System.err.println("###");
|
||||||
@ -139,18 +140,21 @@ public class SlimefunStartup extends JavaPlugin {
|
|||||||
utils = new PluginUtils(this);
|
utils = new PluginUtils(this);
|
||||||
utils.setupConfig();
|
utils.setupConfig();
|
||||||
|
|
||||||
|
// Loading all extra configs
|
||||||
researches = new Config(Files.RESEARCHES);
|
researches = new Config(Files.RESEARCHES);
|
||||||
items = new Config(Files.ITEMS);
|
items = new Config(Files.ITEMS);
|
||||||
whitelist = new Config(Files.WHITELIST);
|
whitelist = new Config(Files.WHITELIST);
|
||||||
|
|
||||||
|
// Init Config, Updater, Metrics and messages.yml
|
||||||
utils.setupUpdater(53485, getFile());
|
utils.setupUpdater(53485, getFile());
|
||||||
utils.setupMetrics();
|
utils.setupMetrics();
|
||||||
utils.setupLocalization();
|
utils.setupLocalization();
|
||||||
|
|
||||||
config = utils.getConfig();
|
config = utils.getConfig();
|
||||||
Messages.local = utils.getLocalization();
|
Messages.local = utils.getLocalization();
|
||||||
Messages.setup();
|
Messages.setup();
|
||||||
|
|
||||||
|
// Creating all necessary Folders
|
||||||
|
// TODO: Make a shortcut method such as createDir(path)
|
||||||
if (!new File("data-storage/Slimefun/blocks").exists()) new File("data-storage/Slimefun/blocks").mkdirs();
|
if (!new File("data-storage/Slimefun/blocks").exists()) new File("data-storage/Slimefun/blocks").mkdirs();
|
||||||
if (!new File("data-storage/Slimefun/stored-blocks").exists()) new File("data-storage/Slimefun/stored-blocks").mkdirs();
|
if (!new File("data-storage/Slimefun/stored-blocks").exists()) new File("data-storage/Slimefun/stored-blocks").mkdirs();
|
||||||
if (!new File("data-storage/Slimefun/stored-inventories").exists()) new File("data-storage/Slimefun/stored-inventories").mkdirs();
|
if (!new File("data-storage/Slimefun/stored-inventories").exists()) new File("data-storage/Slimefun/stored-inventories").mkdirs();
|
||||||
@ -181,6 +185,8 @@ public class SlimefunStartup extends JavaPlugin {
|
|||||||
BlockStorage.info_delay = config.getInt("URID.info-delay");
|
BlockStorage.info_delay = config.getInt("URID.info-delay");
|
||||||
|
|
||||||
System.out.println("[Slimefun] Loading World Generators...");
|
System.out.println("[Slimefun] Loading World Generators...");
|
||||||
|
|
||||||
|
// Generating Oil as an OreGenResource (its a cool API)
|
||||||
OreGenSystem.registerResource(new OreGenResource() {
|
OreGenSystem.registerResource(new OreGenResource() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -262,6 +268,7 @@ public class SlimefunStartup extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// All Slimefun Listeners
|
||||||
new ArmorListener(this);
|
new ArmorListener(this);
|
||||||
new ItemListener(this);
|
new ItemListener(this);
|
||||||
new BlockListener(this);
|
new BlockListener(this);
|
||||||
@ -274,10 +281,13 @@ public class SlimefunStartup extends JavaPlugin {
|
|||||||
new TeleporterListener(this);
|
new TeleporterListener(this);
|
||||||
new AndroidKillingListener(this);
|
new AndroidKillingListener(this);
|
||||||
|
|
||||||
|
// Toggleable Listeners for performance
|
||||||
if (config.getBoolean("items.talismans")) new TalismanListener(this);
|
if (config.getBoolean("items.talismans")) new TalismanListener(this);
|
||||||
if (config.getBoolean("items.backpacks")) new BackpackListener(this);
|
if (config.getBoolean("items.backpacks")) new BackpackListener(this);
|
||||||
if (config.getBoolean("items.coolers")) new CoolerListener(this);
|
if (config.getBoolean("items.coolers")) new CoolerListener(this);
|
||||||
|
|
||||||
|
// Handle Slimefun Guide being given on Join
|
||||||
|
// TODO: Move it to its own class, was too lazy
|
||||||
if (config.getBoolean("options.give-guide-on-first-join")) {
|
if (config.getBoolean("options.give-guide-on-first-join")) {
|
||||||
getServer().getPluginManager().registerEvents(new Listener() {
|
getServer().getPluginManager().registerEvents(new Listener() {
|
||||||
|
|
||||||
@ -293,7 +303,9 @@ public class SlimefunStartup extends JavaPlugin {
|
|||||||
|
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load/Unload Worlds in Slimefun
|
||||||
|
// TODO: Move it to its own class, was too lazy
|
||||||
getServer().getPluginManager().registerEvents(new Listener() {
|
getServer().getPluginManager().registerEvents(new Listener() {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -314,6 +326,8 @@ public class SlimefunStartup extends JavaPlugin {
|
|||||||
|
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
// Clear the Slimefun Guide History upon Player Leaving
|
||||||
|
// TODO: Move it to its own class, was too lazy
|
||||||
getServer().getPluginManager().registerEvents(new Listener() {
|
getServer().getPluginManager().registerEvents(new Listener() {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -323,6 +337,7 @@ public class SlimefunStartup extends JavaPlugin {
|
|||||||
|
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
// Initiating various Stuff and all Items with a slightly delay (0ms after the Server finished loading)
|
||||||
getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -338,6 +353,7 @@ public class SlimefunStartup extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
|
// WorldEdit Hook to clear Slimefun Data upon //set 0 //cut or any other equivalent
|
||||||
if (getServer().getPluginManager().isPluginEnabled("WorldEdit")) {
|
if (getServer().getPluginManager().isPluginEnabled("WorldEdit")) {
|
||||||
try {
|
try {
|
||||||
Class.forName("com.sk89q.worldedit.extent.Extent");
|
Class.forName("com.sk89q.worldedit.extent.Extent");
|
||||||
@ -352,6 +368,7 @@ public class SlimefunStartup extends JavaPlugin {
|
|||||||
getCommand("slimefun").setExecutor(new SlimefunCommand(this));
|
getCommand("slimefun").setExecutor(new SlimefunCommand(this));
|
||||||
getCommand("slimefun").setTabCompleter(new SlimefunTabCompleter());
|
getCommand("slimefun").setTabCompleter(new SlimefunTabCompleter());
|
||||||
|
|
||||||
|
// Armor Update Task
|
||||||
if (config.getBoolean("options.enable-armor-effects")) {
|
if (config.getBoolean("options.enable-armor-effects")) {
|
||||||
getServer().getScheduler().runTaskTimer(this, new Runnable() {
|
getServer().getScheduler().runTaskTimer(this, new Runnable() {
|
||||||
|
|
||||||
@ -402,15 +419,18 @@ public class SlimefunStartup extends JavaPlugin {
|
|||||||
|
|
||||||
ticker = new TickerTask();
|
ticker = new TickerTask();
|
||||||
|
|
||||||
|
// Starting all ASYNC Tasks
|
||||||
getServer().getScheduler().scheduleAsyncRepeatingTask(this, new AutoSavingTask(), 1200L, config.getInt("options.auto-save-delay-in-minutes") * 60L * 20L);
|
getServer().getScheduler().scheduleAsyncRepeatingTask(this, new AutoSavingTask(), 1200L, config.getInt("options.auto-save-delay-in-minutes") * 60L * 20L);
|
||||||
getServer().getScheduler().scheduleAsyncRepeatingTask(this, ticker, 100L, config.getInt("URID.custom-ticker-delay"));
|
getServer().getScheduler().scheduleAsyncRepeatingTask(this, ticker, 100L, config.getInt("URID.custom-ticker-delay"));
|
||||||
|
|
||||||
|
// Hooray!
|
||||||
System.out.println("[Slimefun] Finished!");
|
System.out.println("[Slimefun] Finished!");
|
||||||
|
|
||||||
clearlag = getServer().getPluginManager().isPluginEnabled("ClearLag");
|
clearlag = getServer().getPluginManager().isPluginEnabled("ClearLag");
|
||||||
|
|
||||||
if (clearlag) new ClearLaggIntegration(this);
|
if (clearlag) new ClearLaggIntegration(this);
|
||||||
|
|
||||||
|
// Do not show /sf elevator command in our Log, it could get quite spammy
|
||||||
CSCoreLib.getLib().filterLog("([A-Za-z0-9_]{3,16}) issued server command: /sf elevator (.{0,})");
|
CSCoreLib.getLib().filterLog("([A-Za-z0-9_]{3,16}) issued server command: /sf elevator (.{0,})");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user