Send dungeon and map name on enter

This commit is contained in:
Daniel Saukel 2015-12-21 22:27:53 +01:00
parent c8708e8bc8
commit df8e45a8b4
2 changed files with 29 additions and 0 deletions

View File

@ -222,6 +222,13 @@ public class DGroup {
for (Player player : getPlayers()) { for (Player player : getPlayers()) {
DPlayer dplayer = DPlayer.get(player); DPlayer dplayer = DPlayer.get(player);
dplayer.respawn(); dplayer.respawn();
if (dungeonName != null) {
MessageUtil.sendScreenMessage(player, "&b&l" + dungeonName.replaceAll("_", " "), "&4&l" + mapName.replaceAll("_", ""));
} else {
MessageUtil.sendScreenMessage(player, "&4&l" + mapName.replaceAll("_", ""));
}
if ( !DungeonsXL.getPlugin().getMainConfig().enableEconomy()) { if ( !DungeonsXL.getPlugin().getMainConfig().enableEconomy()) {
continue; continue;
} }

View File

@ -1,7 +1,9 @@
package io.github.dre2n.dungeonsxl.util; package io.github.dre2n.dungeonsxl.util;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
public class MessageUtil { public class MessageUtil {
@ -102,6 +104,26 @@ public class MessageUtil {
sendCenteredMessage(sender, "&4&l[ &6" + plugin.getDescription().getName() + " &4&l]"); sendCenteredMessage(sender, "&4&l[ &6" + plugin.getDescription().getName() + " &4&l]");
} }
public static void sendScreenMessage(Player player, String title, String subtitle, long fadeIn, long show, long fadeOut) {
subtitle = ChatColor.translateAlternateColorCodes('&', subtitle);
title = ChatColor.translateAlternateColorCodes('&', title);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " time " + fadeIn + " " + show + " " + fadeOut);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " subtitle " + subtitle);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " title " + title);
}
public static void sendScreenMessage(Player player, String title, String subtitle) {
subtitle = ChatColor.translateAlternateColorCodes('&', subtitle);
title = ChatColor.translateAlternateColorCodes('&', title);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " subtitle \"" + subtitle + "\"");
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " title \"" + title + "\"");
}
public static void sendScreenMessage(Player player, String title) {
title = ChatColor.translateAlternateColorCodes('&', title);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title " + player.getName() + " title \"" + title + "\"");
}
public static final String[] BIG_A = { public static final String[] BIG_A = {
"IIIIIIIIIIII ", "IIIIIIIIIIII ",
" IIII IIII ", " IIII IIII ",