本文整理汇总了Java中org.bukkit.plugin.Plugin.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Plugin.equals方法的具体用法?Java Plugin.equals怎么用?Java Plugin.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.plugin.Plugin
的用法示例。
在下文中一共展示了Plugin.equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inject
import org.bukkit.plugin.Plugin; //导入方法依赖的package包/类
/**
*
* @author jiongjionger,Vlvxingze
*/
public static void inject(Plugin plg) {
if (plg != null) {
try {
SimpleCommandMap simpleCommandMap = Reflection.getField(SimplePluginManager.class, "commandMap", SimpleCommandMap.class).get(Bukkit.getPluginManager());
for (Command command : simpleCommandMap.getCommands()) {
if (command instanceof PluginCommand) {
PluginCommand pluginCommand = (PluginCommand) command;
if (plg.equals(pluginCommand.getPlugin())) {
FieldAccessor<CommandExecutor> commandField = Reflection.getField(PluginCommand.class, "executor", CommandExecutor.class);
FieldAccessor<TabCompleter> tabField = Reflection.getField(PluginCommand.class, "completer", TabCompleter.class);
CommandInjector commandInjector = new CommandInjector(plg, commandField.get(pluginCommand), tabField.get(pluginCommand));
commandField.set(pluginCommand, commandInjector);
tabField.set(pluginCommand, commandInjector);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
示例2: uninject
import org.bukkit.plugin.Plugin; //导入方法依赖的package包/类
public static void uninject(Plugin plg) {
if (plg != null) {
try {
SimpleCommandMap simpleCommandMap = Reflection.getField(SimplePluginManager.class, "commandMap", SimpleCommandMap.class).get(Bukkit.getPluginManager());
for (Command command : simpleCommandMap.getCommands()) {
if (command instanceof PluginCommand) {
PluginCommand pluginCommand = (PluginCommand) command;
if (plg.equals(pluginCommand.getPlugin())) {
FieldAccessor<CommandExecutor> commandField = Reflection.getField(PluginCommand.class, "executor", CommandExecutor.class);
FieldAccessor<TabCompleter> tabField = Reflection.getField(PluginCommand.class, "completer", TabCompleter.class);
CommandExecutor executor = commandField.get(pluginCommand);
if (executor instanceof CommandInjector) {
commandField.set(pluginCommand, ((CommandInjector) executor).getCommandExecutor());
}
TabCompleter completer = tabField.get(pluginCommand);
if (completer instanceof CommandInjector) {
tabField.set(pluginCommand, ((CommandInjector) executor).getTabCompleter());
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
示例3: getCommandTimingsByPlugin
import org.bukkit.plugin.Plugin; //导入方法依赖的package包/类
public static Map<String, MonitorRecord> getCommandTimingsByPlugin(Plugin plg) {
Map<String, MonitorRecord> record = new HashMap<>();
if (plg == null) {
return record;
}
try {
SimpleCommandMap simpleCommandMap = Reflection.getField(SimplePluginManager.class, "commandMap", SimpleCommandMap.class).get(Bukkit.getPluginManager());
for (Command command : simpleCommandMap.getCommands()) {
if (command instanceof PluginCommand) {
PluginCommand pluginCommand = (PluginCommand) command;
if (plg.equals(pluginCommand.getPlugin())) {
FieldAccessor<CommandExecutor> commandField = Reflection.getField(PluginCommand.class, "executor", CommandExecutor.class);
CommandExecutor executor = commandField.get(pluginCommand);
if (executor instanceof CommandInjector) {
CommandInjector commandInjector = (CommandInjector) executor;
record = mergeRecordMap(record, commandInjector.getMonitorRecordMap());
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return record;
}
示例4: inject
import org.bukkit.plugin.Plugin; //导入方法依赖的package包/类
public static void inject(Plugin plg) {
if (plg != null) {
try {
SimpleCommandMap simpleCommandMap = Reflection.getField(SimplePluginManager.class, "commandMap", SimpleCommandMap.class).get(Bukkit.getPluginManager());
for (Command command : simpleCommandMap.getCommands()) {
if (command instanceof PluginCommand) {
PluginCommand pluginCommand = (PluginCommand) command;
if (plg.equals(pluginCommand.getPlugin())) {
FieldAccessor<CommandExecutor> commandField = Reflection.getField(PluginCommand.class, "executor", CommandExecutor.class);
FieldAccessor<TabCompleter> tabField = Reflection.getField(PluginCommand.class, "completer", TabCompleter.class);
CommandInjector commandInjector = new CommandInjector(plg, commandField.get(pluginCommand), tabField.get(pluginCommand));
commandField.set(pluginCommand, commandInjector);
tabField.set(pluginCommand, commandInjector);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
示例5: uninject
import org.bukkit.plugin.Plugin; //导入方法依赖的package包/类
public static void uninject(Plugin plg) {
if (plg != null) {
try {
SimpleCommandMap simpleCommandMap = Reflection.getField(SimplePluginManager.class, "commandMap", SimpleCommandMap.class).get(Bukkit.getPluginManager());
for (Command command : simpleCommandMap.getCommands()) {
if (command instanceof PluginCommand) {
PluginCommand pluginCommand = (PluginCommand) command;
if (plg.equals(pluginCommand.getPlugin())) {
FieldAccessor<CommandExecutor> commandField = Reflection.getField(PluginCommand.class, "executor", CommandExecutor.class);
FieldAccessor<TabCompleter> tabField = Reflection.getField(PluginCommand.class, "completer", TabCompleter.class);
CommandExecutor executor = commandField.get(pluginCommand);
if (executor instanceof CommandInjector) {
commandField.set(pluginCommand, ((CommandInjector) executor).getCommandExecutor());
}
TabCompleter completer = tabField.get(pluginCommand);
if (completer instanceof CommandInjector) {
tabField.set(pluginCommand, ((CommandInjector) completer).getTabCompleter());
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
示例6: getCommandTimingsByPlugin
import org.bukkit.plugin.Plugin; //导入方法依赖的package包/类
public static Map<String, MonitorRecord> getCommandTimingsByPlugin(Plugin plg) {
Map<String, MonitorRecord> record = new HashMap<>();
if (plg == null) {
return record;
}
try {
SimpleCommandMap simpleCommandMap = Reflection
.getField(SimplePluginManager.class, "commandMap", SimpleCommandMap.class)
.get(Bukkit.getPluginManager());
for (Command command : simpleCommandMap.getCommands()) {
if (command instanceof PluginCommand) {
PluginCommand pluginCommand = (PluginCommand) command;
if (plg.equals(pluginCommand.getPlugin())) {
FieldAccessor<CommandExecutor> commandField = Reflection.getField(PluginCommand.class,
"executor", CommandExecutor.class);
CommandExecutor executor = commandField.get(pluginCommand);
if (executor instanceof CommandInjector) {
CommandInjector commandInjector = (CommandInjector) executor;
record = mergeRecordMap(record, commandInjector.getMonitorRecordMap());
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return record;
}