本文整理匯總了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);
}
}
}
}