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


Java ServicePriority类代码示例

本文整理汇总了Java中org.bukkit.plugin.ServicePriority的典型用法代码示例。如果您正苦于以下问题:Java ServicePriority类的具体用法?Java ServicePriority怎么用?Java ServicePriority使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServicePriority类属于org.bukkit.plugin包,在下文中一共展示了ServicePriority类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hook

import org.bukkit.plugin.ServicePriority; //导入依赖的package包/类
/**
 * Registers the LuckPerms implementation of {@link Permission} and {@link Chat} with
 * the service manager.
 *
 * @param plugin the plugin
 */
public void hook(LPBukkitPlugin plugin) {
    try {
        if (this.permissionHook == null) {
            this.permissionHook = new VaultPermissionHook(plugin);
        }

        if (this.chatHook == null) {
            this.chatHook = new VaultChatHook(plugin, this.permissionHook);
        }

        final ServicesManager sm = plugin.getServer().getServicesManager();
        sm.register(Permission.class, this.permissionHook, plugin, ServicePriority.High);
        sm.register(Chat.class, this.chatHook, plugin, ServicePriority.High);

    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:25,代码来源:VaultHookManager.java

示例2: onLoad

import org.bukkit.plugin.ServicePriority; //导入依赖的package包/类
@Override
public void onLoad() {
    pool = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>());
    manager = new Manager(this);

    getServer().getServicesManager().register(
            MyEconomy.class,
            manager,
            this,
            ServicePriority.Normal
    );

    Plugin vault = getServer().getPluginManager().getPlugin("Vault");
    if (vault != null) {
        getServer().getServicesManager().register(
                Economy.class,
                new VaultEconomy(this, manager),
                this,
                ServicePriority.Highest
        );
        getLogger().info("Hook to vault!!!");
    }
}
 
开发者ID:caoli5288,项目名称:economy,代码行数:24,代码来源:Main.java

示例3: onEnable

import org.bukkit.plugin.ServicePriority; //导入依赖的package包/类
@Override
public void onEnable() {
    placeholderManager = new BukkitPlaceholderManager();
    pluginListener = new PluginListener(this);

    Plugin vaultPlugin = getServer().getPluginManager().getPlugin("Vault");
    Arrays.stream(VaultPlaceholder.values()).filter(placeholder -> placeholder.isRegisterable(getServer())).forEach(placeholder -> {
        // Register using Vault so that when it is disabled the placeholders are unregistered
        placeholderManager.registerMapping(vaultPlugin, placeholder);
    });

    Arrays.stream(BukkitPlaceholder.values()).forEach(placeholder -> placeholderManager.registerMapping(this, placeholder));
    getServer().getServicesManager().register(BukkitPlaceholderManager.class, placeholderManager, this, ServicePriority.Highest);
    getServer().getServicesManager().register(PlaceholderManager.class, placeholderManager, this, ServicePriority.Highest);
    getServer().getPluginManager().registerEvents(pluginListener, this);
}
 
开发者ID:csh,项目名称:placeholders,代码行数:17,代码来源:PlaceholderPlugin.java

示例4: onEnable

import org.bukkit.plugin.ServicePriority; //导入依赖的package包/类
@Override
public void onEnable() {
    super.onEnable();
    ViewItPlugin.instance = this;

    if (!getDataFolder().exists()) {
        getDataFolder().mkdir();
    }

    saveDefaultConfig();
    reloadConfig();

    replacers = new Replacers();
    scoreboardService = new SimpleScoreboardService(this);
    Bukkit.getServicesManager().register(ScoreboardService.class, scoreboardService, this,
            ServicePriority.Normal);

    if (getConfig().getBoolean("track-players-on-join")) {
        Bukkit.getOnlinePlayers().forEach(scoreboardService::addPlayer);
    }

    configElements = new ConfigElements(this);
    commands = new CommandsManager();
}
 
开发者ID:t7seven7t,项目名称:ViewIt,代码行数:25,代码来源:ViewItPlugin.java

示例5: init

import org.bukkit.plugin.ServicePriority; //导入依赖的package包/类
@Override
public void init(Plugin plugin) {
	ProtocolLibrary.getProtocolManager().addPacketListener(
			new PacketAdapter(PacketAdapter
					.params(plugin, PacketType.Play.Server.SET_SLOT,
							PacketType.Play.Server.WINDOW_ITEMS)
							.serverSide().listenerPriority(ListenerPriority.HIGH)) {

				@Override
				public void onPacketSending(PacketEvent event) {
					if (event.getPacketType().equals(PacketType.Play.Server.SET_SLOT)) {
						addGlow(new ItemStack[] { event.getPacket().getItemModifier().read(0) });
					} else {
						addGlow(event.getPacket().getItemArrayModifier().read(0));
					}
				}
			});
	
	_signManager = new ProtocolLibSignGUI(plugin);
	
	Bukkit.getServicesManager().register(SignGUI.class, _signManager, plugin, ServicePriority.Highest);
}
 
开发者ID:glen3b,项目名称:BukkitLib,代码行数:23,代码来源:ProtocolLibUtilImplementation.java

示例6: invoke

import org.bukkit.plugin.ServicePriority; //导入依赖的package包/类
public static void invoke()
{
    ServicesManager servicesManager = BukkitBootstrap.getPlugin(BukkitBootstrap.class).getServer().getServicesManager();

    Permission permission = new VaultPermissionImpl();

    servicesManager.register(Permission.class, permission, BukkitBootstrap.getPlugin(BukkitBootstrap.class), ServicePriority.Highest);
    servicesManager.register(Chat.class, new VaultChatImpl(permission), BukkitBootstrap.getPlugin(BukkitBootstrap.class), ServicePriority.Highest);
}
 
开发者ID:Dytanic,项目名称:CloudNet,代码行数:10,代码来源:VaultInvoker.java

示例7: provideService

import org.bukkit.plugin.ServicePriority; //导入依赖的package包/类
@Nonnull
@Override
public <T> T provideService(@Nonnull Class<T> clazz, @Nonnull T instance) {
    Preconditions.checkNotNull(clazz, "clazz");
    Preconditions.checkNotNull(instance, "instance");
    return provideService(clazz, instance, ServicePriority.Normal);
}
 
开发者ID:lucko,项目名称:helper,代码行数:8,代码来源:ExtendedJavaPlugin.java

示例8: onEnable

import org.bukkit.plugin.ServicePriority; //导入依赖的package包/类
@Override
public void onEnable() {
    serviceManager = getServer().getServicesManager();
    motdConfig = loadConfig();
    motdService = new BukkitMotdService(new SimpleMotdProvider(motdConfig));
    serviceManager.register(MotdService.class, motdService, this, ServicePriority.Normal);

    getServer().getPluginManager().registerEvents(new MotdListener(motdService), this); // todo configurable priority
}
 
开发者ID:andylizi,项目名称:ColorMOTD,代码行数:10,代码来源:BukkitMain.java

示例9: onLoad

import org.bukkit.plugin.ServicePriority; //导入依赖的package包/类
@Override
public void onLoad() {
    Config config = loadConfig();
    List<RemoteRepository> remoteRepositories = config.getRepositories();
    LocalRepository localRepository = createLocalRepository(config);
    RepositorySystem repositorySystem = createRepositorySystem();
    libraryManager = new BukkitLibraryManager(repositorySystem, localRepository, () -> remoteRepositories, getLogger());
    Bukkit.getServicesManager().register(LibraryManager.class, libraryManager, this, ServicePriority.Normal);
}
 
开发者ID:MCCityVille,项目名称:libmanager,代码行数:10,代码来源:LibManagerPlugin.java

示例10: getCombatTagPlugins

import org.bukkit.plugin.ServicePriority; //导入依赖的package包/类
public ImmutableList<CombatTagPlugin> getCombatTagPlugins() {
    if (getServer().getServicesManager().getRegistrations(this).isEmpty()) {
        getServer().getServicesManager().register(CombatTagPlugin.class, new CombatTagLegacySupport(), this, ServicePriority.Low);
        getServer().getServicesManager().register(CombatTagPlugin.class, new PvPManagerSupport(), this, ServicePriority.Normal);
        getServer().getServicesManager().register(CombatTagPlugin.class, new CombatTagPlusSupport(), this, ServicePriority.Normal);
    }
    return getServer().getServicesManager().getRegistrations(CombatTagPlugin.class).stream()
            .map(RegisteredServiceProvider::getProvider)
            .filter(CombatTagPlugin::isInstalled) // Only return installed plugins :)
            .collect(Utils.immutableListCollector());
}
 
开发者ID:TechzoneMC,项目名称:SpawnShield,代码行数:12,代码来源:SpawnShield.java

示例11: onEnable

import org.bukkit.plugin.ServicePriority; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onEnable () {
        super.onEnable ();

        Grid grid = new Grid (this);

        this.getServer ().getMessenger ().registerOutgoingPluginChannel (this, Grid.CHANNEL_NAME);
        this.getServer ().getMessenger ().registerIncomingPluginChannel (this, Grid.CHANNEL_NAME, grid);
        this.getServer ().getServicesManager ().register (IGrid.class, grid, this, ServicePriority.Normal);
}
 
开发者ID:PlaySpud,项目名称:Grid,代码行数:14,代码来源:GridPlugin.java

示例12: setupEconomy

import org.bukkit.plugin.ServicePriority; //导入依赖的package包/类
private void setupEconomy() {
	if (getServer().getPluginManager().getPlugin("Vault") != null) {
		final ServicesManager sm = getServer().getServicesManager();
		sm.register(Economy.class, new UCEconomy(), this, ServicePriority.Highest);
		System.out.println("Universal Coins: Registered Vault interface.");
	} else {
		System.out.println("Universal Coins: Vault not detected. Initialization failed.");
	}
}
 
开发者ID:notabadminer,项目名称:UniversalCoinsVaultPlugin,代码行数:10,代码来源:UniversalCoinsMain.java

示例13: registerEconomy

import org.bukkit.plugin.ServicePriority; //导入依赖的package包/类
/**
 * Register Gringotts as economy provider for vault.
 */
private void registerEconomy() {
    if (DEP.vault.exists()) {
        final ServicesManager sm = getServer().getServicesManager();
        sm.register(Economy.class, new VaultConnector(), this, ServicePriority.Highest);
        log.info("Registered Vault interface.");
    } else {
        log.info("Vault not found. Other plugins may not be able to access Gringotts accounts.");
    }
}
 
开发者ID:sakunc,项目名称:Gringotts-,代码行数:13,代码来源:Gringotts.java

示例14: hook

import org.bukkit.plugin.ServicePriority; //导入依赖的package包/类
public void hook(PowerfulPerms plugin) {
    Plugin vault = Bukkit.getPluginManager().getPlugin("Vault");
    PowerfulPerms_Vault_Permissions vaultPermsHook = new PowerfulPerms_Vault_Permissions(plugin);
    PowerfulPerms_Vault_Chat vaultChatHook = new PowerfulPerms_Vault_Chat(vaultPermsHook, plugin);
    Bukkit.getServicesManager().register(net.milkbowl.vault.permission.Permission.class, vaultPermsHook, vault, ServicePriority.High);
    Bukkit.getServicesManager().register(net.milkbowl.vault.chat.Chat.class, vaultChatHook, vault, ServicePriority.High);
}
 
开发者ID:gustav9797,项目名称:PowerfulPerms,代码行数:8,代码来源:VaultHook.java

示例15: onEnable

import org.bukkit.plugin.ServicePriority; //导入依赖的package包/类
@Override
public void onEnable()
{
    instance = this;

    Database db = setupDatabase();

    if (db == null)
    {
        logWarning("Could not connect to a database. Disabling.");

        for (Player player : Bukkit.getOnlinePlayers())
        {
            player.kickPlayer("Error with Database. Kicking for safety.");
        }

        Bukkit.setWhitelist(true);
        Bukkit.reloadWhitelist();

        return;
    }

    coreData = new CoreData(this, db);
    coreMethods = new CoreMethods(this);
    coreErrors = new CoreErrors(this);

    coreZones = (Zones) getServer().getPluginManager().getPlugin("Zones");
    coreFactions = (Factions) getServer().getPluginManager().getPlugin("Factions");


    //new WorldLogListeners(this,db);
    nerfListener = new Nerf(this);
    godListener = new God(this);
    Bukkit.getServicesManager().register(CoreFunctions.class, this, this, ServicePriority.High);
}
 
开发者ID:Vanillacraft,项目名称:vanillacraft,代码行数:36,代码来源:CoreFunctions.java


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