Search in sources :

Example 36 with PluginManager

use of org.bukkit.plugin.PluginManager in project Magma-1.16.x by magmafoundation.

the class Permission method addParent.

/**
 * Adds this permission to the specified parent permission.
 * <p>
 * If the parent permission does not exist, it will be created and
 * registered.
 *
 * @param name Name of the parent permission
 * @param value The value to set this permission to
 * @return Parent permission it created or loaded
 */
@NotNull
public Permission addParent(@NotNull String name, boolean value) {
    PluginManager pm = Bukkit.getServer().getPluginManager();
    String lname = name.toLowerCase(java.util.Locale.ENGLISH);
    Permission perm = pm.getPermission(lname);
    if (perm == null) {
        perm = new Permission(lname);
        pm.addPermission(perm);
    }
    addParent(perm, value);
    return perm;
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) NotNull(org.jetbrains.annotations.NotNull)

Example 37 with PluginManager

use of org.bukkit.plugin.PluginManager in project LoliServer by Loli-Server.

the class Permission method addParent.

/**
 * Adds this permission to the specified parent permission.
 * <p>
 * If the parent permission does not exist, it will be created and
 * registered.
 *
 * @param name Name of the parent permission
 * @param value The value to set this permission to
 * @return Parent permission it created or loaded
 */
@NotNull
public Permission addParent(@NotNull String name, boolean value) {
    PluginManager pm = Bukkit.getServer().getPluginManager();
    String lname = name.toLowerCase(java.util.Locale.ENGLISH);
    Permission perm = pm.getPermission(lname);
    if (perm == null) {
        perm = new Permission(lname);
        pm.addPermission(perm);
    }
    addParent(perm, value);
    return perm;
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) NotNull(org.jetbrains.annotations.NotNull)

Example 38 with PluginManager

use of org.bukkit.plugin.PluginManager in project LevelTools by byteful.

the class LevelToolsPlugin method registerListeners.

private void registerListeners() {
    final PluginManager pm = Bukkit.getPluginManager();
    pm.registerEvents(new BlockEventListener(), this);
    pm.registerEvents(new EntityEventListener(), this);
    pm.registerEvents(new AnvilListener(), this);
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) EntityEventListener(me.byteful.plugin.leveltools.listeners.EntityEventListener) BlockEventListener(me.byteful.plugin.leveltools.listeners.BlockEventListener) AnvilListener(me.byteful.plugin.leveltools.listeners.AnvilListener)

Example 39 with PluginManager

use of org.bukkit.plugin.PluginManager in project TARDIS by eccentricdevotion.

the class TARDISBlockLogger method enableLogger.

public void enableLogger() {
    PluginManager pm = plugin.getServer().getPluginManager();
    if (pm.isPluginEnabled("CoreProtect")) {
        CoreProtect cp = (CoreProtect) pm.getPlugin("CoreProtect");
        // Check that CoreProtect is loaded
        if (cp == null || !(cp instanceof CoreProtect)) {
            return;
        }
        // Check that the API is enabled
        CoreProtectAPI CoreProtect = cp.getAPI();
        if (!CoreProtect.isEnabled()) {
            return;
        }
        // Check that a compatible version of the API is loaded
        if (CoreProtect.APIVersion() < 6) {
            return;
        }
        plugin.getServer().getConsoleSender().sendMessage(plugin.getPluginName() + "Connecting to CoreProtect");
        coreProtectAPI = CoreProtect;
        logging = true;
    }
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) CoreProtect(net.coreprotect.CoreProtect) CoreProtectAPI(net.coreprotect.CoreProtectAPI)

Example 40 with PluginManager

use of org.bukkit.plugin.PluginManager in project EpicVouchers by songoda.

the class EpicVouchers method onPluginEnable.

@Override
public void onPluginEnable() {
    // Run Songoda Updater
    SongodaCore.registerPlugin(this, 25, CompatibleMaterial.EMERALD);
    // Setup Config
    Settings.setupConfig();
    this.setLocale(Settings.LANGUGE_MODE.getString(), false);
    // Register commands
    this.commandManager = new CommandManager(this);
    this.commandManager.addCommand(new CommandEpicVouchers(this)).addSubCommands(new CommandEditor(this), new CommandForce(this), new CommandForceAll(this), new CommandGive(this), new CommandGiveAll(this), new CommandList(this), new CommandReload(this));
    FastInv.init(this);
    IconInv.init(this);
    this.connections = new Connections(this);
    this.coolDowns = new CoolDownManager(this);
    this.voucherExecutor = new VoucherExecutor(this);
    this.voucherManager = new VoucherManager();
    PluginManager manager = Bukkit.getServer().getPluginManager();
    // Listeners
    guiManager.init();
    manager.registerEvents(new PlayerInteractListener(this), this);
    manager.registerEvents(new PlayerCommandListener(), this);
}
Also used : CommandGiveAll(com.songoda.epicvouchers.commands.CommandGiveAll) CommandReload(com.songoda.epicvouchers.commands.CommandReload) Connections(com.songoda.epicvouchers.handlers.Connections) CoolDownManager(com.songoda.epicvouchers.voucher.CoolDownManager) CommandForce(com.songoda.epicvouchers.commands.CommandForce) PlayerCommandListener(com.songoda.epicvouchers.listeners.PlayerCommandListener) CommandList(com.songoda.epicvouchers.commands.CommandList) CommandForceAll(com.songoda.epicvouchers.commands.CommandForceAll) VoucherManager(com.songoda.epicvouchers.voucher.VoucherManager) VoucherExecutor(com.songoda.epicvouchers.voucher.VoucherExecutor) PluginManager(org.bukkit.plugin.PluginManager) CommandManager(com.songoda.core.commands.CommandManager) CommandGive(com.songoda.epicvouchers.commands.CommandGive) PlayerInteractListener(com.songoda.epicvouchers.listeners.PlayerInteractListener) CommandEpicVouchers(com.songoda.epicvouchers.commands.CommandEpicVouchers) CommandEditor(com.songoda.epicvouchers.commands.CommandEditor)

Aggregations

PluginManager (org.bukkit.plugin.PluginManager)249 Plugin (org.bukkit.plugin.Plugin)40 Player (org.bukkit.entity.Player)34 JavaPlugin (org.bukkit.plugin.java.JavaPlugin)24 Before (org.junit.Before)24 Permission (org.bukkit.permissions.Permission)21 World (org.bukkit.World)20 BentoBox (world.bentobox.bentobox.BentoBox)20 UUID (java.util.UUID)19 Test (org.junit.Test)18 File (java.io.File)17 HashMap (java.util.HashMap)17 IOException (java.io.IOException)16 Server (org.bukkit.Server)16 Location (org.bukkit.Location)15 BukkitScheduler (org.bukkit.scheduler.BukkitScheduler)15 MetricsWrapper (com.earth2me.essentials.metrics.MetricsWrapper)14 Map (java.util.Map)14 User (world.bentobox.bentobox.api.user.User)14 IslandWorldManager (world.bentobox.bentobox.managers.IslandWorldManager)14