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