当前位置: 首页>>代码示例>>Java>>正文


Java PluginManager类代码示例

本文整理汇总了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());
}
 
开发者ID:SamaGames,项目名称:AntiCheat,代码行数:21,代码来源:Orebfuscator.java

示例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;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:20,代码来源:NicknameCommands.java

示例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());
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:17,代码来源:ReloadCommand.java

示例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"));
		}
	}
}
 
开发者ID:Maximuspayne,项目名称:NavyCraft2-Lite,代码行数:22,代码来源:PermissionInterface.java

示例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()));
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:26,代码来源:ListenerManager.java

示例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;
	}
}
 
开发者ID:OverloadedCore,项目名称:behave,代码行数:23,代码来源:MainPart.java

示例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);
}
 
开发者ID:Deltik,项目名称:SignEdit,代码行数:26,代码来源:SignEditTest.java

示例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();
        }
    }
}
 
开发者ID:lucko,项目名称:ConditionalPerms,代码行数:21,代码来源:HookManager.java

示例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;
    }
}
 
开发者ID:diecode,项目名称:KillerMoney,代码行数:19,代码来源:MessageHandler.java

示例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.");
}
 
开发者ID:BigScary,项目名称:PhantomAdmin,代码行数:21,代码来源:PhantomAdmin.java

示例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);
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:24,代码来源:SubscriptionMapInjector.java

示例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();
    }
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:17,代码来源:SubscriptionMapInjector.java

示例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;
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:26,代码来源:Permission.java

示例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());

}
 
开发者ID:ItsMonkeyyy,项目名称:LastManStanding,代码行数:17,代码来源:LMS.java

示例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);
	}
}
 
开发者ID:BigScary,项目名称:DiamondGuarantee,代码行数:24,代码来源:DiamondGuarantee.java


注:本文中的org.bukkit.plugin.PluginManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。