Search in sources :

Example 96 with PluginManager

use of org.bukkit.plugin.PluginManager in project Essentials by EssentialsX.

the class PermissionsDefaults method registerAllHatDefaults.

public static void registerAllHatDefaults() {
    final PluginManager pluginManager = Bukkit.getPluginManager();
    final Permission hatPerm = pluginManager.getPermission(Commandhat.PERM_PREFIX + "*");
    if (hatPerm != null) {
        return;
    }
    final ImmutableMap.Builder<String, Boolean> children = ImmutableMap.builder();
    for (final Material mat : Material.values()) {
        final String matPerm = Commandhat.PERM_PREFIX + mat.name().toLowerCase();
        children.put(matPerm, true);
        pluginManager.addPermission(new Permission(matPerm, "Prevent using " + mat + " as a type of hat.", PermissionDefault.FALSE));
    }
    pluginManager.addPermission(new Permission(Commandhat.PERM_PREFIX + "*", "Prevent all types of hats", PermissionDefault.FALSE, children.build()));
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) Permission(org.bukkit.permissions.Permission) Material(org.bukkit.Material) ImmutableMap(com.google.common.collect.ImmutableMap)

Example 97 with PluginManager

use of org.bukkit.plugin.PluginManager in project Essentials by EssentialsX.

the class Jails method registerListeners.

private void registerListeners() {
    enabled = true;
    final PluginManager pluginManager = ess.getServer().getPluginManager();
    final JailListener blockListener = new JailListener();
    pluginManager.registerEvents(blockListener, ess);
    if (ess.getSettings().isDebug()) {
        LOGGER.log(Level.INFO, "Registering Jail listener");
    }
}
Also used : PluginManager(org.bukkit.plugin.PluginManager)

Example 98 with PluginManager

use of org.bukkit.plugin.PluginManager in project Essentials by EssentialsX.

the class EssentialsChat method onEnable.

@Override
public void onEnable() {
    final PluginManager pluginManager = getServer().getPluginManager();
    ess = (IEssentials) pluginManager.getPlugin("Essentials");
    if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
        getLogger().log(Level.WARNING, tl("versionMismatchAll"));
    }
    if (!ess.isEnabled()) {
        this.setEnabled(false);
        return;
    }
    final Map<AsyncPlayerChatEvent, ChatStore> chatStore = Collections.synchronizedMap(new HashMap<>());
    final EssentialsChatPlayerListenerLowest playerListenerLowest = new EssentialsChatPlayerListenerLowest(getServer(), ess, chatStore);
    final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatStore);
    final EssentialsChatPlayerListenerHighest playerListenerHighest = new EssentialsChatPlayerListenerHighest(getServer(), ess, chatStore);
    pluginManager.registerEvents(playerListenerLowest, this);
    pluginManager.registerEvents(playerListenerNormal, this);
    pluginManager.registerEvents(playerListenerHighest, this);
    if (metrics == null) {
        metrics = new MetricsWrapper(this, 3814, false);
    }
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) AsyncPlayerChatEvent(org.bukkit.event.player.AsyncPlayerChatEvent) MetricsWrapper(com.earth2me.essentials.metrics.MetricsWrapper)

Example 99 with PluginManager

use of org.bukkit.plugin.PluginManager in project Essentials by EssentialsX.

the class EssentialsGeoIP method onEnable.

@Override
public void onEnable() {
    final PluginManager pm = getServer().getPluginManager();
    final IEssentials ess = (IEssentials) pm.getPlugin("Essentials");
    if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
        getLogger().log(Level.WARNING, tl("versionMismatchAll"));
    }
    if (!ess.isEnabled()) {
        this.setEnabled(false);
        return;
    }
    Logger.getLogger(com.fasterxml.jackson.databind.ext.Java7Support.class.getName()).setLevel(Level.SEVERE);
    final EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder(), ess);
    pm.registerEvents(playerListener, this);
    getLogger().log(Level.INFO, "This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com/.");
    if (metrics == null) {
        metrics = new MetricsWrapper(this, 3815, false);
    }
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) IEssentials(net.ess3.api.IEssentials) MetricsWrapper(com.earth2me.essentials.metrics.MetricsWrapper)

Example 100 with PluginManager

use of org.bukkit.plugin.PluginManager in project Essentials by EssentialsX.

the class EssentialsProtect method onEnable.

@Override
public void onEnable() {
    final PluginManager pm = this.getServer().getPluginManager();
    final Plugin essPlugin = pm.getPlugin("Essentials");
    if (essPlugin == null || !essPlugin.isEnabled()) {
        enableEmergencyMode(pm);
        return;
    }
    initialize(pm, essPlugin);
    if (metrics == null) {
        metrics = new MetricsWrapper(this, 3816, false);
    }
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) MetricsWrapper(com.earth2me.essentials.metrics.MetricsWrapper) Plugin(org.bukkit.plugin.Plugin) JavaPlugin(org.bukkit.plugin.java.JavaPlugin)

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