當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。