1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-21 04:05:48 +00:00
Slimefun4/src/main/java/me/mrCookieSlime/Slimefun/SlimefunPlugin.java

457 lines
16 KiB
Java
Raw Normal View History

2016-04-14 16:24:03 +00:00
package me.mrCookieSlime.Slimefun;
2017-06-22 14:43:49 +00:00
import java.io.File;
2019-08-31 10:54:54 +00:00
import java.util.logging.Level;
2017-06-22 14:43:49 +00:00
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
2019-09-01 16:53:02 +00:00
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionManager;
2019-10-29 08:13:32 +00:00
import io.github.thebusybiscuit.cscorelib2.recipes.RecipeSnapshot;
2019-10-01 11:14:50 +00:00
import io.github.thebusybiscuit.cscorelib2.reflection.ReflectionUtils;
import io.github.thebusybiscuit.cscorelib2.updater.BukkitUpdater;
import io.github.thebusybiscuit.cscorelib2.updater.GitHubBuildsUpdater;
import io.github.thebusybiscuit.cscorelib2.updater.Updater;
2016-04-14 16:24:03 +00:00
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
2017-06-13 17:28:54 +00:00
import me.mrCookieSlime.CSCoreLibPlugin.PluginUtils;
2017-06-22 14:43:49 +00:00
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
2016-05-18 17:04:27 +00:00
import me.mrCookieSlime.Slimefun.GEO.OreGenSystem;
2019-09-03 11:09:58 +00:00
import me.mrCookieSlime.Slimefun.GEO.resources.NetherIceResource;
import me.mrCookieSlime.Slimefun.GEO.resources.OilResource;
import me.mrCookieSlime.Slimefun.GEO.resources.UraniumResource;
2019-08-31 09:36:45 +00:00
import me.mrCookieSlime.Slimefun.GPS.GPSNetwork;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
2016-04-14 16:24:03 +00:00
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AGenerator;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AReactor;
2019-10-05 18:44:11 +00:00
import me.mrCookieSlime.Slimefun.Objects.tasks.ArmorTask;
2019-08-27 11:28:07 +00:00
import me.mrCookieSlime.Slimefun.Setup.CSCoreLibLoader;
2017-06-22 14:43:49 +00:00
import me.mrCookieSlime.Slimefun.Setup.Files;
import me.mrCookieSlime.Slimefun.Setup.MiscSetup;
import me.mrCookieSlime.Slimefun.Setup.ResearchSetup;
2019-09-21 11:59:15 +00:00
import me.mrCookieSlime.Slimefun.Setup.SlimefunLocalization;
2019-09-26 10:58:35 +00:00
import me.mrCookieSlime.Slimefun.Setup.SlimefunMetrics;
2017-06-22 14:43:49 +00:00
import me.mrCookieSlime.Slimefun.Setup.SlimefunSetup;
2019-10-16 22:49:55 +00:00
import me.mrCookieSlime.Slimefun.Setup.WikiSetup;
2019-08-30 07:21:49 +00:00
import me.mrCookieSlime.Slimefun.ancient_altar.AncientAltarListener;
2016-04-14 16:24:03 +00:00
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.PlayerProfile;
2016-04-14 16:24:03 +00:00
import me.mrCookieSlime.Slimefun.api.Slimefun;
import me.mrCookieSlime.Slimefun.api.SlimefunBackup;
2016-04-14 16:24:03 +00:00
import me.mrCookieSlime.Slimefun.api.TickerTask;
2019-08-22 19:37:09 +00:00
import me.mrCookieSlime.Slimefun.api.inventory.UniversalBlockMenu;
import me.mrCookieSlime.Slimefun.autosave.BlockAutoSaver;
import me.mrCookieSlime.Slimefun.autosave.PlayerAutoSaver;
2019-08-25 20:39:59 +00:00
import me.mrCookieSlime.Slimefun.commands.SlimefunCommand;
import me.mrCookieSlime.Slimefun.commands.SlimefunTabCompleter;
2019-08-29 14:19:23 +00:00
import me.mrCookieSlime.Slimefun.hooks.SlimefunHooks;
2019-08-26 07:07:02 +00:00
import me.mrCookieSlime.Slimefun.hooks.github.GitHubConnector;
import me.mrCookieSlime.Slimefun.hooks.github.GitHubSetup;
2019-06-20 07:50:59 +00:00
import me.mrCookieSlime.Slimefun.listeners.AndroidKillingListener;
import me.mrCookieSlime.Slimefun.listeners.ArmorListener;
import me.mrCookieSlime.Slimefun.listeners.AutonomousToolsListener;
import me.mrCookieSlime.Slimefun.listeners.BackpackListener;
import me.mrCookieSlime.Slimefun.listeners.BlockListener;
import me.mrCookieSlime.Slimefun.listeners.BowListener;
import me.mrCookieSlime.Slimefun.listeners.CoolerListener;
import me.mrCookieSlime.Slimefun.listeners.DamageListener;
import me.mrCookieSlime.Slimefun.listeners.FurnaceListener;
import me.mrCookieSlime.Slimefun.listeners.GearListener;
import me.mrCookieSlime.Slimefun.listeners.GuideOnJoinListener;
import me.mrCookieSlime.Slimefun.listeners.ItemListener;
import me.mrCookieSlime.Slimefun.listeners.ItemPickupListener;
import me.mrCookieSlime.Slimefun.listeners.NetworkListener;
import me.mrCookieSlime.Slimefun.listeners.PlayerQuitListener;
import me.mrCookieSlime.Slimefun.listeners.TalismanListener;
import me.mrCookieSlime.Slimefun.listeners.TeleporterListener;
import me.mrCookieSlime.Slimefun.listeners.ToolListener;
import me.mrCookieSlime.Slimefun.listeners.WorldListener;
2019-11-10 16:46:18 +00:00
import me.mrCookieSlime.Slimefun.services.CustomItemDataService;
import me.mrCookieSlime.Slimefun.services.CustomTextureService;
import me.mrCookieSlime.Slimefun.utils.Settings;
import me.mrCookieSlime.Slimefun.utils.Utilities;
2016-04-14 16:24:03 +00:00
2019-08-31 09:36:45 +00:00
public final class SlimefunPlugin extends JavaPlugin {
2019-08-31 09:36:45 +00:00
public static SlimefunPlugin instance;
2019-10-29 08:13:32 +00:00
private RecipeSnapshot recipeSnapshot;
2019-11-10 16:46:18 +00:00
private final CustomItemDataService itemDataService = new CustomItemDataService(this, "slimefun_item");
private final CustomTextureService textureService = new CustomTextureService(this);
2019-08-31 10:54:54 +00:00
private TickerTask ticker;
2019-09-21 11:59:15 +00:00
private SlimefunLocalization local;
2019-08-31 09:36:45 +00:00
private Config researches;
private Config items;
private Config whitelist;
private Config config;
2019-09-21 14:21:10 +00:00
private GPSNetwork gps;
2019-09-01 16:53:02 +00:00
private ProtectionManager protections;
2019-09-21 14:21:10 +00:00
private Utilities utilities;
private Settings settings;
2019-08-29 14:19:23 +00:00
private SlimefunHooks hooks;
2019-08-27 15:55:20 +00:00
2016-08-05 23:11:32 +00:00
// Supported Versions of Minecraft
2019-08-28 08:59:20 +00:00
private final String[] supported = {"v1_14_"};
2019-03-27 20:48:34 +00:00
2016-04-14 16:24:03 +00:00
@Override
public void onEnable() {
2019-09-30 16:20:08 +00:00
if (new CSCoreLibLoader(this).load()) {
2017-06-14 10:35:25 +00:00
String currentVersion = ReflectionUtils.getVersion();
if (currentVersion.startsWith("v")) {
boolean compatibleVersion = false;
StringBuilder versions = new StringBuilder();
2019-03-27 20:48:34 +00:00
2017-06-14 10:35:25 +00:00
int i = 0;
for (String version: supported) {
if (currentVersion.startsWith(version)) {
compatibleVersion = true;
}
2019-03-27 20:48:34 +00:00
2019-09-05 22:09:25 +00:00
String s = version.substring(1).replaceFirst("_", ".").replace("_", ".X");
if (i == 0) versions.append(s);
else if (i == supported.length - 1) versions.append(" or ").append(s);
else versions.append(", ").append(s);
2019-04-28 15:22:30 +00:00
2017-06-14 10:35:25 +00:00
i++;
}
2019-03-27 20:48:34 +00:00
2017-06-14 10:35:25 +00:00
// Looks like you are using an unsupported Minecraft Version
if (!compatibleVersion) {
2019-08-31 15:52:20 +00:00
getLogger().log(Level.SEVERE, "### Slimefun was not installed correctly!");
getLogger().log(Level.SEVERE, "###");
getLogger().log(Level.SEVERE, "### You are using the wrong Version of Minecraft!");
getLogger().log(Level.SEVERE, "###");
getLogger().log(Level.SEVERE, "### You are using Minecraft " + ReflectionUtils.getVersion());
getLogger().log(Level.SEVERE, "### but Slimefun v" + getDescription().getVersion() + " requires you to be using");
2019-09-05 22:09:25 +00:00
getLogger().log(Level.SEVERE, "### Minecraft {0}", versions);
2019-08-31 15:52:20 +00:00
getLogger().log(Level.SEVERE, "###");
getLogger().log(Level.SEVERE, "### Please use an older Version of Slimefun and disable auto-updating");
getLogger().log(Level.SEVERE, "### or consider updating your Server Software.");
2017-06-14 10:35:25 +00:00
getServer().getPluginManager().disablePlugin(this);
return;
2016-08-05 23:11:32 +00:00
}
}
2016-04-14 16:24:03 +00:00
instance = this;
2019-08-31 15:52:20 +00:00
getLogger().log(Level.INFO, "Loading Files...");
2019-08-31 13:52:15 +00:00
Files files = new Files();
files.cleanup();
2019-08-31 15:52:20 +00:00
getLogger().log(Level.INFO, "Loading Config...");
2019-08-31 18:34:10 +00:00
// Setup config.yml
2019-08-29 23:11:33 +00:00
PluginUtils utils = new PluginUtils(this);
2016-04-14 16:24:03 +00:00
utils.setupConfig();
2019-08-31 18:34:10 +00:00
config = utils.getConfig();
settings = new Settings(config);
2016-08-05 23:23:40 +00:00
// Loading all extra configs
2019-08-31 13:52:15 +00:00
researches = new Config(files.researches);
items = new Config(files.items);
whitelist = new Config(files.whitelist);
2019-08-22 19:37:09 +00:00
2019-08-31 18:34:10 +00:00
// Setup messages.yml
2019-09-21 11:59:15 +00:00
local = new SlimefunLocalization(this);
2019-09-21 14:21:10 +00:00
// Setting up other stuff
utilities = new Utilities();
gps = new GPSNetwork();
// Setting up bStats
2019-09-26 10:58:35 +00:00
new SlimefunMetrics(this);
2019-08-22 19:37:09 +00:00
// Setting up the Auto-Updater
Updater updater;
if (getDescription().getVersion().equals("UNOFFICIAL")) {
// This Server is using a modified build that is not a public release.
getLogger().log(Level.WARNING, "It looks like you are using an unofficially modified build of Slimefun!");
getLogger().log(Level.WARNING, "Auto-Updates have been disabled, this build is not considered safe.");
getLogger().log(Level.WARNING, "Do not report bugs encountered in this Version of Slimefun.");
}
2019-09-26 06:21:49 +00:00
if (getDescription().getVersion().startsWith("DEV - ")) {
// If we are using a development build, we want to switch to our custom
updater = new GitHubBuildsUpdater(this, getFile(), "TheBusyBiscuit/Slimefun4/master");
}
2019-09-26 06:21:49 +00:00
else if (getDescription().getVersion().startsWith("RC - ")) {
// If we are using a development build, we want to switch to our custom
2019-09-29 22:04:43 +00:00
updater = new GitHubBuildsUpdater(this, getFile(), "TheBusyBiscuit/Slimefun4/stable", "RC - ");
2019-09-26 06:21:49 +00:00
}
else {
// We are using an official build, use the BukkitDev Updater
updater = new BukkitUpdater(this, getFile(), 53485);
}
2019-08-22 19:37:09 +00:00
if (updater != null && config.getBoolean("options.auto-update")) {
updater.start();
}
2016-04-14 16:24:03 +00:00
2016-08-05 23:23:40 +00:00
// Creating all necessary Folders
2019-03-27 20:46:04 +00:00
String[] storage = {"blocks", "stored-blocks", "stored-inventories", "stored-chunks", "universal-inventories", "waypoints", "block-backups"};
String[] general = {"scripts", "generators", "error-reports", "cache/github"};
for (String s : storage) createDir("data-storage/Slimefun/" + s);
for (String s : general) createDir("plugins/Slimefun/" + s);
2019-08-31 15:52:20 +00:00
getLogger().log(Level.INFO, "Loading Items...");
2016-04-14 16:24:03 +00:00
MiscSetup.setupItemSettings();
2016-04-14 16:24:03 +00:00
try {
SlimefunSetup.setupItems();
} catch (Exception x) {
2019-09-01 16:53:02 +00:00
getLogger().log(Level.SEVERE, "An Error occured while initializing SlimefunItems for Slimefun " + Slimefun.getVersion(), x);
2016-04-14 16:24:03 +00:00
}
2019-08-31 15:52:20 +00:00
2016-04-14 16:24:03 +00:00
MiscSetup.loadDescriptions();
2019-08-30 21:21:34 +00:00
settings.researchesEnabled = getResearchCfg().getBoolean("enable-researching");
2019-11-10 16:46:18 +00:00
settings.smelteryFireBreakChance = (int) Slimefun.getItemValue("SMELTERY", "chance.fireBreak");
2019-08-31 15:52:20 +00:00
getLogger().log(Level.INFO, "Loading Researches...");
2016-04-14 16:24:03 +00:00
ResearchSetup.setupResearches();
2016-04-14 16:24:03 +00:00
MiscSetup.setupMisc();
2019-11-10 16:46:18 +00:00
WikiSetup.addWikiPages(this);
textureService.setup(utilities.allItems);
2019-08-31 15:52:20 +00:00
getLogger().log(Level.INFO, "Loading World Generators...");
2016-08-05 23:23:40 +00:00
// Generating Oil as an OreGenResource (its a cool API)
2016-12-05 18:51:39 +00:00
OreGenSystem.registerResource(new OilResource());
OreGenSystem.registerResource(new NetherIceResource());
OreGenSystem.registerResource(new UraniumResource());
2019-03-27 20:48:34 +00:00
2017-01-18 11:44:12 +00:00
// Setting up GitHub Connectors...
2019-03-27 20:48:34 +00:00
2017-01-18 11:44:12 +00:00
GitHubSetup.setup();
2019-03-27 20:48:34 +00:00
2016-08-05 23:23:40 +00:00
// All Slimefun Listeners
2016-04-14 16:24:03 +00:00
new ArmorListener(this);
new ItemListener(this);
new BlockListener(this);
new GearListener(this);
new AutonomousToolsListener(this);
new DamageListener(this);
new BowListener(this);
new ToolListener(this);
new FurnaceListener(this);
new TeleporterListener(this);
new AndroidKillingListener(this);
new NetworkListener(this);
2018-09-04 09:33:57 +00:00
new ItemPickupListener(this);
2016-08-05 23:23:40 +00:00
// Toggleable Listeners for performance
2016-04-14 16:24:03 +00:00
if (config.getBoolean("items.talismans")) new TalismanListener(this);
if (config.getBoolean("items.backpacks")) new BackpackListener(this);
if (config.getBoolean("items.coolers")) new CoolerListener(this);
2016-08-05 23:23:40 +00:00
// Handle Slimefun Guide being given on Join
2019-03-30 10:10:54 +00:00
if (config.getBoolean("options.give-guide-on-first-join")) new GuideOnJoinListener(this);
2016-08-05 23:23:40 +00:00
// Load/Unload Worlds in Slimefun
2019-03-30 10:10:54 +00:00
new WorldListener(this);
2016-08-05 23:23:40 +00:00
// Clear the Slimefun Guide History upon Player Leaving
2019-03-30 10:10:54 +00:00
new PlayerQuitListener(this);
2016-08-05 23:23:40 +00:00
// Initiating various Stuff and all Items with a slightly delay (0ms after the Server finished loading)
getServer().getScheduler().scheduleSyncDelayedTask(this, () -> {
2019-10-29 08:13:32 +00:00
recipeSnapshot = new RecipeSnapshot(this);
2019-09-01 16:53:02 +00:00
protections = new ProtectionManager(getServer());
MiscSetup.loadItems(settings);
for (World world: Bukkit.getWorlds()) {
new BlockStorage(world);
2016-04-14 16:24:03 +00:00
}
2019-08-31 09:36:45 +00:00
if (SlimefunItem.getByID("ANCIENT_ALTAR") != null) new AncientAltarListener((SlimefunPlugin) instance);
2016-04-14 16:24:03 +00:00
}, 0);
2019-09-01 09:42:03 +00:00
SlimefunCommand command = new SlimefunCommand(this);
2019-09-01 09:42:03 +00:00
getCommand("slimefun").setExecutor(command);
getCommand("slimefun").setTabCompleter(new SlimefunTabCompleter(command));
2016-08-05 23:23:40 +00:00
// Armor Update Task
2016-04-14 16:24:03 +00:00
if (config.getBoolean("options.enable-armor-effects")) {
2019-10-05 19:16:21 +00:00
getServer().getScheduler().runTaskTimerAsynchronously(this, new ArmorTask(), 0L, config.getInt("options.armor-update-interval") * 20L);
2016-04-14 16:24:03 +00:00
}
2016-04-14 16:24:03 +00:00
ticker = new TickerTask();
2019-08-30 21:21:34 +00:00
getServer().getScheduler().runTaskTimer(this, new PlayerAutoSaver(), 2000L, settings.blocksAutoSaveDelay * 60L * 20L);
2016-08-05 23:23:40 +00:00
// Starting all ASYNC Tasks
2019-08-30 21:21:34 +00:00
getServer().getScheduler().runTaskTimerAsynchronously(this, new BlockAutoSaver(), 2000L, settings.blocksAutoSaveDelay * 60L * 20L);
getServer().getScheduler().runTaskTimerAsynchronously(this, () -> {
try {
ticker.run();
}
catch(Throwable x) {
getLogger().log(Level.SEVERE, "An Exception was caught while ticking the Block Tickers Task for Slimefun v" + Slimefun.getVersion(), x);
ticker.abortTick();
}
}, 100L, config.getInt("URID.custom-ticker-delay"));
2019-03-27 20:48:34 +00:00
getServer().getScheduler().runTaskTimerAsynchronously(this, () -> utilities.connectors.forEach(GitHubConnector::pullFile), 80L, 60 * 60 * 20L);
2019-04-28 15:22:30 +00:00
2016-08-05 23:23:40 +00:00
// Hooray!
2019-08-31 15:52:20 +00:00
getLogger().log(Level.INFO, "Finished!");
2019-08-29 14:19:23 +00:00
hooks = new SlimefunHooks(this);
utilities.oreWasherOutputs = new ItemStack[] {SlimefunItems.IRON_DUST, SlimefunItems.GOLD_DUST, SlimefunItems.ALUMINUM_DUST, SlimefunItems.COPPER_DUST, SlimefunItems.ZINC_DUST, SlimefunItems.TIN_DUST, SlimefunItems.LEAD_DUST, SlimefunItems.SILVER_DUST, SlimefunItems.MAGNESIUM_DUST};
2016-08-05 23:23:40 +00:00
// 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,})");
2016-04-14 16:24:03 +00:00
}
2019-09-21 14:21:10 +00:00
else {
getCommand("slimefun").setExecutor((sender, cmd, label, args) -> {
sender.sendMessage("You have forgotten to install CS-CoreLib! Slimefun is disabled.");
sender.sendMessage("https://dev.bukkit.org/projects/cs-corelib");
return true;
});
}
2016-04-14 16:24:03 +00:00
}
2016-04-14 16:24:03 +00:00
@Override
public void onDisable() {
// CS-CoreLib wasn't loaded, just disabling
if (instance == null) return;
2016-04-14 16:24:03 +00:00
Bukkit.getScheduler().cancelTasks(this);
2019-04-28 15:22:30 +00:00
if (ticker != null) {
// Finishes all started movements/removals of block data
2019-09-02 21:14:48 +00:00
ticker.halt();
2019-04-28 15:22:30 +00:00
ticker.run();
}
2019-08-22 19:37:09 +00:00
2019-08-29 13:13:40 +00:00
PlayerProfile.iterator().forEachRemaining(profile -> {
if (profile.isDirty()) profile.save();
});
2019-08-22 19:37:09 +00:00
for (World world: Bukkit.getWorlds()) {
try {
2016-06-10 16:39:40 +00:00
BlockStorage storage = BlockStorage.getStorage(world);
2019-08-22 19:37:09 +00:00
if (storage != null) {
storage.save(true);
2016-06-10 16:39:40 +00:00
}
else {
2019-08-31 10:54:54 +00:00
getLogger().log(Level.SEVERE, "Could not save Slimefun Blocks for World \"" + world.getName() + "\"");
2016-04-14 16:24:03 +00:00
}
2019-08-22 19:37:09 +00:00
} catch (Exception x) {
2019-08-31 10:54:54 +00:00
getLogger().log(Level.SEVERE, "An Error occured while saving Slimefun-Blocks in World '" + world.getName() + "' for Slimefun " + Slimefun.getVersion());
2016-04-14 16:24:03 +00:00
}
2019-08-22 19:37:09 +00:00
}
2019-08-31 13:52:15 +00:00
for (UniversalBlockMenu menu: utilities.universalInventories.values()) {
2019-08-22 19:37:09 +00:00
menu.save();
}
SlimefunBackup.start();
2017-06-22 14:43:49 +00:00
// Prevent Memory Leaks
2016-04-14 16:24:03 +00:00
AContainer.processing = null;
AContainer.progress = null;
AGenerator.processing = null;
AGenerator.progress = null;
AReactor.processing = null;
AReactor.progress = null;
2019-08-31 09:36:45 +00:00
instance = null;
2016-04-14 16:24:03 +00:00
for (Player p: Bukkit.getOnlinePlayers()) {
p.closeInventory();
}
}
2019-03-27 20:46:04 +00:00
private void createDir(String path) {
2019-03-27 22:31:32 +00:00
File file = new File(path);
2019-08-27 21:08:13 +00:00
if (!file.exists()) file.mkdirs();
2019-03-27 20:46:04 +00:00
}
2016-04-14 16:24:03 +00:00
public static Config getCfg() {
2019-08-31 09:36:45 +00:00
return instance.config;
2016-04-14 16:24:03 +00:00
}
2016-04-14 16:24:03 +00:00
public static Config getResearchCfg() {
2019-08-31 09:36:45 +00:00
return instance.researches;
2016-04-14 16:24:03 +00:00
}
2016-04-14 16:24:03 +00:00
public static Config getItemCfg() {
2019-08-31 09:36:45 +00:00
return instance.items;
2016-04-14 16:24:03 +00:00
}
2016-04-14 16:24:03 +00:00
public static Config getWhitelist() {
2019-08-31 09:36:45 +00:00
return instance.whitelist;
2016-04-14 16:24:03 +00:00
}
@Deprecated
2016-04-14 16:24:03 +00:00
public static int randomize(int max) {
if (max < 1) return 0;
2016-04-14 16:24:03 +00:00
return CSCoreLib.randomizer().nextInt(max);
}
@Deprecated
2016-04-14 16:24:03 +00:00
public static boolean chance(int max, int percentage) {
2017-08-12 13:21:29 +00:00
if (max < 1) return false;
2016-04-14 16:24:03 +00:00
return CSCoreLib.randomizer().nextInt(max) <= percentage;
}
2019-09-02 21:14:48 +00:00
public GPSNetwork getGPS() {
return gps;
}
2019-08-31 09:36:45 +00:00
public static SlimefunHooks getHooks() {
return instance.hooks;
}
2019-08-27 11:28:07 +00:00
2019-08-31 09:36:45 +00:00
public static Utilities getUtilities() {
return instance.utilities;
2019-08-27 11:28:07 +00:00
}
2019-08-31 09:36:45 +00:00
public static Settings getSettings() {
return instance.settings;
}
2019-08-31 10:54:54 +00:00
public static TickerTask getTicker() {
return instance.ticker;
}
2019-08-31 12:17:25 +00:00
public static boolean isActive() {
return instance != null;
}
2019-03-27 20:48:34 +00:00
2019-09-01 16:53:02 +00:00
public static ProtectionManager getProtectionManager() {
return instance.protections;
}
2019-09-21 11:59:15 +00:00
public static SlimefunLocalization getLocal() {
return instance.local;
}
2019-10-29 08:13:32 +00:00
public static RecipeSnapshot getMinecraftRecipes() {
return instance.recipeSnapshot;
}
2019-11-10 16:46:18 +00:00
public static CustomItemDataService getItemDataService() {
return instance.itemDataService;
}
public static CustomTextureService getItemTextureService() {
return instance.textureService;
}
2019-09-21 11:59:15 +00:00
2016-04-14 16:24:03 +00:00
}