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


Java Essentials类代码示例

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


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

示例1: deSerialize

import com.earth2me.essentials.Essentials; //导入依赖的package包/类
/**
 * Gets the essentials kit from the config as ItemStacks.
 * @param items The items in the kit.
 * @param user The player in the form of Essentials User.
 * @return The ItemStacks.
 */
private CompletableFuture<ItemStack[]> deSerialize(final List<String> items, final User user) {
    final Essentials ess = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials");

    final CompletableFuture<ItemStack[]> finalList = new CompletableFuture<>();
    final List<ItemStack> itemList = new ArrayList<>();
    final IText input = new SimpleTextInput(items);
    final IText output = new KeywordReplacer(input, user.getSource(), ess);
    for (final String kitItem : output.getLines()) {
        final String[] parts = kitItem.split(" +");
        try {
            final ItemStack parseStack = ess.getItemDb().get(parts[0], parts.length > 1 ? Integer.parseInt(parts[1]) : 1);
            if (parseStack != null && parseStack.getType() != Material.AIR) {
                final MetaItemStack metaStack = new MetaItemStack(parseStack);//NOPMD
                if (parts.length > 2) {
                    metaStack.parseStringMeta(null, true, parts, 2, ess);
                }
                itemList.add(metaStack.getItemStack());
            }
        } catch (Exception e) {
            RandomCoords.logger.log(Level.SEVERE, "There was an error serializing the essentials kit! (RandomCoords)");
        }
    }
    finalList.complete(itemList.toArray(new ItemStack[itemList.size()]));
    return finalList;
}
 
开发者ID:jolbol1,项目名称:RandomCoordinatesV2,代码行数:32,代码来源:KitManager.java

示例2: onEnable

import com.earth2me.essentials.Essentials; //导入依赖的package包/类
@Override
public void onEnable() {
    instance = this;
    logger = getLogger();
    config = new Configuration(this);
    config.load();
    i18n = new I18n(this, this.config.language);
    commandHandler = new CommandHandler(this, this.i18n);
    getCommand("hamsterecohelper").setExecutor(commandHandler);
    getCommand("hamsterecohelper").setTabCompleter(commandHandler);
    database = new Database(this);
    eco = new EconomyUtil(this);
    systemBalance = new SystemBalance(this);
    NyaaComponent.register(ISystemBalance.class, systemBalance);
    auctionManager = new AuctionManager(this);
    reqManager = new RequisitionManager(this);
    marketManager = new MarketManager(this);
    marketListener = new MarketListener(this);
    signShopManager = new SignShopManager(this);
    signShopListener = new SignShopListener(this);
    adsManager = new AdsManager(this);
    if (getServer().getPluginManager().getPlugin("Essentials") != null) {
        this.ess = (Essentials) getServer().getPluginManager().getPlugin("Essentials");
    }
    eventHandler = new Events(this);
}
 
开发者ID:NyaaCat,项目名称:HamsterEcoHelper,代码行数:27,代码来源:HamsterEcoHelper.java

示例3: reload

import com.earth2me.essentials.Essentials; //导入依赖的package包/类
public void reload() {
    auctionManager.halt();
    auctionManager.cancel();
    reqManager.halt();
    reqManager.cancel();
    signShopManager.closeAllGUI();
    marketManager.closeAllGUI();
    marketManager.cancel();
    adsManager.cancel();
    systemBalance.cancel();
    config.load();
    i18n.load();
    systemBalance = new SystemBalance(this);
    NyaaComponent.register(ISystemBalance.class, systemBalance);
    auctionManager = new AuctionManager(this);
    reqManager = new RequisitionManager(this);
    signShopManager = new SignShopManager(this);
    marketManager = new MarketManager(this);
    if (getServer().getPluginManager().getPlugin("Essentials") != null) {
        this.ess = (Essentials) getServer().getPluginManager().getPlugin("Essentials");
    }
    adsManager = new AdsManager(this);
}
 
开发者ID:NyaaCat,项目名称:HamsterEcoHelper,代码行数:24,代码来源:HamsterEcoHelper.java

示例4: detectEssentialsLocale

import com.earth2me.essentials.Essentials; //导入依赖的package包/类
/**
 * Detects Essentials' Locale
 */
