當前位置: 首頁>>代碼示例>>Java>>正文


Java Plugin.isEnabled方法代碼示例

本文整理匯總了Java中org.bukkit.plugin.Plugin.isEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java Plugin.isEnabled方法的具體用法?Java Plugin.isEnabled怎麽用?Java Plugin.isEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.plugin.Plugin的用法示例。


在下文中一共展示了Plugin.isEnabled方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onTabComplete

import org.bukkit.plugin.Plugin; //導入方法依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, String[] args) {
	if (args.length <= 1) {
		return COMPLETION_LIST;
	}

	// 延遲加載, 因為此類構造方法被調用時, 插件可能還沒全部 enable
	if (pluginNames == null) {
		pluginNames = new ArrayList<>();
		for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
			if (plugin.isEnabled()) {
				pluginNames.add(plugin.getName());
			}
		}
	}

	return pluginNames;
}
 
開發者ID:jiongjionger,項目名稱:NeverLag,代碼行數:19,代碼來源:CommandTimings.java

示例2: enablePlugins

import org.bukkit.plugin.Plugin; //導入方法依賴的package包/類
public void enablePlugins(PluginLoadOrder type) {
    // Cauldron start - initialize mod wrappers
    org.bukkit.craftbukkit.block.CraftBlock.initMappings();
    org.bukkit.craftbukkit.entity.CraftEntity.initMappings();
    // Cauldron end
    if (type == PluginLoadOrder.STARTUP) {
        helpMap.clear();
        helpMap.initializeGeneralTopics();
    }

    Plugin[] plugins = pluginManager.getPlugins();

    for (Plugin plugin : plugins) {
        if ((!plugin.isEnabled()) && (plugin.getDescription().getLoad() == type)) {
            loadPlugin(plugin);
        }
    }

    if (type == PluginLoadOrder.POSTWORLD) {
        commandMap.setFallbackCommands();
        setVanillaCommands();
        commandMap.registerServerAliases();
        loadCustomPermissions();
        DefaultPermissions.registerCorePermissions();
        helpMap.initializeCommands();
    }
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:28,代碼來源:CraftServer.java

示例3: getGenerator

import org.bukkit.plugin.Plugin; //導入方法依賴的package包/類
public ChunkGenerator getGenerator(String world) {
    ConfigurationSection section = configuration.getConfigurationSection("worlds");
    ChunkGenerator result = null;

    if (section != null) {
        section = section.getConfigurationSection(world);

        if (section != null) {
            String name = section.getString("generator");

            if ((name != null) && (!name.equals(""))) {
                String[] split = name.split(":", 2);
                String id = (split.length > 1) ? split[1] : null;
                Plugin plugin = pluginManager.getPlugin(split[0]);

                if (plugin == null) {
                    getLogger().severe("Could not set generator for default world '" + world + "': Plugin '" + split[0] + "' does not exist");
                } else if (!plugin.isEnabled()) {
                    getLogger().severe("Could not set generator for default world '" + world + "': Plugin '" + plugin.getDescription().getFullName() + "' is not enabled yet (is it load:STARTUP?)");
                } else {
                    try {
                        result = plugin.getDefaultWorldGenerator(world, id);
                        if (result == null) {
                            getLogger().severe("Could not set generator for default world '" + world + "': Plugin '" + plugin.getDescription().getFullName() + "' lacks a default world generator");
                        }
                    } catch (Throwable t) {
                        plugin.getLogger().log(Level.SEVERE, "Could not set generator for default world '" + world + "': Plugin '" + plugin.getDescription().getFullName(), t);
                    }
                }
            }
        }
    }

    return result;
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:36,代碼來源:CraftServer.java

示例4: validate

import org.bukkit.plugin.Plugin; //導入方法依賴的package包/類
private static void validate(final Plugin plugin, final Object task) {
    Validate.notNull(plugin, "Plugin cannot be null");
    Validate.notNull(task, "Task cannot be null");
    if (!plugin.isEnabled()) {
        throw new IllegalPluginAccessException("Plugin attempted to register task while disabled");
    }
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:8,代碼來源:CraftScheduler.java

示例5: disable

import org.bukkit.plugin.Plugin; //導入方法依賴的package包/類
public static void disable() {
	enable = false;
	for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
		if (plugin != null && plugin.isEnabled()) {
			EventExecutorInjector.uninject(plugin);
			SchedulerTaskInjector.uninject(plugin);
			CommandInjector.uninject(plugin);
		}
	}
}
 
開發者ID:GelandiAssociation,項目名稱:EscapeLag,代碼行數:11,代碼來源:MonitorUtils.java

示例6: enable

import org.bukkit.plugin.Plugin; //導入方法依賴的package包/類
public static void enable() {
	enable = true;
	enable_time = System.currentTimeMillis();
	for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
		if (plugin != null && plugin.isEnabled()) {
			EventExecutorInjector.inject(plugin);
			SchedulerTaskInjector.inject(plugin);
			CommandInjector.inject(plugin);
		}
	}
}
 
開發者ID:GelandiAssociation,項目名稱:EscapeLag,代碼行數:12,代碼來源:MonitorUtils.java

示例7: isDynmapEnabled

import org.bukkit.plugin.Plugin; //導入方法依賴的package包/類
/**
 * @return
 * if Dynmap layers shall be enabled
 */
public boolean isDynmapEnabled() {
    Plugin dynmap = Bukkit.getServer().getPluginManager().getPlugin("dynmap");
    if (dynmap == null || !dynmap.isEnabled()) {
        return false;
    } else {
        return dynmapEnabled;
    }
}
 
開發者ID:DRE2N,項目名稱:FactionsXL,代碼行數:13,代碼來源:FConfig.java

示例8: onEnable

import org.bukkit.plugin.Plugin; //導入方法依賴的package包/類
@Override
public void onEnable() {
	File file = new File(getDataFolder(), "config.yml");
	if(!file.exists()) {
		this.getConfig().options().copyDefaults(true);
		this.saveConfig();
	}
    Cooldowns.createCooldown("medic_cooldown");

    HCF.plugin = this;
    BasePlugin.getPlugin().init(this);

    ProtocolLibHook.hook(this);

    Plugin wep = getServer().getPluginManager().getPlugin("WorldEdit");
    this.worldEdit = wep instanceof WorldEditPlugin && wep.isEnabled() ? (WorldEditPlugin) wep : null;
    CustomEntityRegistration.registerCustomEntities();

    SettingsYML.init(this);
    this.effectRestorer = new EffectRestorer(this);
    this.registerConfiguration();
    this.registerCommands();
    this.registerManagers();
    this.registerListeners();
    
    this.resetGlowstoneMountain();

    new BukkitRunnable() {
        @Override
        public void run() {
            getServer().broadcast(ChatColor.GREEN.toString() + ChatColor.BOLD + "Saving!" + "\n" + ChatColor.GREEN + "Saved all faction and player data to the database." + "\n" + ChatColor.GRAY + "Current TPS: " + ChatColor.GRAY, "hcf.seesaves");
            saveData();
        }
    }.runTaskTimerAsynchronously(plugin, TimeUnit.MINUTES.toMillis(10L), TimeUnit.MINUTES.toMillis(10L));
    
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:37,代碼來源:HCF.java

示例9: onEnable

import org.bukkit.plugin.Plugin; //導入方法依賴的package包/類
@Override
public void onEnable() {
    Cooldowns.createCooldown("medic_cooldown");

    HCF.plugin = this;
    BasePlugin.getPlugin().init(this);

    ProtocolLibHook.hook(this);

    Plugin wep = getServer().getPluginManager().getPlugin("WorldEdit");
    this.worldEdit = wep instanceof WorldEditPlugin && wep.isEnabled() ? (WorldEditPlugin) wep : null;
    CustomEntityRegistration.registerCustomEntities();
    
    this.craftBukkitVersion = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];

    SettingsYML.init(this);
    this.effectRestorer = new EffectRestorer(this);
    this.registerConfiguration();
    this.registerCommands();
    this.registerManagers();
    this.registerListeners();
    
    this.setupPermissions();

    new BukkitRunnable() {
        @Override
        public void run() {
            getServer().broadcast(ChatColor.GREEN.toString() + ChatColor.BOLD + "Saving!" + "\n" + ChatColor.GREEN + "Saved all faction and player data to the database." + "\n" + ChatColor.GRAY + "Current TPS: " + ChatColor.GRAY, "hcf.seesaves");
            saveData();
        }
    }.runTaskTimerAsynchronously(plugin, TimeUnit.MINUTES.toMillis(10L), TimeUnit.MINUTES.toMillis(10L));
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:33,代碼來源:HCF.java

示例10: setPermsSystem

import org.bukkit.plugin.Plugin; //導入方法依賴的package包/類
public void setPermsSystem() {
	PluginManager pm = Bukkit.getServer().getPluginManager();
	for(Plugin pl : pm.getPlugins()){
		if(pl.isEnabled()){
			String plName = pl.getName();
			if(app.contains(plName)){
				permsPlugin = pm.getPlugin(plName);
			}
		}
	}
}
 
開發者ID:DiscowZombie,項目名稱:UltimateTs,代碼行數:12,代碼來源:PermsManager.java


注:本文中的org.bukkit.plugin.Plugin.isEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。