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


Java Player.setMaximumNoDamageTicks方法代码示例

本文整理汇总了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;
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:41,代码来源:FfaMatch.java

示例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());
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:12,代码来源:PlayerManager.java

示例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);
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:41,代码来源:PlayerListener.java

示例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);
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:7,代码来源:HitDetectionListener.java

示例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;
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:44,代码来源:TeamMatch.java

示例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);
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:57,代码来源:PracticePlugin.java


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