public static void detectEssentialsLocale() {
	if(plugin.getDependencyManager().isEnabled(Dependency.ESSENTIALS) && !Config.LANG_OVERRIDEESSENTIALS.getBoolean()) {
		Essentials essentials = plugin.getDependencyManager().get(Dependency.ESSENTIALS, Essentials.class);
		if(essentials.getSettings() == null) {
			return;
		}

		String locale = essentials.getSettings().getLocale();
		if(locale.isEmpty()) {
			locale = "en";
		}

		if(ConfigManager.essentialsLocale.containsKey(locale)) {
			Config.LANG_NAME.set(ConfigManager.essentialsLocale.get(locale));
		}

		LoggerUtils.info("Changed lang to Essentials' locale: " + Config.LANG_NAME.getString());
	}
}
 
开发者ID:MarcinWieczorek,项目名称:NovaGuilds,代码行数:23,代码来源:MessageManager.java

示例5: getEssentialsPlugin

import com.earth2me.essentials.Essentials; //导入依赖的package包/类
public Essentials getEssentialsPlugin()
{
    if (this.essentialsPlugin == null)
    {
        try
        {
            final Plugin essentials = Bukkit.getServer().getPluginManager().getPlugin("Essentials");
            if (essentials != null)
            {
                if (essentials instanceof Essentials)
                {
                    this.essentialsPlugin = (Essentials) essentials;
                }
            }
        }
        catch (Exception ex)
        {
            TFM_Log.severe(ex);
        }
    }
    return this.essentialsPlugin;
}
 
开发者ID:Yoshi41023,项目名称:TatsuCraftMod,代码行数:23,代码来源:TFM_EssentialsBridge.java

示例6: getEssentialsUser

import com.earth2me.essentials.Essentials; //导入依赖的package包/类
public User getEssentialsUser(String username)
{
    try
    {
        final Essentials essentials = getEssentialsPlugin();
        if (essentials != null)
        {
            return essentials.getUserMap().getUser(username);
        }
    }
    catch (Exception ex)
    {
        TFM_Log.severe(ex);
    }
    return null;
}
 
开发者ID:Yoshi41023,项目名称:TatsuCraftMod,代码行数:17,代码来源:TFM_EssentialsBridge.java

示例7: isEssentialsEnabled

import com.earth2me.essentials.Essentials; //导入依赖的package包/类
public boolean isEssentialsEnabled()
{
    try
    {
        final Essentials essentials = getEssentialsPlugin();
        if (essentials != null)
        {
            return essentials.isEnabled();
        }
    }
    catch (Exception ex)
    {
        TFM_Log.severe(ex);
    }
    return false;
}
 
开发者ID:Yoshi41023,项目名称:TatsuCraftMod,代码行数:17,代码来源:TFM_EssentialsBridge.java

示例8: uninject

import com.earth2me.essentials.Essentials; //导入依赖的package包/类
public void uninject(Plugin plugin)
{
    BungeePerms.getLogger().info("Uninjection of Bungeeperms into Essentials");

    try
    {
        Essentials ess = (Essentials) plugin;

        Field f = ess.getClass().getDeclaredField("permissionsHandler");
        f.setAccessible(true);
        PermissionsHandler permhandler = (PermissionsHandler) f.get(plugin);

        permhandler.checkPermissions();
    }
    catch (Exception ex)
    {
        BungeePerms.getInstance().getDebug().log(ex);
    }
}
 
开发者ID:weaondara,项目名称:BungeePerms,代码行数:20,代码来源:EssentialsBridge.java

示例9: shouldReturnEssentialsDataFolder

