本文整理汇总了Java中org.bukkit.entity.Player.setMaximumNoDamageTicks方法的典型用法代码示例。如果您正苦于以下问题:Java Player.setMaximumNoDamageTicks方法的具体用法?Java Player.setMaximumNoDamageTicks怎么用?Java Player.setMaximumNoDamageTicks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.setMaximumNoDamageTicks方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cancelMatch
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void cancelMatch(String cancelReason) {
this.sendMessage(ChatColor.DARK_RED + "The match has been canceled for: " + ChatColor.RED + cancelReason);
for (Player player : getPlayers()) {
if (this.leftMatch.contains(player.getUniqueId())) continue;
GameUtils.resetPlayer(player);
PracticeProfile profile = ManagerHandler.getPlayerManager().getPlayerProfile(player);
profile.setStatus(PlayerStatus.LOBBY);
profile.setCurrentMatch(null);
if (profile.getParty() != null) {
if (profile.getParty().getLeader() == player) {
player.getInventory().setContents(GameUtils.getPartyLeaderInventory());
}
else {
player.getInventory().setContents(GameUtils.getPartyMemberInventory());
}
}
else {
player.getInventory().setContents(GameUtils.getLobbyInventory());
}
player.setMaximumNoDamageTicks(19);
player.setAllowFlight(false);
player.updateInventory();
ManagerHandler.getEntityHider().showAllPlayers(player);
ManagerHandler.getConfig().teleportToSpawn(player);
ManagerHandler.getScoreboardHandler().getPlayerBoard(player.getUniqueId()).addUpdates(getPlayers());
}
cleanSpectators();
ManagerHandler.getMatchManager().getMatches().remove(this.identifier);
this.matchStatus = MatchStatus.CANCELED;
}
示例2: PlayerManager
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public PlayerManager() {
this.profiles = new HashMap<>();
for (Player player : Bukkit.getOnlinePlayers()) {
player.setMaximumNoDamageTicks(19);
PracticeProfile data = new PracticeProfile(player);
this.profiles.put(player.getUniqueId(), data);
}
Bukkit.getPluginManager().registerEvents(this, PracticePlugin.getInstance());
}
示例3: onJoin
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onJoin(PlayerJoinEvent event) {
event.setJoinMessage(null);
Player player = event.getPlayer();
player.setMaximumNoDamageTicks(19);
GameUtils.resetPlayer(player);
player.getInventory().setContents(GameUtils.getLobbyInventory());
player.updateInventory();
ManagerHandler.getConfig().teleportToSpawn(player);
player.setCanPickupItems(false);
if (player.getGameMode() != GameMode.CREATIVE) {
player.setAllowFlight(false);
}
player.spigot().setCollidesWithEntities(false);
player.sendMessage(ChatColor.GRAY + ChatColor.STRIKETHROUGH.toString() + "---------------------------------------------");
player.sendMessage(ChatColor.GRAY + "" + ChatColor.BOLD + " * " + ChatColor.GRAY + "Welcome to " + ChatColor.AQUA + "" + ChatColor.BOLD + "PvPTemple" + ChatColor.GRAY + "!");
player.sendMessage(ChatColor.GRAY + "" + ChatColor.BOLD + " * " + ChatColor.GRAY + "TeamSpeak: " + ChatColor.AQUA + "ts.pvptemple.it:1919");
player.sendMessage(ChatColor.GRAY + "" + ChatColor.BOLD + " * " + ChatColor.GRAY + "Store: " + ChatColor.AQUA + "store.pvptemple.it");
player.sendMessage(ChatColor.GRAY + ChatColor.STRIKETHROUGH.toString() + "---------------------------------------------");
ManagerHandler.getScoreboardHandler().applyBoard(player);
for (PlayerBoard board : ManagerHandler.getScoreboardHandler().getPlayerBoards().values()) {
board.addUpdate(player);
}
new BukkitRunnable() {
public void run() {
ManagerHandler.getScoreboardHandler().getPlayerBoard(player.getUniqueId()).addUpdates(Bukkit.getOnlinePlayers());
}
}.runTaskLater(PracticePlugin.getInstance(), 4L);
}
示例4: onEnable
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, HCF.getPlugin());
for (Player player : Bukkit.getOnlinePlayers()) {
player.setMaximumNoDamageTicks(17);
}
}
示例5: cancelMatch
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void cancelMatch(String cancelReason) {
this.sendMessage(ChatColor.DARK_RED + "The match has been canceled for: " + ChatColor.RED + cancelReason);
if (queue != null) {
queue.setPlayingAmount(queue.getPlayingAmount() - 2);
}
for (Player p : getPlayers()) {
if (leftMatch.contains(p.getUniqueId())) continue;
GameUtils.resetPlayer(p);
PracticeProfile profile = ManagerHandler.getPlayerManager().getPlayerProfile(p);
profile.setStatus(PlayerStatus.LOBBY);
profile.setCurrentMatch(null);
if (profile.getParty() != null) {
if (profile.getParty().getLeader() == p) {
p.getInventory().setContents(GameUtils.getPartyLeaderInventory());
}
else {
p.getInventory().setContents(GameUtils.getPartyMemberInventory());
}
}
else {
p.getInventory().setContents(GameUtils.getLobbyInventory());
}
p.updateInventory();
p.setAllowFlight(false);
p.setMaximumNoDamageTicks(19);
ManagerHandler.getConfig().teleportToSpawn(p);
ManagerHandler.getScoreboardHandler().getPlayerBoard(p.getUniqueId()).addUpdates(getPlayers());
}
cleanSpectators();
ManagerHandler.getMatchManager().getMatches().remove(this.identifier);
this.matchStatus = MatchStatus.CANCELED;
}
示例6: onEnable
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void onEnable() {
instance = this;
new ManagerHandler(this);
new Cache();
this.loadListeners();
Map<String, PluginCommand> commands = new HashMap<>();
commands.put("practice", new PracticeCommand(this));
commands.put("ladder", new LadderCommand(this));
commands.put("arena", new ArenaCommand(this));
commands.put("party", new PartyCommand(this));
commands.put("duel", new DuelCommand(this));
commands.put("partyduel", new PartyDuelCommand(this));
commands.put("inventory", new InventoryCommand(this));
commands.put("spectate", new SpectateCommand(this));
commands.put("savedata", new SaveDataCommand(this));
commands.put("cancel", new CancelCommand(this));
commands.put("statistics", new StatisticsCommand(this));
commands.put("day", new DayCommand(this));
commands.put("night", new NightCommand(this));
commands.put("variable", new VariableCommand(this));
commands.put("changelog", new ChangeLogCommand(this));
commands.put("ping", new PingCommand(this));
commands.forEach((name, command) -> this.getCommand(name).setExecutor(command));
Bukkit.setWhitelist(true);
for (Player player : Bukkit.getOnlinePlayers()) {
GameUtils.resetPlayer(player);
player.getInventory().setContents(GameUtils.getLobbyInventory());
player.updateInventory();
player.setMaximumNoDamageTicks(19);
ManagerHandler.getConfig().teleportToSpawn(player);
}
new BukkitRunnable() {
public void run() {
for (World world : Bukkit.getServer().getWorlds()) {
for (Entity entity : world.getEntities()) {
if (entity instanceof Item) {
entity.remove();
}
}
}
}
}.runTaskTimer(this, 0L, 20L * 30);
new BukkitRunnable() {
public void run() {
Bukkit.setWhitelist(false);
}
}.runTaskLater(PracticePlugin.getInstance(), 20L * 3);
}