本文整理汇总了Java中org.bukkit.plugin.PluginManager.getPlugin方法的典型用法代码示例。如果您正苦于以下问题:Java PluginManager.getPlugin方法的具体用法?Java PluginManager.getPlugin怎么用?Java PluginManager.getPlugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.plugin.PluginManager
的用法示例。
在下文中一共展示了PluginManager.getPlugin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onEnable
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
@Override
public void onEnable() {
final PluginManager pm = getServer().getPluginManager();
this.dynmap = pm.getPlugin("dynmap");
if (this.dynmap == null) {
severe("Dynmap not found, disabling Plot2Dynmap");
return;
}
this.dynAPI = (DynmapAPI) this.dynmap;
this.plot2 = pm.getPlugin("PlotSquared");
getServer().getPluginManager().registerEvents(this, this);
if (this.dynmap.isEnabled() && this.plot2.isEnabled()) {
initialize();
}
}
示例2: setPermsSystem
import org.bukkit.plugin.PluginManager; //导入方法依赖的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);
}
}
}
}
示例3: onEnable
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
@Override
public void onEnable() {
this.saveDefaultConfig();
Bukkit.getServer().getPluginManager().registerEvents(new PercentSleepListener(this), this);
plugin = this;
PluginManager pm = Bukkit.getServer().getPluginManager();
// Hook Vanish/Essentials listeners if the plugins exist
essentials = (IEssentials) Bukkit.getServer().getPluginManager().getPlugin("Essentials");
if (essentials != null) {
pm.registerEvents(new PercentSleepEssentialsListener(this), this);
anyPluginsHooked = true;
this.getLogger().info("Hooked into Essentials");
}
vanish = (VanishPlugin) Bukkit.getServer().getPluginManager().getPlugin("VanishNoPacket");
if (vanish != null) {
pm.registerEvents(new PercentSleepVanishListener(this), this);
anyPluginsHooked = true;
this.getLogger().info("Hooked into VanishNoPacket");
}
if (pm.getPlugin("SuperVanish") != null || pm.getPlugin("PremiumVanish") != null) {
pm.registerEvents(new SVListener(this), this);
anyPluginsHooked = true;
this.getLogger().info("Hooked into SuperVanish/PremiumVanish");
}
final List<World> worlds = Bukkit.getWorlds();
final List<String> ignored = this.getConfig().getStringList("ignored-worlds");
for (World w: worlds) {
if (w.getEnvironment().equals(World.Environment.NORMAL) && !ignored.contains(w.getName())) {
this.worlds.put(w.getName(), new PercentSleepWorld(w));
}
}
}
示例4: onEnable
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
@Override
public void onEnable() {
testCompat();
if (!isEnabled()) return;
manager = new NametagManager(this);
handler = new NametagHandler(this, manager);
PluginManager pluginManager = Bukkit.getPluginManager();
if (checkShouldRegister("zPermissions")) {
pluginManager.registerEvents(new HookZPermissions(handler), this);
} else if (checkShouldRegister("PermissionsEx")) {
pluginManager.registerEvents(new HookPermissionsEX(handler), this);
} else if (checkShouldRegister("GroupManager")) {
pluginManager.registerEvents(new HookGroupManager(handler), this);
} else if (checkShouldRegister("LuckPerms")) {
pluginManager.registerEvents(new HookLuckPerms(handler), this);
}
if (pluginManager.getPlugin("LibsDisguises") != null) {
pluginManager.registerEvents(new HookLibsDisguise(this), this);
}
getCommand("ne").setExecutor(new NametagCommand(handler));
if (api == null) {
api = new NametagAPI(handler, manager);
}
}
示例5: loadArenaListeners
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
/**
* Loads listeners for the Arena plugins.
*
* @param plugin the floAuction instance to pass into the listener
*/
public static void loadArenaListeners(FloAuction plugin)
{
PluginManager pluginManager = Bukkit.getPluginManager();
// Load plugins
if (ArenaManager.mobArena == null)
{
mobArena = (MobArena) pluginManager.getPlugin("MobArena");
}
if (ArenaManager.mobArena != null)
{
if(!ArenaManager.mobArenaListenerEnabled)
{
pluginManager.registerEvents(new MobArenaListener(), plugin);
ArenaManager.mobArenaListenerEnabled = true;
}
}
if (ArenaManager.pvpArena == null)
{
ArenaManager.pvpArena = (PVPArena) pluginManager.getPlugin("pvparena");
}
if (ArenaManager.pvpArena != null)
{
if(!ArenaManager.pvpArenaListenerEnabled)
{
pluginManager.registerEvents(new PvpArenaListener(), plugin);
ArenaManager.pvpArenaListenerEnabled = true;
}
}
}
示例6: loadArenaPlugins
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
/**
* Attempts to load arena plugins.
*/
public static void loadArenaPlugins()
{
PluginManager pluginManager = Bukkit.getPluginManager();
// Load plugins
if (mobArena == null)
{
mobArena = (MobArena) pluginManager.getPlugin("MobArena");
}
if (pvpArena == null)
{
pvpArena = (PVPArena) pluginManager.getPlugin("pvparena");
}
if (war == null)
{
war = (War) pluginManager.getPlugin("MobDungeon");
}
// Unload if not enabled
if (mobArena != null && !mobArena.isEnabled())
{
mobArena = null;
}
if (pvpArena != null && !pvpArena.isEnabled())
{
pvpArena = null;
}
if (war != null && !war.isEnabled())
{
war = null;
}
}
示例7: registerWorldGuard
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
/**
* World Guard Dependence
*/
private void registerWorldGuard(){
PluginManager PM = this.getServer().getPluginManager();
if(PM.getPlugin("WorldGuard") != null){
wgp = (WorldGuardPlugin) PM.getPlugin("WorldGuard");
console(ChatColor.GREEN + "WorldGuard Detected");
return;
}else{
console(ChatColor.RED + "WorldGuard Not Found - Please enable WorldGuard");
return;
}
}
示例8: isInit
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
public static boolean isInit()
{
PluginManager pluginManager = Bukkit.getPluginManager();
Plugin pvpToggle = pluginManager.getPlugin("PvpToggle");
if(pvpToggle == null || !(pvpToggle instanceof PvpToggle))
return false;
return true;
}
示例9: onEnable
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
@Override
public void onEnable() {
log.info("enabled...");
PluginManager pm = getServer().getPluginManager();
dynmap = pm.getPlugin("dynmap");
api = (DynmapAPI)dynmap;
civcraft = pm.getPlugin("civcraft");
markerapi = api.getMarkerAPI();
townBorderSet = markerapi.createMarkerSet("townborder.markerset", "Town Borders", null, false);
townBorderSet.setLayerPriority(10);
townBorderSet.setHideByDefault(false);
cultureSet = markerapi.createMarkerSet("townculture.markerset", "Culture", null, false);
cultureSet.setLayerPriority(15);
cultureSet.setHideByDefault(false);
structureSet = markerapi.createMarkerSet("structures.markerset", "Structures", null, false);
structureSet.setLayerPriority(20);
structureSet.setHideByDefault(false);
getServer().getScheduler().scheduleSyncRepeatingTask(this,
new CivCraftUpdateTask(this.api, this.markerapi, this.townBorderSet, this.cultureSet, this.structureSet), 40, 40);
}
示例10: setupHooks
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
/**
* Setup PlotMe plugin hooks
*/
@Override
public void setupHooks() {
PluginManager pluginManager = plotMeCorePlugin.getServer().getPluginManager();
if (pluginManager.getPlugin("WorldEdit") != null) {
WorldEdit.getInstance().getEventBus().register(new PlotWorldEditListener(plotMeCorePlugin.getAPI()));
}
setUsingLwc(pluginManager.getPlugin("LWC") != null);
}
示例11: onLoad
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
@Override
public void onLoad()
{
// Vault Integration
PluginManager pm = getServer().getPluginManager();
if (pm.getPlugin("Vault") != null)
{
try
{
VaultHandler.setupIntegration(this);
} catch (Throwable ex) { }
}
}
示例12: onEnable
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
@Override
public void onEnable() {
this.c = new Config(this);
this.api = new RoyalEconomyAPI(this);
this.saveLangFile("en_us");
try {
new Language.LanguageHelper(new File(this.getDataFolder(), this.getConf().getLanguageFile()));
} catch (IOException e) {
this.getLogger().severe("Could not load language file: " + e.getMessage());
this.getLogger().severe("Disabling plugin.");
this.setEnabled(false);
}
final BukkitScheduler bs = this.getServer().getScheduler();
bs.scheduleSyncRepeatingTask(this, new UserdataSaver(), 12000L, 12000L);
final PluginManager pm = this.getServer().getPluginManager();
pm.registerEvents(new AccountListener(this), this);
if (pm.getPlugin("Vault") != null && pm.getPlugin("Vault").getClass().getName().equalsIgnoreCase("net.milkbowl.vault.Vault")) {
VaultConnector.register(this);
}
this.registerCommand(new CmdBalance(this), "balance", this);
this.registerCommand(new CmdModifyBalance(this), "modifybalance", this);
this.registerCommand(new CmdSetBalance(this), "setbalance", this);
this.registerCommand(new CmdTransfer(this), "transfer", this);
this.registerCommand(new CmdRoyalEconomy(this), "royaleconomy", this);
}
示例13: onEnable
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
public void onEnable() {
defaultConfig();
players = new Players(this);
PluginManager pm = getServer().getPluginManager();
Plugin plugin = pm.getPlugin("MyVIP");
if (plugin != null) {
myVIP = (iMyVIP) plugin;
}
colorListener = new ColorListener(this);
pm.registerEvents(colorListener, this);
playerListener = new PlayerListener(this);
pm.registerEvents(playerListener, this);
if(config.getBoolean("rpg.enable")) {
Mobs.load(this);
pm.registerEvents(new RpgListener(this), this);
} else {
log("MyLineagePvpSystem: Rpg game disabled by config (rpg.enable)", ANSI_RED);
}
getCommand("pvpstatus").setExecutor(new PvpStatusCommand(this));
getCommand("pvpspawn").setExecutor(new PvpSpawnCommand(this));
getCommand("pvpsoe").setExecutor(new PvpSoeCommand(this));
getCommand("pvpcall").setExecutor(new PvpCallCommand(this));
getCommand("pvphome").setExecutor(new PvpHomeCommand(this));
log("MyLineagePvpSystem has been enabled!");
taskId = getServer().getScheduler().scheduleSyncRepeatingTask(this, new ColorTask(this), 0, 20);
taskIdSoe = getServer().getScheduler().scheduleSyncRepeatingTask(this, new TickerTask(this), 0, 20);
}
示例14: setupHookBooleans
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
public void setupHookBooleans() {
PluginManager plManager = Bukkit.getServer().getPluginManager();
this.usingLiteBans = plManager.getPlugin("LiteBans") != null;
this.usingBanManager = plManager.getPlugin("BanManager") != null;
this.usingEssentials = (plManager.getPlugin("Essentials") != null || plManager.getPlugin("EssentialsX") != null);
}
示例15: onEnable
import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
public void onEnable() {
setPlugin(this);
PluginManager pluginManager = getServer().getPluginManager();
Plugin pluginVault = pluginManager.getPlugin("Vault");
Plugin pluginWorldGuard = pluginManager.getPlugin("WorldGuard");
Set<String> pluginList = new HashSet<>();
if (!new File(getPlugin().getDataFolder(), "config.yml").exists())
getPlugin().saveResource("config.yml", false);
initMaterials();
for (PluginRegisters.RegisterType register : PluginRegisters.RegisterType.values())
registerMap.put(register.toString(), new PluginRegisters().registerAll(getPlugin(), register));
setChestDonationInventory(Bukkit.createInventory(getChestDonationHolder(),
getPlugin().getConfig().getInt("dchest.size"), ChestLanguage.N_DCHEST));
setChestRandomInventory(Bukkit.createInventory(getChestRandomHolder(),
getPlugin().getConfig().getInt("rchest.size"), ChestLanguage.N_RCHEST));
setChestShuffleInventory(Bukkit.createInventory(null,
getPlugin().getConfig().getInt("schest.size"), ChestLanguage.N_SCHEST));
setChestSwapInventory(Bukkit.createInventory(getChestSwapHolder(),
getPlugin().getConfig().getInt("wchest.size"), ChestLanguage.N_WCHEST));
setChestDonationHolder(chestDonationHolder);
setChestRandomHolder(chestRandomHolder);
setChestSwapHolder(chestSwapHolder);
chestSwapBusy = false;
if (pluginVault != null) {
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(
net.milkbowl.vault.economy.Economy.class);
if (economyProvider != null) {
setVaultEconomy(economyProvider.getProvider());
pluginList.add("Vault");
}
}
if (pluginWorldGuard != null) {
setWorldGuard((WorldGuardPlugin) pluginWorldGuard);
pluginList.add("WorldGuard");
}
for (String c : new String[]{"", "d", "e", "h", "m", "r", "s", "v", "w", "x"}) {
chestLockoutMap.put(c + "chest", new ConcurrentHashMap<>());
chestTypeEnabled.put(c + "chest", getPlugin().getConfig().getBoolean(c + "chest.enabled"));
getCommand(c + "chest").setExecutor(new ChestExecutor());
}
chestLockoutMap.put("dchest_itemlock", new ConcurrentHashMap<>());
getPlugin().getLogger().log(Level.INFO, "[" + plugin.getName() + "] "
+ "Events: " + registerMap.get(PluginRegisters.RegisterType.EVENT.toString()) + " | "
+ "Tasks: " + registerMap.get(PluginRegisters.RegisterType.TASK.toString()));
if (pluginList.size() > 0)
getPlugin().getLogger().log(Level.INFO,
"[" + plugin.getName() + "] Hooked: " + StringUtils.join(pluginList, ", "));
new BukkitRunnable() {
@Override
public void run() {
displayClearMessage = true;
}
}.runTaskLater(plugin, 100);
}