本文整理汇总了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();
}
}
示例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!!!");
}
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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
}
示例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);
}
示例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());
}
示例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);
}
示例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.");
}
}
示例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.");
}
}
示例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);
}
示例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);
}