use of ch.njol.skript.SkriptAddon in project Skript by SkriptLang.
the class Language method load.
public static boolean load(String name) {
name = "" + name.toLowerCase();
localizedLanguage = new HashMap<>();
boolean exists = load(Skript.getAddonInstance(), name);
for (SkriptAddon addon : Skript.getAddons()) {
exists |= load(addon, name);
}
if (!exists) {
if (name.equals("english")) {
throw new RuntimeException("English language is missing (english.lang)");
} else {
load("english");
}
return false;
}
Language.name = name;
for (LanguageChangeListener l : listeners) l.onLanguageChange();
return true;
}
use of ch.njol.skript.SkriptAddon in project Parties by AlessioDP.
the class SkriptHandler method init.
public void init() {
if (BukkitConfigMain.PARTIES_HOOK_INTO_SKRIPT) {
BukkitConfigMain.PARTIES_HOOK_INTO_SKRIPT = false;
if (Bukkit.getPluginManager().isPluginEnabled(ADDON_NAME)) {
try {
if (!loaded && Skript.isAcceptRegistrations()) {
SkriptAddon addon = Skript.registerAddon((JavaPlugin) plugin.getBootstrap());
addon.setLanguageFileDirectory("bukkit/skript");
addon.loadClasses("com.alessiodp.parties.bukkit.addons.external.skript");
loaded = true;
}
if (loaded) {
BukkitConfigMain.PARTIES_HOOK_INTO_SKRIPT = true;
plugin.getLoggerManager().log(String.format(Constants.DEBUG_ADDON_HOOKED, ADDON_NAME), true);
} else {
plugin.getLoggerManager().log(String.format(Constants.DEBUG_ADDON_FAILED, ADDON_NAME), true);
}
} catch (Exception ex) {
plugin.getLoggerManager().log(String.format(Constants.DEBUG_ADDON_FAILED, ADDON_NAME), ex, true);
}
}
}
}
use of ch.njol.skript.SkriptAddon in project MongoSK by Romitou.
the class MongoSK method onEnable.
@Override
public void onEnable() {
instance = this;
long start = System.currentTimeMillis();
// Load the configuration.
this.loadConfiguration();
// Make some safe checks to be sure Skript is installed, enabled, and ready to register this addon.
LoggerHelper.info("Checking the availability of Skript...");
final PluginManager pluginManager = this.getServer().getPluginManager();
final Plugin skriptPlugin = pluginManager.getPlugin("Skript");
if (skriptPlugin == null || !skriptPlugin.isEnabled() || !Skript.isAcceptRegistrations()) {
LoggerHelper.severe("Skript is not installed or does not accept registrations. Disabling.", "Is Skript plugin present: " + (skriptPlugin != null), "Is Skript enabled: " + (skriptPlugin != null && skriptPlugin.isEnabled()), "Does Skript accept registrations: " + (skriptPlugin != null && skriptPlugin.isEnabled() && Skript.isAcceptRegistrations()));
pluginManager.disablePlugin(this);
return;
}
// Register the SkriptAddon and try to load classes.
LoggerHelper.info("Registration of the MongoSK syntaxes...");
try {
SkriptAddon skriptAddon = Skript.registerAddon(this);
skriptAddon.loadClasses("fr.romitou.mongosk.skript", "conditions", "effects", "events", "expressions", (isUsingNewSections() ? "sections" : "legacySections"));
new SkriptTypes();
} catch (IOException e) {
LoggerHelper.severe("MongoSK could not load and register some syntax elements.", "Try to update your version of Skript and MongoSK, and try again only with these two plugins.", "If the problem persists, please open an issue on GitHub.", "More information about this exception: " + e.getMessage());
return;
}
// Register MongoSK codecs.
if (MongoSKAdapter.ADAPTERS_ENABLED) {
LoggerHelper.info("Loading MongoSK adapters and codecs...");
MongoSKAdapter.loadCodecs();
}
LoggerHelper.info("MongoSK has been activated and the syntaxes has been loaded successfully in " + (System.currentTimeMillis() - start) + "ms!", "MongoSK version: " + this.getDescription().getVersion(), "Skript version: " + skriptPlugin.getDescription().getVersion(), "Server version: " + this.getServer().getVersion());
LoggerHelper.info("If you need help, go to GitHub or to our Discord: https://discord.com/invite/6jeQkRcMkk");
// Register Metrics.
// Learn more: https://bstats.org/getting-started
this.registerMetrics();
}
use of ch.njol.skript.SkriptAddon in project LifeSkript by LifeMC.
the class Language method load.
public static final boolean load(String name) {
name = name.toLowerCase(Locale.ENGLISH);
if ("english".equals(name))
return true;
localized = new HashMap<>();
boolean exists = load(Skript.getAddonInstance(), name);
for (final SkriptAddon addon : Skript.getAddons()) {
assert addon != null;
exists |= load(addon, name);
}
if (!exists) {
localized = null;
Language.name = "english";
return false;
}
Language.name = name;
validateLocalized();
if (useLocal) {
for (final LanguageChangeListener l : listeners) l.onLanguageChange();
}
return true;
}
Aggregations