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


Java GamePlayer.getPlayerIfOnline方法代码示例

本文整理汇总了Java中net.samagames.api.games.GamePlayer.getPlayerIfOnline方法的典型用法代码示例。如果您正苦于以下问题:Java GamePlayer.getPlayerIfOnline方法的具体用法?Java GamePlayer.getPlayerIfOnline怎么用?Java GamePlayer.getPlayerIfOnline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.samagames.api.games.GamePlayer的用法示例。


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

示例1: onGameStart

import net.samagames.api.games.GamePlayer; //导入方法依赖的package包/类
/**
 * Give 128 bookshelves, thousands of xp levels, 64 tables and 64 anvils to all the players
 *
 * @param game Game
 */
@Override
public void onGameStart(SurvivalGame game)
{
    ItemStack tables = new ItemStack(Material.ENCHANTMENT_TABLE, 64);
    ItemStack anvils = new ItemStack(Material.ANVIL, 64);
    ItemStack bookshelves = new ItemStack(Material.BOOKSHELF, 64);
    ItemStack lapis = new ItemStack(Material.INK_SACK, 64, (short)4);

    for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p == null)
            continue;

        p.getInventory().addItem(tables);
        p.getInventory().addItem(anvils);
        p.getInventory().addItem(bookshelves);
        p.getInventory().addItem(lapis);
        p.setLevel(111111);
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:28,代码来源:InfiniteEnchanterModule.java

示例2: onGameStart

import net.samagames.api.games.GamePlayer; //导入方法依赖的package包/类
/**
 * Set always night
 * @param game Game instance
 */
@Override
public void onGameStart(SurvivalGame game)
{
    World world = this.plugin.getServer().getWorlds().get(0);
    world.setGameRuleValue("doDaylightCycle", "false");
    world.setTime(15000);

    for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p == null)
            continue;

        p.playSound(p.getLocation(), Sound.WITHER_SPAWN, 0.9F, 1F);
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:22,代码来源:NightmareModule.java

示例3: onGameStart

import net.samagames.api.games.GamePlayer; //导入方法依赖的package包/类
/**
 * Give a cheated fishing rod to all the players
 *
 * @param game Game
 */
@Override
public void onGameStart(SurvivalGame game)
{
    ItemStack rod = new ItemStack(Material.FISHING_ROD);
    rod.addUnsafeEnchantment(Enchantment.LUCK, 255);
    rod.addUnsafeEnchantment(Enchantment.DURABILITY, 255);
    ItemMeta meta = rod.getItemMeta();
    meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
    rod.setItemMeta(meta);

    for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p != null)
            p.getInventory().addItem(rod);
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:24,代码来源:GoneFishingModule.java

示例4: onGameStart

import net.samagames.api.games.GamePlayer; //导入方法依赖的package包/类
/**
 * Give all player 14 obsidian, 1 flint and steel, 1 lava bucket, 1 iron pickaxe and 64 steaks
 *
 * @param game Game
 */
@Override
public void onGameStart(SurvivalGame game)
{
    for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p == null)
            continue;

        p.getInventory().addItem(new ItemStack(Material.OBSIDIAN, 14));
        p.getInventory().addItem(new ItemStack(Material.FLINT_AND_STEEL));
        p.getInventory().addItem(new ItemStack(Material.LAVA_BUCKET));
        p.getInventory().addItem(new ItemStack(Material.IRON_PICKAXE));
        p.getInventory().addItem(new ItemStack(Material.COOKED_BEEF, 64));
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:23,代码来源:HighwayToHellModule.java

示例5: onGameStart

import net.samagames.api.games.GamePlayer; //导入方法依赖的package包/类
/**
 * Give 64 bones, 64 rotten flesh and 64 wolf eggs to all the players
 *
 * @param game Game
 */
@Override
public void onGameStart(SurvivalGame game)
{
    ItemStack eggs = MojangShitUtils.getMonsterEgg(EntityType.WOLF);
    eggs.setAmount((int) this.moduleConfiguration.get("eggs"));

    for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p == null)
            continue;

        p.getInventory().addItem(new ItemStack(Material.BONE, (int) this.moduleConfiguration.get("bones")));
        p.getInventory().addItem(new ItemStack(Material.ROTTEN_FLESH, (int) this.moduleConfiguration.get("rotten-flesh")));
        p.getInventory().addItem(eggs);
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:24,代码来源:PuppyPowerModule.java

示例6: onPlayerDeath