import com.earth2me.essentials.Essentials; //导入依赖的package包/类
@Test
public void shouldReturnEssentialsDataFolder() {
    // given
    Essentials ess = mock(Essentials.class);
    File essDataFolder = new File("test/data-folder");
    // Need to set the data folder with reflections because getDataFolder() is declared final
    ReflectionTestUtils.setField(JavaPlugin.class, ess, "dataFolder", essDataFolder);

    PluginManager pluginManager = mock(PluginManager.class);
    setPluginAvailable(pluginManager, ESSENTIALS, ess);
    PluginHookService pluginHookService = new PluginHookService(pluginManager);

    // when
    File dataFolder = pluginHookService.getEssentialsDataFolder();

    // then
    assertThat(dataFolder, equalTo(essDataFolder));
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:19,代码来源:PluginHookServiceTest.java

示例10: shouldSetSocialSpyStatus

import com.earth2me.essentials.Essentials; //导入依赖的package包/类
@Test
public void shouldSetSocialSpyStatus() {
    // given
    Player player = mock(Player.class);

    Essentials ess = mock(Essentials.class);
    User user = mock(User.class);
    given(ess.getUser(player)).willReturn(user);

    PluginManager pluginManager = mock(PluginManager.class);
    setPluginAvailable(pluginManager, ESSENTIALS, ess);
    PluginHookService pluginHookService = new PluginHookService(pluginManager);

    // when
    pluginHookService.setEssentialsSocialSpyStatus(player, true);

    // then
    verify(ess).getUser(player);
    verify(user).setSocialSpyEnabled(true);
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:21,代码来源:PluginHookServiceTest.java

示例11: shouldUnhookEssentialsAndMultiverse

import com.earth2me.essentials.Essentials; //导入依赖的package包/类
@Test
public void shouldUnhookEssentialsAndMultiverse() {
    // given
    PluginManager pluginManager = mock(PluginManager.class);
    setPluginAvailable(pluginManager, ESSENTIALS, Essentials.class);
    setPluginAvailable(pluginManager, MULTIVERSE, MultiverseCore.class);
    PluginHookService pluginHookService = new PluginHookService(pluginManager);

    // when
    pluginHookService.unhookEssentials();
    pluginHookService.unhookMultiverse();

    // then
    assertThat(pluginHookService.isEssentialsAvailable(), equalTo(false));
    assertThat(pluginHookService.isMultiverseAvailable(), equalTo(false));
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:17,代码来源:PluginHookServiceTest.java

示例12: onEnable

import com.earth2me.essentials.Essentials; //导入依赖的package包/类
@Override
public void onEnable() {
    config = new Configuration(this);
    config.load();
    i18n = new I18n(this, this.config.language);
    i18n.load();
    commandHandler = new CommandHandler(this, this.i18n);
    getCommand("yasui").setExecutor(commandHandler);
    getCommand("yasui").setTabCompleter(commandHandler);
    if (getServer().getPluginManager().getPlugin("Essentials") != null) {
        this.ess = (Essentials) getServer().getPluginManager().getPlugin("Essentials");
    }
    tpsMonitor = new TPSMonitor(this);
    entityListener = new EntityListener(this);
}
 
开发者ID:NyaaCat,项目名称:Yasui,代码行数:16,代码来源:Main.java

示例13: ChatListener

import com.earth2me.essentials.Essentials; //导入依赖的package包/类
public ChatListener(HCF plugin)
{
  this.plugin = plugin;
  this.essentials = ((Essentials)Bukkit.getPluginManager().getPlugin("Essentials"));
  
  this.messageHistory = new MapMaker().makeMap();
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:8,代码来源:ChatListener.java

示例14: getKit

import com.earth2me.essentials.Essentials; //导入依赖的package包/类
/**
 * Grabs the kit from the config name.
 * @param p The player we're getting the kit for.
 * @param c The Chest that is being generated.
 * @param name The name of the kit.
 */
public void getKit(final Player p, final Chest c, final String name) {
    if (Bukkit.getPluginManager().getPlugin("Essentials") == null) {
    } else {
        final IEssentials ess = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials");
        ForkJoinPool.commonPool().execute(() -> {
            if (ess != null) {
                //  Map<String, Object> kit = ess.getSettings().getKit(name.toLowerCase());
                final User u = ess.getUser(p);
                List<String> items;
                try {
                    final Kit kitMe = new Kit(name, ess);
                    items = kitMe.getItems();

                    final Inventory inv = c.getInventory();


                    inv.addItem(deSerialize(items, u).get());
                } catch (Exception e) {
                    e.printStackTrace();
                    RandomCoords.logger.severe("Essnetials unable to deserialize kit (RandomCoords)");

                }
            } else {
                RandomCoords.logger.severe("Essnetials was null when getting kit. (RandomCoords)");
            }
        });
    }
}
 
开发者ID:jolbol1,项目名称:RandomCoordinatesV2,代码行数:35,代码来源:KitManager.java

示例15: getEssentialsKits

import com.earth2me.essentials.Essentials; //导入依赖的package包/类
public List<ItemStack> getEssentialsKits(Player p, String name) {
    List<ItemStack> itemStacks = new ArrayList<>();
    if (Bukkit.getPluginManager().getPlugin("Essentials") == null) {
    } else {
        final IEssentials ess = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials");
            if (ess != null) {
                //  Map<String, Object> kit = ess.getSettings().getKit(name.toLowerCase());
                final User u = ess.getUser(p);
                List<String> items;
                try {
                    final Kit kitMe = new Kit(name, ess);
                    items = kitMe.getItems();

                    for(ItemStack item : deSerialize(items, u).get()) {
                        itemStacks.add(item);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    RandomCoords.logger.severe("Essnetials unable to deserialize kit.");

                }
            } else {
                RandomCoords.logger.severe("Essnetials was null when getting kit.");
            }
    }
    return itemStacks;

}
 
开发者ID:jolbol1,项目名称:RandomCoordinatesV2,代码行数:29,代码来源:KitManager.java


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