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


Java Player.sendTitle方法代码示例

本文整理汇总了Java中org.bukkit.entity.Player.sendTitle方法的典型用法代码示例。如果您正苦于以下问题:Java Player.sendTitle方法的具体用法?Java Player.sendTitle怎么用?Java Player.sendTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.entity.Player的用法示例。


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

示例1: sendTitle

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public void sendTitle(Player player,String title,String subTitle,int arg2,int arg3,int arg4){
	if(PVPAsWantedManager.versionValue >= 1112){
		player.sendTitle(title, subTitle, arg2, arg3, arg4);
	}else if(PVPAsWantedManager.versionValue >= 188){
		player.sendTitle(title, subTitle);
		new BukkitRunnable(){
			@Override
			public void run() {
				player.resetTitle();
			}
		}.runTaskLaterAsynchronously(this, arg3);
	}
}
 
开发者ID:Saukiya,项目名称:PVPAsWantedManager,代码行数:15,代码来源:PVPAsWantedManager.java

示例2: onMatchResult

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onMatchResult(MatchResultEvent event) {
    MatchTeam spectators = TGM.get().getModule(TeamManagerModule.class).getSpectators();

    for (Player player : Bukkit.getOnlinePlayers()) {
        if (spectators.containsPlayer(player)) {
            player.playSound(player.getLocation(), Sound.ENTITY_WITHER_DEATH, 1f, 1f);
        } else {
            if (event.getWinningTeam() == null) {
                player.sendTitle("", ChatColor.YELLOW + "The result was a tie!", 10, 40, 10);
                player.playSound(player.getLocation(), Sound.ENTITY_WITHER_SPAWN, 1f, 1f);
            } else if (event.getWinningTeam().containsPlayer(player)) {
                player.sendTitle("", ChatColor.GREEN + "Your team won!", 10, 40, 10);
                player.playSound(player.getLocation(), Sound.ENTITY_WITHER_DEATH, 1f, 1f);
            } else {
                player.sendTitle("", ChatColor.RED + "Your team lost!", 10, 40, 10);
                player.playSound(player.getLocation(), Sound.ENTITY_WITHER_SPAWN, 1f, 1f);
            }
        }

        player.sendMessage("" + ChatColor.AQUA + ChatColor.STRIKETHROUGH + "---------------------");
        if (event.getWinningTeam() != null) {
            player.sendMessage(ChatColor.DARK_PURPLE + "  Winning Team: " + event.getWinningTeam().getColor() + event.getWinningTeam().getAlias());
        } else {
            player.sendMessage(ChatColor.DARK_PURPLE + "" + ChatColor.YELLOW + "  Tie!" + ChatColor.YELLOW + "");
        }
        if (event.getWinningTeam().containsPlayer(player)) {
            player.sendMessage(ChatColor.GRAY + "  Congratulations!");
        }  else if (TGM.get().getModule(TeamManagerModule.class).getTeam(player) != null && TGM.get().getModule(TeamManagerModule.class).getTeam(player).isSpectator()) {
            player.sendMessage(ChatColor.GRAY + "  Play next game?");
        } else {
            player.sendMessage(ChatColor.GRAY+ "  Better luck next time!");
        }
            player.sendMessage("" + ChatColor.AQUA + ChatColor.STRIKETHROUGH + "---------------------");
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:37,代码来源:MatchResultModule.java

示例3: onTick

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
protected void onTick() {
    if(isCancelled()) return;

    int amountParticipating = teamManagerModule.getAmountParticipating();
    if (amountParticipating < REQUIRED_PLAYERS) {
        int needed = REQUIRED_PLAYERS - amountParticipating;
        getBossBar().setProgress(1);
        getBossBar().setTitle(ChatColor.RED + "Waiting for " + ChatColor.AQUA + needed +
                ChatColor.RED + " more player" + (needed == 1 ? "" : "s") + " to join");
        getBossBar().setColor(BarColor.RED);

        setTimeLeft(getTimeMax());
        return;
    }

    getBossBar().setProgress((getTimeMax() - getTimeLeft()) / getTimeMax());

    if (getTimeLeft() % 20 == 0) {
        getBossBar().setColor(BarColor.GREEN);
        getBossBar().setTitle(ChatColor.GREEN + "Match starting in " + ChatColor.DARK_RED + getTimeLeftSeconds() +
                ChatColor.GREEN + " second" + (getTimeLeftSeconds() > 1 ? "s" : ""));

        if (getTimeLeftSeconds() <= 3) {
            for (Player player : Bukkit.getOnlinePlayers()) {
                player.playSound(player.getLocation(), Sound.BLOCK_NOTE_PLING, 1, 1);
                if (!TGM.get().getModule(TeamManagerModule.class).getSpectators().containsPlayer(player)) {
                    player.sendTitle(ChatColor.YELLOW.toString() + getTimeLeftSeconds(), "", 0, 5, 15);
                }
            }
        }
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:34,代码来源:StartCountdown.java

示例4: onFinish

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
protected void onFinish() {
    getBossBar().setVisible(false);
    TGM.get().getMatchManager().startMatch();

    for (Player player : Bukkit.getOnlinePlayers()) {
        player.playSound(player.getLocation(), Sound.BLOCK_NOTE_PLING, 1, 2);
        if (!TGM.get().getModule(TeamManagerModule.class).getSpectators().containsPlayer(player)) {
            player.sendTitle(ChatColor.GREEN + "GO!", "", 0, 5, 15);
        }
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:13,代码来源:StartCountdown.java

示例5: showLives

import org.bukkit.entity.Player; //导入方法依赖的package包/类
private void showLives(Player player) {
    player.sendTitle(ChatColor.translateAlternateColorCodes('&', title.replaceAll("%lives%", "" + getLives(player)).replaceAll("%player%", player.getName())),
                    ChatColor.translateAlternateColorCodes('&', subtitle.replaceAll("%lives%", "" + getLives(player)).replaceAll("%player%", player.getName())));
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:5,代码来源:BlitzModule.java

示例6: onDamage

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onDamage(EntityDamageEvent event) {
    if (!(event.getEntity() instanceof Player)) return;
    Player player = (Player) event.getEntity();
    if (!TGM.get().getMatchManager().getMatch().getMatchStatus().equals(MatchStatus.MID) || teamManagerModule.getTeam(player).isSpectator()) return;
    if (player.getHealth() - event.getFinalDamage() >= 0.5) return;

    createDeath(event);
    removeLife(player);

    event.setDamage(0);
    TGM.get().getModule(SpawnPointHandlerModule.class).spawnPlayer(TGM.get().getPlayerManager().getPlayerContext(player), teamManagerModule.getTeam(player), false);

    if (getLives(player) <= 0) {
        player.setGameMode(GameMode.SPECTATOR);
        player.setAllowFlight(true);
        player.setFlying(true);
        player.getInventory().clear();

        if (player.getLocation().getY() < 0) {
            player.teleport(teamManagerModule.getTeam(player).getSpawnPoints().get(0).getLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN);
        }

        MatchTeam team = teamManagerModule.getTeam(player);
        updateScoreboardTeamLine(team, getAlivePlayers(team).size());

        Bukkit.broadcastMessage(team.getColor() + player.getName() + ChatColor.RED + " has been eliminated!");
        player.sendTitle("", ChatColor.RED + "You have been eliminated.");

    } else {
        showLives(player);
        player.teleport(teamManagerModule.getTeam(player).getSpawnPoints().get(0).getLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN);
    }

    if (lastTeamAlive()) {
        MatchTeam winnerTeam = teamManagerModule.getTeams().stream().filter(matchTeam -> !matchTeam.isSpectator()).filter(matchTeam -> getAlivePlayers(matchTeam).size() > 0).findFirst().get();
        if (winnerTeam == null) {
            winnerTeam = teamManagerModule.getTeams().get(1);
        }
        TGM.get().getMatchManager().endMatch(winnerTeam);
        return;
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:44,代码来源:BlitzModule.java

示例7: sendTitle

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void sendTitle(Player player, String title, String subtitle, int fadeIn, int stay, int fadeOut)
{
	player.sendTitle(title, subtitle, fadeIn, stay, fadeOut);
}
 
开发者ID:timtomtim7,项目名称:SparseBukkitAPI,代码行数:5,代码来源:VersionUtils_v1_12_R1.java

示例8: sendTitle

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void sendTitle(Player player, BaseComponent title, BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) {
    player.sendTitle(title.toLegacyText(), subtitle.toLegacyText(), fadeInTicks, stayTicks, fadeOutTicks);
}
 
开发者ID:NyaaCat,项目名称:NyaaCore,代码行数:4,代码来源:Message.java

示例9: onComplete

import org.bukkit.entity.Player; //导入方法依赖的package包/类
protected void onComplete(Player player) {
    Core.broadcast(ChatColor.AQUA + player.getName() + ChatColor.GREEN + " has completed the " + Parties.getParty().getName() + " Party parkour!");
    player.sendTitle(new Title(ChatColor.GOLD + "Congratulations!"));
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:5,代码来源:ParkourGame.java

示例10: send

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void send(Player player) {
    if (player != null)
        player.sendTitle(formatting(title), formatting(subTitle), fadeIn, stay, fadeOut);
}
 
开发者ID:EntryPointKR,项目名称:MCLibrary,代码行数:5,代码来源:TitleHolder.java

示例11: onVoucherReward

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onVoucherReward(RVRewardEvent e) {
    Player p = e.getPlayer();
    String rw = e.getReward();
    Voucher v = e.getVoucher();

    String reward = rw
        .replace("%x%", "" + p.getLocation().getBlockX())
        .replace("%y%", "" + p.getLocation().getBlockY())
        .replace("%z%", "" + p.getLocation().getBlockZ())
        .replace("%tier%", v.getId())
        .replace("%player%", p.getName())
        .replace("%limit%", "" + v.getLimit());

    switch (getType(e.getAction())) {
        case "CONSOLE_COMMAND":
            Bukkit.dispatchCommand(Bukkit.getConsoleSender(), reward);
            break;
        case "PLAYER_COMMAND":
            p.performCommand(reward);
            break;
        case "TELL_PLAYER":
            p.sendMessage(ColorUtil.translate(reward));
            break;
        case "BROADCAST":
            Bukkit.broadcastMessage(ColorUtil.translate(reward));
            break;
        case "PLAY_SOUND":
            Sound s = Sound.valueOf(reward);
            p.playSound(p.getLocation(), s, 3, 3);
            break;
        case "PLAYER_TITLE":
            String title = reward.contains(";") ? reward.split(";")[0] : reward;
            String sub = reward.contains(";") ? reward.split(";")[1] : "";
            p.sendTitle(ColorUtil.translate(title), ColorUtil.translate(sub));
            break;
        case "CENTER_MESSAGE":
            CenterUtil.sendCenteredMessage(p, reward);
            break;
        case "CENTER_BROADCAST":
            for (Player player : Bukkit.getOnlinePlayers()) {
                CenterUtil.sendCenteredMessage(player, reward);
            }
            break;
        case "PLAYER_CHAT":
            p.sendMessage(ColorUtil.translate(reward));
            break;
        case "FIREWORK":
            Firework fw = p.getWorld().spawn(p.getLocation(), Firework.class);
            //use meta to customize the firework or add parameters to the method
            fw.setVelocity(p.getLocation().getDirection().multiply(50));
            fw.setGlowing(true);
            break;
    }
}
 
开发者ID:Chazmondo,项目名称:RankVouchers,代码行数:56,代码来源:VoucherRewardEvent.java


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