本文整理汇总了Java中org.bukkit.plugin.PluginManager类的典型用法代码示例。如果您正苦于以下问题:Java PluginManager类的具体用法?Java PluginManager怎么用?Java PluginManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PluginManager类属于org.bukkit.plugin包,在下文中一共展示了PluginManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enable
import org.bukkit.plugin.PluginManager; //导入依赖的package包/类
@Override
public void enable(Samaritan plugin) {
// Get plugin manager
PluginManager pm = plugin.getServer().getPluginManager();
instance = this;
nms = createNmsManager();
this.plugin = plugin;
// Load configurations
OrebfuscatorConfig.load();
// Orebfuscator events
pm.registerEvents(new OrebfuscatorPlayerListener(), plugin);
pm.registerEvents(new OrebfuscatorEntityListener(), plugin);
pm.registerEvents(new OrebfuscatorBlockListener(), plugin);
pm.registerEvents(new OrebfuscatorChunkListener(), plugin);
ShadowsAPI.get().registerListener(new ShadowHook());
}
示例2: NicknameCommands
import org.bukkit.plugin.PluginManager; //导入依赖的package包/类
@Inject NicknameCommands(NicknameConfiguration config,
SyncExecutor syncExecutor,
UserService userService,
Audiences audiences,
IdentityProvider identities,
OnlinePlayers onlinePlayers,
UserFinder userFinder,
PluginManager pluginManager,
Plugin plugin) {
this.config = config;
this.syncExecutor = syncExecutor;
this.userService = userService;
this.audiences = audiences;
this.identities = identities;
this.onlinePlayers = onlinePlayers;
this.userFinder = userFinder;
this.pluginManager = pluginManager;
this.plugin = plugin;
}
示例3: onExecute
import org.bukkit.plugin.PluginManager; //导入依赖的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());
}
示例4: setupPermissions
import org.bukkit.plugin.PluginManager; //导入依赖的package包/类
public static void setupPermissions(NavyCraft p) {
plugin = p;
PluginManager pm = NavyCraft.instance.getServer().getPluginManager();
if(pm != null) {
pm.addPermission(new Permission("navycraft.periscope.use"));
pm.addPermission(new Permission("navycraft.aa-gun.use"));
pm.addPermission(new Permission("navycraft.periscope.create"));
pm.addPermission(new Permission("navycraft.aa-gun.create"));
for (CraftType type : CraftType.craftTypes)
{
pm.addPermission(new Permission("navycraft." + type.name + ".release"));
pm.addPermission(new Permission("navycraft." + type.name + ".info"));
pm.addPermission(new Permission("navycraft." + type.name + ".takeover"));
pm.addPermission(new Permission("navycraft." + type.name + ".start"));
pm.addPermission(new Permission("navycraft." + type.name + ".create"));
pm.addPermission(new Permission("navycraft." + type.name + ".sink"));
pm.addPermission(new Permission("navycraft." + type.name + ".remove"));
}
}
}
示例5: registerListeners
import org.bukkit.plugin.PluginManager; //导入依赖的package包/类
/**
* Registers all of the Listeners on the server
*/
public void registerListeners() {
PluginManager pluginManager = Bukkit.getServer().getPluginManager();
Stream.of(
new ClaimInteractListener(),
new ClaimMoveListener(),
new ClaimProfileListener(),
new GameDamageListener(),
new GameInteractListener(),
new GameProtectionListener(),
new KothMoveListener(),
new TeamBlockListener(),
new TeamDamageListener(),
new TeamDeathListener(),
new TeamInteractListener(),
new ChatListener(),
new PlayerDeathListener(),
new PlayerRespawnListener(),
new ProfileListener(),
new ProfileStatusListener(),
new EnderpearlListener()
).forEach(listener -> pluginManager.registerEvents(listener, Chambers.getInstance()));
}
示例6: execBeh
import org.bukkit.plugin.PluginManager; //导入依赖的package包/类
private boolean execBeh(String beh){
String[] arr = beh.split(" ");
String cmd = arr[0];
String[] args = Arrays.copyOfRange(arr, 1, arr.length);
String argsas = "";
for(String a : args){
argsas = argsas + a + " ";
}
switch(cmd){
case "print":
getLogger().info(argsas);
return true;
case "addperm":
PluginManager pm = Bukkit.getServer().getPluginManager();
pm.addPermission(new Permission(argsas));
return true;
case "//":
return true;
default:
return false;
}
}
示例7: setUp
import org.bukkit.plugin.PluginManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
Configuration config = new Configuration(File.createTempFile("SignEdit-", "-config.yml"));
spyConfig = spy(config);
listener = new Interact();
doReturn(false).when(spyConfig).writeFullConfig(new YamlConfiguration());
uiSignSubcommand = mock(UiSignSubcommand.class);
whenNew(UiSignSubcommand.class).withAnyArguments().thenReturn(uiSignSubcommand);
signCommand = new SignCommand(spyConfig, listener);
player = mock(Player.class);
command = mock(Command.class);
sign = mock(Sign.class);
block = mock(Block.class);
when(player.hasPermission("SignEdit.use")).thenReturn(true);
when(block.getState()).thenReturn(sign);
server = mock(Server.class);
pluginManager = mock(PluginManager.class);
mockStatic(Bukkit.class);
when(Bukkit.getServer()).thenReturn(server);
when(server.getPluginManager()).thenReturn(pluginManager);
}
示例8: init
import org.bukkit.plugin.PluginManager; //导入依赖的package包/类
public void init() {
PluginManager pm = plugin.getServer().getPluginManager();
for (Hook hook : Hook.values()) {
try {
if (pm.isPluginEnabled(hook.getPluginName())) {
AbstractHook ah = make(hook.getClazz(), plugin);
if (ah != null) {
plugin.bindComposite(ah);
hooks.put(hook.getClazz(), ah);
}
plugin.getLogger().info("Hooked with " + hook.getPluginName() + "...");
}
} catch (Exception e) {
plugin.getLogger().severe("Exception thrown whilst hooking with " + hook.getPluginName() + "...");
e.printStackTrace();
}
}
}
示例9: process
import org.bukkit.plugin.PluginManager; //导入依赖的package包/类
public static void process(Player player, String message) {
KMPlayer kmp = KMPlayerManager.getKMPlayer(player);
PluginManager pm = Bukkit.getPluginManager();
if (!kmp.isEnableMessages()) {
return;
}
switch (DefaultConfig.getMessageMethod()) {
case DISABLED: return;
case ACTION_BAR: pm.callEvent(new KMSendActionBarMessageEvent(player, message, 3));
break;
case CHAT: pm.callEvent(new KMSendMessageEvent(player, message));
break;
}
}
示例10: onEnable
import org.bukkit.plugin.PluginManager; //导入依赖的package包/类
public void onEnable()
{
instance = this;
this.loadConfig();
@SuppressWarnings("unchecked")
Collection<Player> players = (Collection<Player>)(Bukkit.getServer().getOnlinePlayers());
for(Player player : players)
{
this.handlePlayerLogin(player);
}
//register for events
PluginManager pluginManager = this.getServer().getPluginManager();
PAEventHandler eventHandler = new PAEventHandler();
pluginManager.registerEvents(eventHandler, this);
AddLogEntry("PhantomAdmin enabled.");
}
示例11: inject
import org.bukkit.plugin.PluginManager; //导入依赖的package包/类
private void inject() throws Exception {
PluginManager pluginManager = this.plugin.getServer().getPluginManager();
if (!(pluginManager instanceof SimplePluginManager)) {
this.plugin.getLog().severe("PluginManager instance is not a 'SimplePluginManager', instead: " + pluginManager.getClass());
this.plugin.getLog().severe("Unable to inject LuckPerms Permission Subscription map.");
return;
}
Object map = PERM_SUBS_FIELD.get(pluginManager);
if (map instanceof LPSubscriptionMap) {
return; // already injected
}
//noinspection unchecked
Map<String, Map<Permissible, Boolean>> castedMap = (Map<String, Map<Permissible, Boolean>>) map;
// make a new subscription map
LPSubscriptionMap newMap = new LPSubscriptionMap(this.plugin, castedMap);
// inject it
PERM_SUBS_FIELD.set(pluginManager, newMap);
}
示例12: uninject
import org.bukkit.plugin.PluginManager; //导入依赖的package包/类
public static void uninject() {
try {
PluginManager pluginManager = Bukkit.getServer().getPluginManager();
if (!(pluginManager instanceof SimplePluginManager)) {
return;
}
Object map = PERM_SUBS_FIELD.get(pluginManager);
if (map instanceof LPSubscriptionMap) {
LPSubscriptionMap lpMap = (LPSubscriptionMap) map;
PERM_SUBS_FIELD.set(pluginManager, lpMap.detach());
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例13: addParent
import org.bukkit.plugin.PluginManager; //导入依赖的package包/类
/**
* Adds this permission to the specified parent permission.
* <p>
* If the parent permission does not exist, it will be created and
* registered.
*
* @param name Name of the parent permission
* @param value The value to set this permission to
* @return Parent permission it created or loaded
*/
public Permission addParent(String name, boolean value) {
PluginManager pm = Bukkit.getServer().getPluginManager();
String lname = name.toLowerCase();
Permission perm = pm.getPermission(lname);
if (perm == null) {
perm = new Permission(lname);
pm.addPermission(perm);
}
addParent(perm, value);
return perm;
}
示例14: onEnable
import org.bukkit.plugin.PluginManager; //导入依赖的package包/类
@Override
public void onEnable() {
instance = this;
saveDefaultConfig();
this.playerManager = new PlayerManager();
this.gameManager = new GameManager();
this.gameManager.loadGames();
PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents(new PlayerListener(), this);
pm.registerEvents(new GameListener(), this);
getCommand("lms").setExecutor(new CommandHandler());
}
示例15: onEnable
import org.bukkit.plugin.PluginManager; //导入依赖的package包/类
public void onEnable()
{
AddLogEntry("DiamondGuarantee enabled.");
instance = this;
this.dataStore = new DataStore();
this.loadConfig();
//register for events
PluginManager pluginManager = this.getServer().getPluginManager();
DGEventHandler dGEventHandler = new DGEventHandler();
pluginManager.registerEvents(dGEventHandler, this);
@SuppressWarnings("unchecked")
Collection<Player> players = (Collection<Player>)this.getServer().getOnlinePlayers();
for(Player player : players)
{
PlayerData.Preload(player);
}
}