Search in sources :

Example 71 with PluginManager

use of org.bukkit.plugin.PluginManager in project BetterRTP by SuperRonanCraft.

the class Listener method registerEvents.

// private final PluginEnable pEnable = new PluginEnable();
public void registerEvents(BetterRTP pl) {
    PluginManager pm = pl.getServer().getPluginManager();
    pm.registerEvents(this, pl);
}
Also used : PluginManager(org.bukkit.plugin.PluginManager)

Example 72 with PluginManager

use of org.bukkit.plugin.PluginManager in project Skywars by TheBrunoRM.

the class Skywars method loadEvents.

public void loadEvents() {
    // sendMessage("Loading events...");
    final FileConfiguration config = this.getConfig();
    final PluginManager pluginManager = this.getServer().getPluginManager();
    if (config.getBoolean("signsEnabled")) {
        pluginManager.registerEvents(new SignEvents(), this);
    }
    if (config.getBoolean("messageSounds.enabled")) {
        pluginManager.registerEvents(new MessageSound(), this);
    }
    if (config.getBoolean("disableWeather")) {
        pluginManager.registerEvents(new DisableWeather(), this);
    }
    if (config.getBoolean("debug.projectileTests")) {
        pluginManager.registerEvents(new ProjectileTrails(), this);
    }
    final Listener[] listeners = { new InteractEvent(), new Events(), new GamesMenu(), new MapMenu(), new KitsMenu(), new SetupEvents(), new ChestManager(), new SetupMenu(), new PlayerInventoryManager() };
    for (final Listener listener : listeners) {
        pluginManager.registerEvents(listener, this);
    }
}
Also used : SignEvents(me.brunorm.skywars.events.SignEvents) ProjectileTrails(me.brunorm.skywars.events.ProjectileTrails) Listener(org.bukkit.event.Listener) SetupEvents(me.brunorm.skywars.events.SetupEvents) GamesMenu(me.brunorm.skywars.menus.GamesMenu) KitsMenu(me.brunorm.skywars.menus.KitsMenu) MapMenu(me.brunorm.skywars.menus.MapMenu) FileConfiguration(org.bukkit.configuration.file.FileConfiguration) PluginManager(org.bukkit.plugin.PluginManager) MessageSound(me.brunorm.skywars.events.MessageSound) InteractEvent(me.brunorm.skywars.events.InteractEvent) SetupMenu(me.brunorm.skywars.menus.SetupMenu) SetupEvents(me.brunorm.skywars.events.SetupEvents) Events(me.brunorm.skywars.events.Events) SignEvents(me.brunorm.skywars.events.SignEvents) DisableWeather(me.brunorm.skywars.events.DisableWeather)

Example 73 with PluginManager

use of org.bukkit.plugin.PluginManager in project Jobs by Zrips.

the class JobsListener method onWorldLoad.

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onWorldLoad(WorldLoadEvent event) {
    PluginManager pm = plugin.getServer().getPluginManager();
    String name = event.getWorld().getName().toLowerCase();
    if (pm.getPermission("jobs.world." + name) == null && !PermissionHandler.worldsRegistered.contains(name)) {
        pm.addPermission(new Permission("jobs.world." + name, PermissionDefault.TRUE));
        PermissionHandler.worldsRegistered.add(name);
    }
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) Permission(org.bukkit.permissions.Permission) EventHandler(org.bukkit.event.EventHandler)

Example 74 with PluginManager

use of org.bukkit.plugin.PluginManager in project Jobs by Zrips.

the class PermissionHandler method registerPermissions.

