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


Java SurvivalGame类代码示例

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


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

示例1: onGameStart

import net.samagames.survivalapi.game.SurvivalGame; //导入依赖的package包/类
/**
 * Give effects to all players
 *
 * @param game Game instance
 */
@Override
public void onGameStart(SurvivalGame game)
{
    for (SurvivalPlayer player : (Collection<SurvivalPlayer>)game.getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p == null)
            continue;

        p.addPotionEffect(PotionEffectType.SPEED.createEffect(Integer.MAX_VALUE, 1));
        p.addPotionEffect(PotionEffectType.INCREASE_DAMAGE.createEffect(Integer.MAX_VALUE, 1));
        p.addPotionEffect(PotionEffectType.DAMAGE_RESISTANCE.createEffect(Integer.MAX_VALUE, 1));
        p.addPotionEffect(PotionEffectType.JUMP.createEffect(Integer.MAX_VALUE, 4));
        p.setMaxHealth(32D);
        p.setHealth(32D);
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:24,代码来源:SuperheroesModule.java

示例2: onGameStart

import net.samagames.survivalapi.game.SurvivalGame; //导入依赖的package包/类
/**
 * Give effects to all players
 *
 * @param game Game instance
 */
@Override
public void onGameStart(SurvivalGame game)
{
    for (SurvivalPlayer player : (Collection<SurvivalPlayer>)game.getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p == null)
            continue;

        p.addPotionEffect(PotionEffectType.SPEED.createEffect(Integer.MAX_VALUE, 2));
        p.addPotionEffect(PotionEffectType.FAST_DIGGING.createEffect(Integer.MAX_VALUE, 2));
        p.addPotionEffect(PotionEffectType.SATURATION.createEffect(Integer.MAX_VALUE, 10));
        p.addPotionEffect(PotionEffectType.INCREASE_DAMAGE.createEffect(Integer.MAX_VALUE, 1));
        p.addPotionEffect(PotionEffectType.DAMAGE_RESISTANCE.createEffect(Integer.MAX_VALUE, 1));
        p.addPotionEffect(PotionEffectType.FIRE_RESISTANCE.createEffect(Integer.MAX_VALUE, 1));
        p.addPotionEffect(PotionEffectType.JUMP.createEffect(Integer.MAX_VALUE, 4));
        p.addPotionEffect(PotionEffectType.WATER_BREATHING.createEffect(Integer.MAX_VALUE, 1));
        p.setMaxHealth(40D);
        p.setHealth(40D);
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:28,代码来源:SuperheroesPlusModule.java

示例3: onGameStart

import net.samagames.survivalapi.game.SurvivalGame; //导入依赖的package包/类
/**
 * Select one ninjanaut at start
 *
 * @param game Game instance
 */
@Override
public void onGameStart(SurvivalGame game)
{
    super.onGameStart(game);
    Map map = game.getInGamePlayers();
    int r = new Random().nextInt(map.size());

    for (SurvivalPlayer player : (Collection<SurvivalPlayer>)map.values())
    {
        if (r == 0)
        {
            this.setNinjaNaut(game, player, true);
            return;
        }

        r--;
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:24,代码来源:NinjanautModule.java

示例4: onGameStart

import net.samagames.survivalapi.game.SurvivalGame; //导入依赖的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

示例5: onGameStart

import net.samagames.survivalapi.game.SurvivalGame; //导入依赖的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

示例6: onGameStart

import net.samagames.survivalapi.game.SurvivalGame; //导入依赖的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

示例7: onGameStart

import net.samagames.survivalapi.game.SurvivalGame; //导入依赖的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

示例8: onGameStart

import net.samagames.survivalapi.game.SurvivalGame; //导入依赖的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

示例9: onPlayerMove

import net.samagames.survivalapi.game.SurvivalGame; //导入依赖的package包/类
/**
 * Damage player when walking on gravel if he does not have boots
 * @param event Move event
 */
@EventHandler
public void onPlayerMove(PlayerMoveEvent event)
{
    if (!((SurvivalGame) SamaGamesAPI.get().getGameManager().getGame()).isDamagesActivated())
        return;

    Block block = event.getTo().clone().subtract(0, 1, 0).getBlock();

    if (block != null && this.blocks.contains(block.getType())
            && (event.getPlayer().getInventory().getBoots() == null || event.getPlayer().getInventory().getBoots().getType() == Material.AIR)
            && !this.damaged.contains(event.getPlayer().getUniqueId()))
    {
        this.damaged.add(event.getPlayer().getUniqueId());
        event.getPlayer().damage((double) this.moduleConfiguration.get("damages"));

        this.plugin.getServer().getScheduler().runTaskLater(this.plugin, () -> this.damaged.remove(event.getPlayer().getUniqueId()), 20L);
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:23,代码来源:PainfulStonesModule.java

示例10: onEnable

import net.samagames.survivalapi.game.SurvivalGame; //导入依赖的package包/类
@Override
public void onEnable()
{
    SurvivalGame game;

    int nb = SamaGamesAPI.get().getGameManager().getGameProperties().getOption("playersPerTeam", new JsonPrimitive(1)).getAsInt();
    SurvivalAPI.get().loadModule(OneShieldModule.class, null);

    if (nb > 1)
        game = new RunBasedTeamGame<>(this, "uhcrun", "UHCRun", "L’expérience d’un UHC en 30 minutes", "=", RunBasedGameLoop.class, nb);
    else
        game = new RunBasedSoloGame<>(this, "uhcrun", "UHCRun", "L’expérience d’un UHC en 30 minutes", "=", RunBasedGameLoop.class);

    SamaGamesAPI.get().getGameManager().setMaxReconnectTime(20);
    SamaGamesAPI.get().getStatsManager().setStatsToLoad(GamesNames.UHCRUN, true);
    SamaGamesAPI.get().getShopsManager().setShopToLoad(GamesNames.UHCRUN, true);
    SamaGamesAPI.get().getGameManager().setGameStatisticsHelper(new UHCRunStatisticsHelper());
    SamaGamesAPI.get().getGameManager().registerGame(game);
}
 
开发者ID:SamaGames,项目名称:UHCRun,代码行数:20,代码来源:UHCRun.java

示例11: onGameStart

import net.samagames.survivalapi.game.SurvivalGame; //导入依赖的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

示例12: onGameStart

import net.samagames.survivalapi.game.SurvivalGame; //导入依赖的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

示例13: onGameStart

import net.samagames.survivalapi.game.SurvivalGame; //导入依赖的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

示例14: onGameStart

import net.samagames.survivalapi.game.SurvivalGame; //导入依赖的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

示例15: onGameStart

import net.samagames.survivalapi.game.SurvivalGame; //导入依赖的package包/类
@Override
public void onGameStart(SurvivalGame game)
{
    this.chestLocation = new Location(Bukkit.getWorlds().get(0), 0, 0, 0);
    this.chestLocation.setY(this.chestLocation.getWorld().getHighestBlockYAt(this.chestLocation));
    this.chestLocation.getBlock().setType(Material.ENDER_CHEST);

    this.plugin.getServer().getScheduler().runTaskTimer(this.plugin, () -> ParticleEffect.PORTAL.display(random.nextFloat() % 3F - 1.5F, random.nextFloat() % 3F - 1.5F, random.nextFloat() % 3F - 1.5F, 1F, 3, this.chestLocation, 100.0D), 4, 4);
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:10,代码来源:RiskyRetrievalModule.java


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