本文整理汇总了Java中net.samagames.api.games.GamePlayer类的典型用法代码示例。如果您正苦于以下问题:Java GamePlayer类的具体用法?Java GamePlayer怎么用?Java GamePlayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GamePlayer类属于net.samagames.api.games包,在下文中一共展示了GamePlayer类的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);
}
}
示例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);
}
}
示例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);
}
}
示例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));
}
}
示例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);
}
}
示例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;
}
示例7: onPlayerChat
import net.samagames.api.games.GamePlayer; //导入依赖的package包/类
/**
* Spectator's chat
*
* @param event Event
*/
@EventHandler(ignoreCancelled = true)
public void onPlayerChat(AsyncPlayerChatEvent event)
{
if (SamaGamesAPI.get().getGameManager().getGame() == null)
return;
else if (!SamaGamesAPI.get().getGameManager().getGame().getStatus().equals(Status.IN_GAME))
return;
else if (!SamaGamesAPI.get().getGameManager().getGame().isSpectator(event.getPlayer()))
return;
else if (SamaGamesAPI.get().getGameManager().getGame().isModerator(event.getPlayer()))
return;
event.setCancelled(true);
String finalMessage = ChatColor.GRAY + "[Spectateur] " + event.getPlayer().getName() + ": " + event.getMessage();
SamaGamesAPI.get().getGameManager().getGame().getSpectatorPlayers().values().stream().filter(spectator -> ((GamePlayer) spectator).getPlayerIfOnline() != null).forEach(spectator -> ((GamePlayer) spectator).getPlayerIfOnline().sendMessage(finalMessage));
Bukkit.getOnlinePlayers().stream().filter(player -> !SamaGamesAPI.get().getGameManager().getGame().hasPlayer(player)).forEach(player -> player.sendMessage(finalMessage));
}
示例8: 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);
}
}
示例9: 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);
}
}
示例10: 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);
}
}
示例11: 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);
}
}
示例12: 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);
}
}
示例13: 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));
}
}
示例14: 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"));
}
}
示例15: 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);
}
}