use of org.bukkit.plugin.PluginManager 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 org.bukkit.plugin.PluginManager in project mcapi by Jenya705.
the class BukkitServerCore method permission.
@Override
public void permission(String name, boolean toggled) {
List<String> subPermissions = generatePermissionList(name);
PermissionDefault bukkitToggled = toggled ? PermissionDefault.TRUE : PermissionDefault.OP;
PluginManager pluginManager = Bukkit.getPluginManager();
for (int i = 0; i < subPermissions.size(); ++i) {
Permission permission = pluginManager.getPermission(subPermissions.get(i));
if (permission == null) {
permission = new Permission(subPermissions.get(i), bukkitToggled);
pluginManager.addPermission(permission);
}
for (int j = 0; j < i; ++j) {
permission.addParent(subPermissions.get(j) + ".*", true);
}
}
}
use of org.bukkit.plugin.PluginManager in project StableMaster by RobotoRaccoon.
the class StableMaster method onEnable.
/**
* Called once when the plugin is instantiated
*/
@Override
public void onEnable() {
plugin = this;
pluginFolder = getDataFolder();
stablesFolder = new File(pluginFolder + File.separator + "stables");
createDataFolders();
// Load in config data
StableUtil.loadConfigData();
// Register listeners
PluginManager pm = getServer().getPluginManager();
pm.registerEvents(new EntityDamageListeners(), this);
pm.registerEvents(new EntityDeathListener(), this);
pm.registerEvents(new EntityTameListener(), this);
pm.registerEvents(new PlayerInteractEntityListener(), this);
pm.registerEvents(new PlayerJoinListener(), this);
pm.registerEvents(new PlayerQuitListener(), this);
// Register commands
this.getCommand("stablemaster").setExecutor(new CoreCommand());
// Load all stables for players already online
for (Player p : this.getServer().getOnlinePlayers()) {
StableUtil.loadStable(p);
}
}
use of org.bukkit.plugin.PluginManager in project UltraCosmetics by iSach.
the class UltraCosmetics method registerListeners.
/**
* Registers Listeners.
*/
private void registerListeners() {
PluginManager pluginManager = Bukkit.getPluginManager();
pluginManager.registerEvents(new PlayerListener(this), this);
pluginManager.registerEvents(new MainListener(), this);
pluginManager.registerEvents(new EntitySpawningManager(), this);
if (UltraCosmeticsData.get().getServerVersion().offhandAvailable()) {
pluginManager.registerEvents(new Listener19(this), this);
}
}
use of org.bukkit.plugin.PluginManager in project scripted-quests by TeamMonumenta.
the class Plugin method onEnable.
@Override
public void onEnable() {
INSTANCE = this;
PluginManager manager = getServer().getPluginManager();
mWorld = Bukkit.getWorlds().get(0);
mQuestCompassManager = new QuestCompassManager(this);
mNpcManager = new QuestNpcManager(this);
mClickableManager = new ClickableManager();
mInteractableManager = new InteractableManager();
mTradeManager = new NpcTradeManager();
mLoginManager = new QuestLoginManager();
mDeathManager = new QuestDeathManager();
mRaceManager = new RaceManager(this);
mCodeManager = new CodeManager();
mZoneManager = new ZoneManager(this);
mZonePropertyManager = new ZonePropertyManager(this);
mTimerManager = new CommandTimerManager(this);
mWaypointManager = new WaypointManager(this);
mGuiManager = new GuiManager(this);
manager.registerEvents(new EntityListener(this), this);
manager.registerEvents(new InteractablesListener(this), this);
manager.registerEvents(new PlayerListener(this), this);
manager.registerEvents(new WorldListener(this), this);
if (mTranslationsManager != null) {
manager.registerEvents(mTranslationsManager, this);
}
manager.registerEvents(mTimerManager, this);
manager.registerEvents(mZonePropertyManager, this);
manager.registerEvents(mTradeManager, this);
getCommand("reloadQuests").setExecutor(new ReloadQuests(this));
getCommand("questTrigger").setExecutor(new QuestTrigger(this));
ClientChatProtocol.initialize(this);
/* Load the config 1 tick later to let other plugins load */
new BukkitRunnable() {
@Override
public void run() {
reloadConfig(null);
mZoneManager.reload(INSTANCE, Bukkit.getConsoleSender());
}
}.runTaskLater(this, 1);
}
Aggregations