import net.samagames.api.games.GamePlayer; //导入方法依赖的package包/类
/**
 * Toggle speed when player dies
 *
 * @param event Event
 */
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event)
{
    for (GamePlayer player : (Collection<GamePlayer>) SamaGamesAPI.get().getGameManager().getGame().getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p == null)
            return;

        p.addPotionEffect((this.isSpeed ? PotionEffectType.SPEED : PotionEffectType.SLOW).createEffect(Integer.MAX_VALUE, 1));
    }

    this.isSpeed = !this.isSpeed;
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:21,代码来源:SpeedSwapModule.java

示例7: onGameStart

import net.samagames.api.games.GamePlayer; //导入方法依赖的package包/类
/**
 * Give 1 hoe to all the players
 *
 * @param game Game
 */
@Override
public void onGameStart(SurvivalGame game)
{
    for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p != null)
            p.getInventory().addItem(this.hoe);
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:17,代码来源:OneHealModule.java

示例8: onGameStart

import net.samagames.api.games.GamePlayer; //导入方法依赖的package包/类
/**
 * Multiply max health by 2
 *
 * @param game Game
 */
@Override
public void onGameStart(SurvivalGame game)
{
    for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p == null)
            continue;

        p.setMaxHealth(this.maxHealth);
        p.setHealth(this.maxHealth / 2);
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:20,代码来源:PotentialHeartsModule.java

示例9: onGameStart

import net.samagames.api.games.GamePlayer; //导入方法依赖的package包/类
/**
 * Give 1 ring to all the players
 *
 * @param game Game
 */
@Override
public void onGameStart(SurvivalGame game)
{
    for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values())
    {
        Player player1 = player.getPlayerIfOnline();
        if (player1 != null)
            player1.getInventory().addItem(this.ring);
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:16,代码来源:TheHobbitModule.java

示例10: onGameStart

import net.samagames.api.games.GamePlayer; //导入方法依赖的package包/类
/**
 * Double the health on game's start
 *
 * @param game Game
 */
@Override
public void onGameStart(SurvivalGame game)
{
    for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p == null)
            continue;

        p.setMaxHealth(40.0D);
        p.setHealth(40.0D);
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:20,代码来源:DoubleHealthModule.java

示例11: onGameStart

import net.samagames.api.games.GamePlayer; //导入方法依赖的package包/类
/**
 * Give spinash to all the players
 *
 * @param game Game
 */
@Override
public void onGameStart(SurvivalGame game)
{
    for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p != null)
            p.getInventory().addItem(this.spinash);
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:17,代码来源:PopeyeModule.java

示例12: onGameStart

import net.samagames.api.games.GamePlayer; //导入方法依赖的package包/类
/**
 * Fill the players inventories with barriers
 *
 * @param game Game
 */
@Override
public void onGameStart(SurvivalGame game)
{
    for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p == null)
            continue;

        for (int i = 9; i < 36; i++)
            p.getInventory().setItem(i, new ItemStack(Material.BARRIER, 1));
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:20,代码来源:NineSlotsModule.java

示例13: onGameStart

import net.samagames.api.games.GamePlayer; //导入方法依赖的package包/类
/**
 * Set everybody's life to 1.5 hearts and give notch apple
 *
 * @param game Game
 */
@Override
public void onGameStart(SurvivalGame game)
{
    for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p == null)
            continue;

        p.getInventory().addItem(new ItemStack(Material.GOLDEN_APPLE, (int) this.moduleConfiguration.get("golden-apples"), (short) 1));
        p.setHealth((double) this.moduleConfiguration.get("start-health"));
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:20,代码来源:ChickenModule.java

示例14: onGameStart

import net.samagames.api.games.GamePlayer; //导入方法依赖的package包/类
/**
 * Give 5 coca beans to all the players
 *
 * @param game Game
 */
@Override
public void onGameStart(SurvivalGame game)
{
    for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p != null)
            p.getInventory().addItem(this.cocoa);
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:17,代码来源:CocoaEffectsModule.java

示例15: onGameStart

import net.samagames.api.games.GamePlayer; //导入方法依赖的package包/类
/**
 * Give 1 water block to all the players
 *
 * @param game Game
 */
@Override
public void onGameStart(SurvivalGame game)
{
    for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values())
    {
        Player player1 = player.getPlayerIfOnline();
        if (player1 != null)
            player1.getInventory().addItem(new ItemStack(Material.WATER_BUCKET));
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:16,代码来源:PyroTechnicsModule.java


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