當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。