本文整理汇总了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.");
}