当前位置: 首页>>代码示例>>Java>>正文


Java Bukkit.getPluginManager方法代码示例

本文整理汇总了Java中org.bukkit.Bukkit.getPluginManager方法的典型用法代码示例。如果您正苦于以下问题:Java Bukkit.getPluginManager方法的具体用法?Java Bukkit.getPluginManager怎么用?Java Bukkit.getPluginManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.Bukkit的用法示例。


在下文中一共展示了Bukkit.getPluginManager方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onExecute

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public void onExecute(String[] args, CommandSender sender) {
    PluginManager plugins = Bukkit.getPluginManager();

    DataReloadEvent event = new DataReloadEvent();
    plugins.callEvent(event);
    if (event.isCancelled()) {
        return;
    }

    plugin.onDisable();
    plugin.loadCore();

    MessageUtil.sendPluginTag(sender, plugin);
    MessageUtil.sendCenteredMessage(sender, FMessage.CMD_RELOAD_DONE.getMessage());
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:17,代码来源:ReloadCommand.java

示例2: getCommandMap

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public CommandMap getCommandMap() {
    if (!(Bukkit.getPluginManager() instanceof SimplePluginManager)) {
        this.plugin.getLogger().warning("Seems like your server is using a custom PluginManager? Well let's try injecting our custom commands anyways...");
    }

    CommandMap map = null;

    try {
        map = SERVER_COMMAND_MAP.get(Bukkit.getPluginManager());

        if (map == null) {
            if (fallback != null) {
                return fallback;
            } else {
                fallback = map = new SimpleCommandMap(EchoPet.getPlugin().getServer());
                Bukkit.getPluginManager().registerEvents(new FallbackCommandRegistrationListener(fallback), this.plugin);
            }
        }
    } catch (Exception pie) {
        this.plugin.getLogger().warning("Failed to dynamically register the commands! Let's give it a last shot...");
        // Hmmm.... Pie...
        fallback = map = new SimpleCommandMap(EchoPet.getPlugin().getServer());
        Bukkit.getPluginManager().registerEvents(new FallbackCommandRegistrationListener(fallback), this.plugin);
    }
    return map;
}
 
开发者ID:Borlea,项目名称:EchoPet,代码行数:27,代码来源:CommandManager.java

示例3: registerListeners

import org.bukkit.Bukkit; //导入方法依赖的package包/类
private void registerListeners() {
	final PluginManager pm = Bukkit.getPluginManager();

	final BehaviourListeners behaviourListeners = new BehaviourListeners();
	behaviourListeners.registerPacketListeners();

	pm.registerEvents(behaviourListeners, this);
	pm.registerEvents(new DetectionListener(), this);
}
 
开发者ID:davidm98,项目名称:Crescent,代码行数:10,代码来源:Crescent.java

示例4: registerEvents

import org.bukkit.Bukkit; //导入方法依赖的package包/类
private void registerEvents() {
	PluginManager manager = Bukkit.getPluginManager();
	
	manager.registerEvents(new Logcat(),			this);
	manager.registerEvents(new Operator(),			this);
	manager.registerEvents(new AverageJoe(this),	this);
}
 
开发者ID:ramidzkh,项目名称:Bssentials-Reloaded,代码行数:8,代码来源:Bssentials.java

示例5: getCommandMap

import org.bukkit.Bukkit; //导入方法依赖的package包/类
private static CommandMap getCommandMap() {
    CommandMap commandMap = null;
    try {
        if (Bukkit.getPluginManager() instanceof SimplePluginManager) {
            Field f = SimplePluginManager.class.getDeclaredField("commandMap");
            f.setAccessible(true);
            commandMap = (CommandMap) f.get(Bukkit.getPluginManager());
        }
    } catch (SecurityException | IllegalArgumentException | IllegalAccessException | NoSuchFieldException e) {
        e.printStackTrace();
    }
    return commandMap;
}
 
开发者ID:cadox8,项目名称:WC,代码行数:14,代码来源:WCCommands.java

示例6: InventoryManager

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public InventoryManager(SmartInvsPlugin plugin) {
    this.plugin = plugin;
    this.pluginManager = Bukkit.getPluginManager();

    this.inventories = new HashMap<>();
    this.contents = new HashMap<>();

    this.defaultOpeners = Arrays.asList(
            new ChestInventoryOpener(),
            new SpecialInventoryOpener()
    );

    this.openers = new ArrayList<>();
}
 
开发者ID:MinusKube,项目名称:SmartInvs,代码行数:15,代码来源:InventoryManager.java

示例7: CombustionListener

import org.bukkit.Bukkit; //导入方法依赖的package包/类
/**
 * Constructor
 * 
 * @author HomieDion
 * @since 1.1.0
 */
public CombustionListener() {
	//Variables
	Sunscreen plugin = Sunscreen.getInstance();
	PluginManager pm = Bukkit.getPluginManager();
	
	settings = plugin.getSettings();
	pm.registerEvents(this, plugin);
}
 
开发者ID:homiedion,项目名称:Sunscreen,代码行数:15,代码来源:CombustionListener.java

示例8: registerEvents

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public void registerEvents() {
	PluginManager pm = Bukkit.getPluginManager();
	pm.registerEvents(new BasicFeatures(), pl);
	pm.registerEvents(new OnJoin(), pl);
	pm.registerEvents(new OnQuit(), pl);
	pm.registerEvents(new OnChat(), pl);
	pm.registerEvents(new FunFeatures(), pl);
	pm.registerEvents(new LittlesEvent(), pl);
	pm.registerEvents(new ChangeWorldEvent(), pl);
	pm.registerEvents(new OnCommand(), pl);
	pm.registerEvents(new CustomJoinItem(), pl);
}
 
开发者ID:DianoxDragon,项目名称:UltimateSpawn,代码行数:13,代码来源:Manager.java

示例9: CommandManager

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public CommandManager() {
    PluginManager manager = Bukkit.getPluginManager();
    try {
        Field mapField = SimplePluginManager.class.getDeclaredField("commandMap");
        mapField.setAccessible(true);
        commandMap = (CommandMap) mapField.get(manager);
    } catch (NoSuchFieldException | IllegalAccessException e) {
        throw new IllegalStateException(e);
    }
}
 
开发者ID:EntryPointKR,项目名称:MCLibrary,代码行数:11,代码来源:CommandManager.java

示例10: getCommandMap

import org.bukkit.Bukkit; //导入方法依赖的package包/类
private static CommandMap getCommandMap() {
  if (!(Bukkit.getPluginManager() instanceof SimplePluginManager)) throw new IllegalStateException("PluginManager instance is not SimplePluginManager");
  try {
    Field field = SimplePluginManager.class.getDeclaredField("commandMap");
    field.setAccessible(true);
    return (SimpleCommandMap) field.get(Bukkit.getPluginManager());
  } catch (IllegalAccessException | NoSuchFieldException excepted) {
    excepted.printStackTrace();
  }
  return null;
}
 
开发者ID:Rires-Magica,项目名称:Bukkit-Utilities,代码行数:12,代码来源:CommandManager.java

示例11: loadPlugin

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public static void loadPlugin(File pluginFile) throws InvalidDescriptionException, InvalidPluginException {
	PluginManager pluginManager = Bukkit.getPluginManager();
	Plugin plugin = pluginManager.loadPlugin(pluginFile);
	plugin.onLoad();
	pluginManager.enablePlugin(plugin);
}
 
开发者ID:syuchan1005,项目名称:MCPluginDebuggerforMC,代码行数:7,代码来源:Util.java

示例12: registerListeners

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public void registerListeners() {
	PluginManager pm = Bukkit.getPluginManager();
	pm.registerEvents(new PlayerJoinListener(), this);
	pm.registerEvents(new EntityRegainHealthListener(), this);
	
}
 
开发者ID:masste,项目名称:McPlayUHC,代码行数:7,代码来源:McPlayUHC.java

示例13: onEnable

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public void onEnable() {
    instance = this;
    PeachAPIProvider.setPeachInstance(this);

    ConsoleLog.setLogger(new PluginLogger(this));
    ConsoleLog.info("Peach enabling.. (version: " + this.getDescription().getVersion() + ") by ImABradley.");


    // Load API fields //
    scheduler = new Scheduler(this);
    claimManager = new ClaimManager(this);
    resourceHandler = new PeachResourceHandler(this);


    // Load resources //
    Arrays.stream(ResourceType.values())
            .forEach(type -> resourceHandler.loadResource(type.getFileName()));


    // Register listeners //
    PluginManager pluginManager = Bukkit.getPluginManager();
    pluginManager.registerEvents(new PlayerMoveListener(claimManager), this);


    ConsoleLog.info("Peach enabled (version: " + this.getDescription().getVersion() + ") by ImABradley.");
}
 
开发者ID:ImABradley,项目名称:Peach,代码行数:28,代码来源:Peach.java


注:本文中的org.bukkit.Bukkit.getPluginManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。