當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。