本文整理匯總了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());
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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<>();
}
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}
示例12: registerListeners
import org.bukkit.Bukkit; //導入方法依賴的package包/類
public void registerListeners() {
PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents(new PlayerJoinListener(), this);
pm.registerEvents(new EntityRegainHealthListener(), this);
}
示例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.");
}