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