public void registerPermissions() {
    PluginManager pm = plugin.getServer().getPluginManager();
    for (World world : plugin.getServer().getWorlds()) {
        String worldName = world.getName().toLowerCase();
        if (pm.getPermission("jobs.world." + worldName) == null) {
            pm.addPermission(new Permission("jobs.world." + worldName, PermissionDefault.TRUE));
            worldsRegistered.add(worldName);
        }
    }
    for (Job job : Jobs.getJobs()) {
        String jobName = job.getName().toLowerCase();
        if (pm.getPermission("jobs.join." + jobName) == null)
            pm.addPermission(new Permission("jobs.join." + jobName, PermissionDefault.TRUE));
    }
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) Permission(org.bukkit.permissions.Permission) JobPermission(com.gamingmesh.jobs.container.JobPermission) World(org.bukkit.World) Job(com.gamingmesh.jobs.container.Job)

Example 75 with PluginManager

use of org.bukkit.plugin.PluginManager in project DragonsOnline by UniverseCraft.

the class DragonsAntiCheat method onEnable.

@Override
public void onEnable() {
    enableDebugLogging();
    combatRewinder = new CombatRewinder(this);
    CommandExecutor ac = new AntiCheatCommand(this);
    getCommand("ac").setExecutor(ac);
    getCommand("acdebug").setExecutor(ac);
    getCommand("acflushlog").setExecutor(ac);
    getCommand("acstartlog").setExecutor(ac);
    getCommand("acblockdata").setExecutor(ac);
    getCommand("acban").setExecutor(ac);
    getCommand("ackick").setExecutor(ac);
    getCommand("acdump").setExecutor(ac);
    getCommand("acresetplayer").setExecutor(ac);
    getCommand("acstatus").setExecutor(ac);
    getCommand("actoggle").setExecutor(ac);
    getCommand("acping").setExecutor(ac);
    getCommand("acspoofping").setExecutor(ac);
    getCommand("acraytol").setExecutor(ac);
    getCommand("acpps").setExecutor(ac);
    getCommand("achitstats").setExecutor(ac);
    getCommand("acresethitstats").setExecutor(ac);
    checkRegistry = new CheckRegistry();
    checkRegistry.registerCheck(new PacketSpoof(this));
    checkRegistry.registerCheck(new NoClip(this));
    checkRegistry.registerCheck(new WrongMove(this));
    checkRegistry.registerCheck(new FastPackets(this));
    PluginManager pluginManager = getServer().getPluginManager();
    // Uncomment if you want spam
    // pluginManager.registerEvents(testingMoveListener = new TestingMoveListener(this), this);
    pluginManager.registerEvents(new CheckListeners(this), this);
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) NoClip(mc.dragons.anticheat.check.move.NoClip) CommandExecutor(org.bukkit.command.CommandExecutor) AntiCheatCommand(mc.dragons.anticheat.command.AntiCheatCommand) CheckListeners(mc.dragons.anticheat.event.CheckListeners) CheckRegistry(mc.dragons.anticheat.check.CheckRegistry) WrongMove(mc.dragons.anticheat.check.move.WrongMove) CombatRewinder(mc.dragons.anticheat.event.CombatRewinder) PacketSpoof(mc.dragons.anticheat.check.move.PacketSpoof) FastPackets(mc.dragons.anticheat.check.move.FastPackets)

Aggregations

PluginManager (org.bukkit.plugin.PluginManager)148 Plugin (org.bukkit.plugin.Plugin)33 JavaPlugin (org.bukkit.plugin.java.JavaPlugin)20 Permission (org.bukkit.permissions.Permission)16 MetricsWrapper (com.earth2me.essentials.metrics.MetricsWrapper)14 Player (org.bukkit.entity.Player)14 Test (org.junit.Test)13 SimplePluginManager (org.bukkit.plugin.SimplePluginManager)12 Map (java.util.Map)11 File (java.io.File)9 IOException (java.io.IOException)9 World (org.bukkit.World)9 PluginCommand (org.bukkit.command.PluginCommand)9 Command (org.bukkit.command.Command)8 Listener (org.bukkit.event.Listener)8 PluginDescriptionFile (org.bukkit.plugin.PluginDescriptionFile)8 HashMap (java.util.HashMap)7 EventHandler (org.bukkit.event.EventHandler)7 ArrayList (java.util.ArrayList)6 Bukkit (org.bukkit.Bukkit)6