本文整理汇总了Java中org.bukkit.plugin.PluginManager.isPluginEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java PluginManager.isPluginEnabled方法的具体用法?Java PluginManager.isPluginEnabled怎么用?Java PluginManager.isPluginEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.plugin.PluginManager
的用法示例。
在下文中一共展示了PluginManager.isPluginEnabled方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
public void init() {
PluginManager pm = plugin.getServer().getPluginManager();
for (Hook hook : Hook.values()) {
try {
if (pm.isPluginEnabled(hook.getPluginName())) {
AbstractHook ah = make(hook.getClazz(), plugin);
if (ah != null) {
plugin.bindComposite(ah);
hooks.put(hook.getClazz(), ah);
}
plugin.getLogger().info("Hooked with " + hook.getPluginName() + "...");
}
} catch (Exception e) {
plugin.getLogger().severe("Exception thrown whilst hooking with " + hook.getPluginName() + "...");
e.printStackTrace();
}
}
}
示例2: loadDependencies
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
private void loadDependencies(){
PluginManager pm = Bukkit.getPluginManager();
if(pm.isPluginEnabled("IslandWorld")){
log("&eIslandWorld found, initializing support.");
IslandWorld = true;
log("&eIslandWorld support initialized.");
}
if(pm.isPluginEnabled("ASkyBlock")){
log("&eASkyBlock found, initializing support.");
ASkyBlock = true;
log("&eASkyBlock support initialized.");
}
if(pm.isPluginEnabled("uSkyBlock")){
log("&eUSkyBlock found, initializing support.");
USkyBlock = true;
log("&eUSkyBlock support initialized.");
}
if(!IslandWorld && !ASkyBlock && !USkyBlock){
log("&eNo SkyBlock plugins found, disabling island mode support.");
}
}
示例3: skipNightIfPossible
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
public boolean skipNightIfPossible(boolean bc) {
if (this.isNight()) {
int playerAmount = this.world.getPlayers().size();
PluginManager pm = Bukkit.getPluginManager();
if (PercentSleep.anyPluginsHooked) {
for (Player p : this.world.getPlayers()) {
if (ignoreAfk && pm.isPluginEnabled("Essentials") && PercentSleep.essentials.getUser(p).isAfk()) {
playerAmount--;
} else if (ignoreVanished && pm.isPluginEnabled("VanishNoPacket") && PercentSleep.vanish.getManager().isVanished(p)) {
playerAmount--;
} else if (ignoreVanished && (pm.isPluginEnabled("SuperVanish") || pm.isPluginEnabled("PremiumVanish")) && VanishAPI.isInvisible(p)) {
playerAmount--;
}
}
}
final int percentSleeping = (int) (((float) this.playersSleeping / (float) playerAmount) * 100.0f);
if (bc)
Bukkit.broadcastMessage(ChatColor.GOLD + "" + (percentSleeping) + "% are sleeping in " + this.displayName + " (" + this.percentageNeeded + "% needed).");
if (percentSleeping >= percentageNeeded) {
this.world.setTime(0);
if (this.skipStorms) this.world.setStorm(false);
this.playersSleeping = 0;
Bukkit.broadcastMessage(ChatColor.DARK_AQUA + "Skipping the night in " + this.displayName + ". Rise and shine!");
return true;
}
}
return false;
}
示例4: initVaultHook
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
public void initVaultHook() {
PluginManager pluginManager = getServer().getPluginManager();
if (!pluginManager.isPluginEnabled(VAULT_PLUGIN_NAME)) {
return;
}
// Vault seems to exist so retrieve an provider instance of Economy.class
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return;
}
usingVault = true;
econ = rsp.getProvider();
}
示例5: isRequirementsMet
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
public synchronized boolean isRequirementsMet(CommandSender sender, Command command, String... args) {
if (maintenanceMode && !(
(command instanceof AdminCommand && args != null && args.length > 0 && args[0].equals("maintenance")) ||
command instanceof SetMaintenanceCommand)) {
sender.sendMessage(tr("\u00a7cMAINTENANCE:\u00a7e uSkyBlock is currently in maintenance mode"));
return false;
}
if (missingRequirements == null) {
PluginManager pluginManager = getServer().getPluginManager();
missingRequirements = "";
for (String[] pluginReq : depends) {
if (pluginReq.length > 2 && pluginReq[2].equals("optional")) {
continue;
}
if (pluginManager.isPluginEnabled(pluginReq[0])) {
PluginDescriptionFile desc = pluginManager.getPlugin(pluginReq[0]).getDescription();
if (VersionUtil.getVersion(desc.getVersion()).isLT(pluginReq[1])) {
missingRequirements += tr("\u00a7buSkyBlock\u00a7e depends on \u00a79{0}\u00a7e >= \u00a7av{1}\u00a7e but only \u00a7cv{2}\u00a7e was found!\n", pluginReq[0], pluginReq[1], desc.getVersion());
}
} else {
missingRequirements += tr("\u00a7buSkyBlock\u00a7e depends on \u00a79{0}\u00a7e >= \u00a7av{1}", pluginReq[0], pluginReq[1]);
}
}
}
if (missingRequirements.isEmpty()) {
return true;
} else {
sender.sendMessage(missingRequirements.split("\n"));
return false;
}
}
示例6: checkRequirements
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
private boolean checkRequirements() {
// Check if plugin is enabled
if (!Config.getConfig().getBoolean("enabled")) {
this.onFirstStart();
this.getLogger().warning("Plugin is not enabled in config!");
this.setEnabled(false);
return false;
}
// Check version compatibility
if (!VersionHandler.checkVersion()) {
this.getLogger().warning("[RPGInventory] This version of RPG Inventory is not tested with \"" + Bukkit.getBukkitVersion() + "\"!");
}
// Check resource-pack settings
if (Config.getConfig().getBoolean("resource-pack.enabled", true)) {
String rpUrl = Config.getConfig().getString("resource-pack.url");
if (rpUrl.equals("PUT_YOUR_URL_HERE")) {
this.getLogger().warning("Set resource-pack's url in config!");
this.getPluginLoader().disablePlugin(this);
return false;
}
if (Config.getConfig().getString("resource-pack.hash").equals("PUT_YOUR_HASH_HERE")) {
this.getLogger().warning("Your resource pack hash incorrect!");
}
try {
ResourcePackUtils.validateUrl(rpUrl);
} catch (Exception e) {
String[] messageLines = e.getLocalizedMessage().split("\n");
this.getLogger().warning("");
this.getLogger().warning("######### Something wrong with your RP link! #########");
for (String line : messageLines) {
this.getLogger().warning("# " + line);
}
this.getLogger().warning("######################################################");
this.getLogger().warning("");
}
}
// Check dependencies
if (this.setupPermissions()) {
this.getLogger().info("Permissions hooked: " + perms.getName());
} else {
this.getLogger().warning("Permissions not found!");
return false;
}
if (this.setupEconomy()) {
this.getLogger().info("Economy hooked: " + economy.getName());
} else {
this.getLogger().warning("Economy not found!");
}
levelSystem = PlayerUtils.LevelSystem.valueOf(Config.getConfig().getString("level-system"));
classSystem = PlayerUtils.ClassSystem.valueOf(Config.getConfig().getString("class-system"));
PluginManager pm = this.getServer().getPluginManager();
if (levelSystem != PlayerUtils.LevelSystem.EXP && !pm.isPluginEnabled(levelSystem.getPluginName())) {
this.getLogger().warning("Level-system " + levelSystem.getPluginName() + " is not enabled!");
return false;
}
if (classSystem != PlayerUtils.ClassSystem.PERMISSIONS && !pm.isPluginEnabled(classSystem.getPluginName())) {
this.getLogger().warning("Class-system " + classSystem.getPluginName() + " is not enabled!");
return false;
}
return InventoryManager.init(this) && SlotManager.init();
}
示例7: onEnable
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public void onEnable() {
logger = Logger.getLogger("Minecraft");
messageManager = new MessageManager();
instance = this;
File file = new File(getDataFolder(), "locale_en.yml");
if (!file.exists()) {
System.out.print("[BlockParty] Default language file not found. Creating English locale_en.yml");
this.saveResource("locale_en.yml", false);
}
loadConfig();
messageManager.log("Plugin by " + getDescription().getAuthors());
getCommand("blockparty").setExecutor(new BlockPartyCommand());
PluginManager pm = getServer().getPluginManager();
pm.registerEvents(new DisconnectListener(), this);
pm.registerEvents(new CommandListener(), this);
pm.registerEvents(new MoveListener(), this);
pm.registerEvents(new SignListener(), this);
pm.registerEvents(new InteractListener(), this);
pm.registerEvents(new FeedListener(), this);
pm.registerEvents(new ChangeBlockListener(), this);
pm.registerEvents(new BlockPlaceListener(), this);
pm.registerEvents(new DamageListener(), this);
pm.registerEvents(new InventoryListener(), this);
noteBlockAPI = pm.isPluginEnabled("NoteBlockAPI");
pm.isPluginEnabled("BarAPI");
if (noteBlockAPI) {
for (Player p : Bukkit.getOnlinePlayers()) {
Songs.stop(p);
}
}
pdfFile = getDescription();
registerInventories();
inventoryManager = new InventoryManager(instance);
try {
new Metrics(this).start();
} catch (IOException e) {
}
}
示例8: onEnable
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
@Override
public void onEnable(){
conf.setupConfigYML();//Creates config file if not existant
conf.upgradeConfig();
conf.setupLocale();//Creates locale file if not existant
PluginManager pm = Bukkit.getServer().getPluginManager();
if(pm.isPluginEnabled("Lockette")){
pm.registerEvents(new ILListener(this), this);
log.info("Lockette detected, enabling Lockette support");
}
else if(pm.isPluginEnabled("LockettePro")){
pm.registerEvents(new ILPListener(this), this);
log.info("LockettePro detected, enabling LockettePro support");
}
getCommand("inactivelockette").setExecutor(new ILCommandHandler(this));//Firing commands listener
setupEconomy();//Setting up the economy
if (!setupEconomy() && getConfig().getBoolean("useEconomy")) {//If economy is turned on
//But no vault is found it will warn the user
log.severe(String.format("[%s] - No Vault dependency found!", getDescription().getName()));
return;
}
log.info(getDescription().getName() + " v" + getDescription().getVersion() + " has been enabled");//Logging to console the enabling of IL
try {
Metrics metrics = new Metrics(this);
metrics.start();
} catch (IOException e) {
//Failed to submit the stats
}
//Update Checking
if(getConfig().getBoolean("checkForUpdates")){
pm.registerEvents(new ILJoinListener(this, this.getFile()), this);
final ILMain plugin = this;
Bukkit.getScheduler().runTaskLaterAsynchronously(this, new Runnable () {
public void run() {
Updater updater = new Updater(plugin, 52457, plugin.getFile(), Updater.UpdateType.DEFAULT, false);
if(updater.getResult().equals(UpdateResult.UPDATE_AVAILABLE)){
log.info(ILConfigHandler.mes("onPluginLoad.updateAvailable") + " " + updater.getLatestName().replaceAll("[A-Za-z\\s]", ""));
log.info(ILConfigHandler.mes("onPluginLoad.updateAvailableLink") + " " + updater.getLatestFileLink());
}
}
},20L);
}
}
示例9: onEnable
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public void onEnable() {
logger = Logger.getLogger("Minecraft");
messageManager = new MessageManager();
instance = this;
File file = new File(getDataFolder(), "locale_en.yml");
if (!file.exists()) {
System.out.print("[BlockParty] Default language file not found. Creating English locale_en.yml");
this.saveResource("locale_en.yml", false);
}
loadConfig();
messageManager.log("Plugin by " + getDescription().getAuthors());
getCommand("blockparty").setExecutor(new BlockPartyCommand());
PluginManager pm = getServer().getPluginManager();
pm.registerEvents(new DisconnectListener(), this);
pm.registerEvents(new CommandListener(), this);
pm.registerEvents(new MoveListener(), this);
pm.registerEvents(new SignListener(), this);
pm.registerEvents(new InteractListener(), this);
pm.registerEvents(new FeedListener(), this);
pm.registerEvents(new ChangeBlockListener(), this);
pm.registerEvents(new BlockPlaceListener(), this);
pm.registerEvents(new DamageListener(), this);
pm.registerEvents(new InventoryListener(), this);
pm.registerEvents(new JoinListener(), this);
noteBlockAPI = pm.isPluginEnabled("NoteBlockAPI");
pm.isPluginEnabled("BarAPI");
if (noteBlockAPI) {
for (Player p : Bukkit.getOnlinePlayers()) {
Songs.stop(p);
}
}
pdfFile = getDescription();
registerInventories();
inventoryManager = new InventoryManager(instance);
statsManager = new StatsManager(instance);
try {
new Metrics(this).start();
} catch (IOException e) {
}
}