本文整理汇总了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;
}
示例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();
}
}
示例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;
}
示例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");
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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;
}
}
示例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));
}
示例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));
}
示例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);
}
}
}
}