An instance of this plugin
*/ public static PermissionSigns getInstance() { return instance; } /** * Gets the version of this plugin * * @returnThis plugin's version
*/ public static String getPluginVersion() { return pluginVersion; } /** * Adds a new sign creation request * * @param playerThe player that initiated the sign creation
* @param signThe sign the player is about to create
*/ public static void addSignCreationRequest(Player player, PermissionSign sign) { signCreationRequests.add(new SignCreationRequest(sign, player, System.currentTimeMillis())); } /** * Gets the sign creation request for the player with the given UUID * * @param uuidThe UUID to get a sign creation request for
* @returnA sign creation request, or null if the UUID is not found
*/ public static SignCreationRequest getSignCreationRequest(UUID uuid) { StreamThe UUID of the player to cancel the request for
*/ public static void cancelSignCreationRequest(UUID uuid) { StreamWhether permissions should be set for the current world
*/ public static boolean usePerWorldPermissions() { return perWorldPermissions; } /** * Gets whether permission signs on falling blocks should be protected * * @returnWhether permission signs on falling blocks should be protected
*/ public static boolean extensiveSignProtectionEnabled() { return enableExtensiveSignProtection; } /** * Gets whether permission sign explosion and piston protection is enabled * * @returnWhether permission sign explosion and piston protection is enabled
*/ public static boolean indirectProtectionEnabled() { return enableIndirectSignProtection; } /** * Gets whether to remove permissions signs if their physical signs are missing * * @returnWhether tor remove permission signs if their signs are missing
*/ public static boolean removePermissionSignIfMissing() { return removePermissionSignIfMissing; } @Override public void reloadConfig() { super.reloadConfig(); Translator.loadLanguages(loadConfig()); } @Override public void onEnable() { //Check if vault is loaded setupVault(); //Get plugin info PluginDescriptionFile pluginDescriptionFile = this.getDescription(); pluginVersion = pluginDescriptionFile.getVersion(); //Load config and write the default config if necessary FileConfiguration config = this.getConfig(); this.saveDefaultConfig(); config.options().copyDefaults(true); Translator.loadLanguages(loadConfig()); registerListeners(); registerCommands(); runThreads(); SignManager.loadSigns(); PermissionManager.loadTemporaryPermissions(); UpdateChecker.checkForUpdate(this, "https://api.spigotmc.org/legacy/update.php?resource=99426", () -> pluginVersion, null); } /** * Loads the config file * * @returnThe currently selected language
*/ private String loadConfig() { FileConfiguration config = this.getConfig(); String language = config.getString("language", "en"); perWorldPermissions = config.getBoolean("perWorldPermissions", false); enableExtensiveSignProtection = config.getBoolean("enableExtensiveSignProtection", false); enableIndirectSignProtection = config.getBoolean("enableIndirectSignProtection", true); removePermissionSignIfMissing = config.getBoolean("removePermissionSignIfMissing", true); saveConfig(); return language; } /** * Starts all separate threads for executing tasks */ private void runThreads() { BukkitScheduler scheduler = Bukkit.getScheduler(); scheduler.runTaskTimer(this, new SignCreationRequestTimeoutThread(signCreationRequests), 0L, 100L); scheduler.runTaskTimer(this, new PermissionTimeoutThread(), 0L, 25L); } /** * Registers all necessary listeners */ private void registerListeners() { PluginManager pluginManager = getServer().getPluginManager(); pluginManager.registerEvents(new SignListener(), this); pluginManager.registerEvents(new PlayerListener(), this); pluginManager.registerEvents(new BlockListener(), this); } /** * Sets up Vault by getting plugins from their providers */ private void setupVault() { ServicesManager servicesManager = this.getServer().getServicesManager(); RegisteredServiceProvider