* Fixed double tag messages.
This commit is contained in:
parent
8d47225b87
commit
ee8b4fac89
@ -5,9 +5,7 @@ import java.util.List;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
|
||||
import nl.Steffion.BlockHunt.Managers.MessageM;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageM.CType;
|
||||
import nl.Steffion.BlockHunt.Managers.PermissionsM;
|
||||
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
|
||||
|
||||
@ -33,20 +31,19 @@ public class ArenaHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendMessage(Arena arena, String message, Boolean tag,
|
||||
String... vars) {
|
||||
public static void sendMessage(Arena arena, String message, String... vars) {
|
||||
for (Player player : arena.playersInArena) {
|
||||
String pMessage = message.replaceAll("%player%", player.getName());
|
||||
player.sendMessage(MessageM.replaceAll(CType.TAG() + pMessage, vars));
|
||||
player.sendMessage(MessageM.replaceAll(pMessage, vars));
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendFMessage(Arena arena, ConfigC location, Boolean tag,
|
||||
public static void sendFMessage(Arena arena, ConfigC location,
|
||||
String... vars) {
|
||||
for (Player player : arena.playersInArena) {
|
||||
String pMessage = location.config.getFile().get(location.location)
|
||||
.toString().replaceAll("%player%", player.getName());
|
||||
player.sendMessage(MessageM.replaceAll(CType.TAG() + pMessage, vars));
|
||||
player.sendMessage(MessageM.replaceAll(pMessage, vars));
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,7 +157,6 @@ public class ArenaHandler {
|
||||
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_joinJoinedArena,
|
||||
true,
|
||||
"playername-" + player.getName(),
|
||||
"1-" + arena.playersInArena.size(),
|
||||
"2-" + arena.maxPlayers);
|
||||
@ -169,7 +165,6 @@ public class ArenaHandler {
|
||||
.sendFMessage(
|
||||
arena,
|
||||
ConfigC.warning_lobbyNeedAtleast,
|
||||
true,
|
||||
"1-" + arena.minPlayers);
|
||||
}
|
||||
} else {
|
||||
@ -224,7 +219,7 @@ public class ArenaHandler {
|
||||
arena.timer = 0;
|
||||
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.warning_lobbyNeedAtleast, true, "1-"
|
||||
ConfigC.warning_lobbyNeedAtleast, "1-"
|
||||
+ arena.minPlayers);
|
||||
}
|
||||
|
||||
@ -246,10 +241,10 @@ public class ArenaHandler {
|
||||
Player seeker = arena.playersInArena.get(W.random
|
||||
.nextInt(arena.playersInArena.size()));
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.warning_ingameNEWSeekerChoosen, true,
|
||||
"seeker-" + seeker.getName());
|
||||
ConfigC.warning_ingameNEWSeekerChoosen, "seeker-"
|
||||
+ seeker.getName());
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_ingameSeekerChoosen, true, "seeker-"
|
||||
ConfigC.normal_ingameSeekerChoosen, "seeker-"
|
||||
+ seeker.getName());
|
||||
W.dcAPI.undisguisePlayer(seeker);
|
||||
for (Player pl : Bukkit.getOnlinePlayers()) {
|
||||
@ -308,7 +303,7 @@ public class ArenaHandler {
|
||||
MessageM.sendFMessage(player, ConfigC.normal_leaveYouLeft);
|
||||
if (message) {
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_leaveLeftArena,
|
||||
true, "playername-" + player.getName(), "1-"
|
||||
"playername-" + player.getName(), "1-"
|
||||
+ arena.playersInArena.size(), "2-"
|
||||
+ arena.maxPlayers);
|
||||
}
|
||||
@ -323,7 +318,7 @@ public class ArenaHandler {
|
||||
}
|
||||
|
||||
public static void seekersWin(Arena arena) {
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_winSeekers, true);
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_winSeekers);
|
||||
for (Player player : arena.playersInArena) {
|
||||
if (arena.seekersWinCommands != null) {
|
||||
for (String command : arena.seekersWinCommands) {
|
||||
@ -359,7 +354,7 @@ public class ArenaHandler {
|
||||
}
|
||||
|
||||
public static void hidersWin(Arena arena) {
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_winHiders, true);
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_winHiders);
|
||||
for (Player player : arena.playersInArena) {
|
||||
if (!arena.seekers.contains(player)) {
|
||||
if (arena.hidersWinCommands != null) {
|
||||
@ -398,7 +393,7 @@ public class ArenaHandler {
|
||||
}
|
||||
|
||||
public static void stopArena(Arena arena) {
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.warning_arenaStopped, true);
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.warning_arenaStopped);
|
||||
|
||||
arena.seekers.clear();
|
||||
|
||||
|
@ -271,8 +271,8 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
||||
arena.gameState = ArenaState.STARTING;
|
||||
arena.timer = arena.timeInLobbyUntilStart;
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_lobbyArenaIsStarting, true,
|
||||
"1-" + arena.timeInLobbyUntilStart);
|
||||
ConfigC.normal_lobbyArenaIsStarting, "1-"
|
||||
+ arena.timeInLobbyUntilStart);
|
||||
}
|
||||
} else if (arena.gameState == ArenaState.STARTING) {
|
||||
arena.timer = arena.timer - 1;
|
||||
@ -280,57 +280,57 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
||||
if (arena.timer == 60) {
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_lobbyArenaIsStarting,
|
||||
true, "1-60");
|
||||
"1-60");
|
||||
} else if (arena.timer == 30) {
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_lobbyArenaIsStarting,
|
||||
true, "1-30");
|
||||
"1-30");
|
||||
} else if (arena.timer == 10) {
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_lobbyArenaIsStarting,
|
||||
true, "1-10");
|
||||
"1-10");
|
||||
} else if (arena.timer == 5) {
|
||||
arena.lobbyWarp.getWorld()
|
||||
.playSound(arena.lobbyWarp,
|
||||
Sound.ORB_PICKUP, 1, 0);
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_lobbyArenaIsStarting,
|
||||
true, "1-5");
|
||||
"1-5");
|
||||
} else if (arena.timer == 4) {
|
||||
arena.lobbyWarp.getWorld()
|
||||
.playSound(arena.lobbyWarp,
|
||||
Sound.ORB_PICKUP, 1, 0);
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_lobbyArenaIsStarting,
|
||||
true, "1-4");
|
||||
"1-4");
|
||||
} else if (arena.timer == 3) {
|
||||
arena.lobbyWarp.getWorld()
|
||||
.playSound(arena.lobbyWarp,
|
||||
Sound.ORB_PICKUP, 1, 1);
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_lobbyArenaIsStarting,
|
||||
true, "1-3");
|
||||
"1-3");
|
||||
} else if (arena.timer == 2) {
|
||||
arena.lobbyWarp.getWorld()
|
||||
.playSound(arena.lobbyWarp,
|
||||
Sound.ORB_PICKUP, 1, 1);
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_lobbyArenaIsStarting,
|
||||
true, "1-2");
|
||||
"1-2");
|
||||
} else if (arena.timer == 1) {
|
||||
arena.lobbyWarp.getWorld()
|
||||
.playSound(arena.lobbyWarp,
|
||||
Sound.ORB_PICKUP, 1, 2);
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_lobbyArenaIsStarting,
|
||||
true, "1-1");
|
||||
"1-1");
|
||||
}
|
||||
} else {
|
||||
arena.gameState = ArenaState.INGAME;
|
||||
arena.timer = arena.gameTime;
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_lobbyArenaStarted, true,
|
||||
"secs-" + arena.waitingTimeSeeker);
|
||||
ConfigC.normal_lobbyArenaStarted, "secs-"
|
||||
+ arena.waitingTimeSeeker);
|
||||
|
||||
for (int i = arena.amountSeekersOnStart; i > 0; i = i - 1) {
|
||||
Player seeker = arena.playersInArena
|
||||
@ -340,7 +340,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
||||
if (!arena.seekers.contains(seeker)) {
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_ingameSeekerChoosen,
|
||||
true, "seeker-" + seeker.getName());
|
||||
"seeker-" + seeker.getName());
|
||||
arena.seekers.add(seeker);
|
||||
seeker.teleport(arena.seekersWarp);
|
||||
W.seekertime.put(seeker,
|
||||
@ -471,55 +471,46 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
||||
}
|
||||
if (arena.timer == 190) {
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_ingameArenaEnd, true,
|
||||
"1-190");
|
||||
ConfigC.normal_ingameArenaEnd, "1-190");
|
||||
} else if (arena.timer == 60) {
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_ingameArenaEnd, true,
|
||||
"1-60");
|
||||
ConfigC.normal_ingameArenaEnd, "1-60");
|
||||
} else if (arena.timer == 30) {
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_ingameArenaEnd, true,
|
||||
"1-30");
|
||||
ConfigC.normal_ingameArenaEnd, "1-30");
|
||||
} else if (arena.timer == 10) {
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_ingameArenaEnd, true,
|
||||
"1-10");
|
||||
ConfigC.normal_ingameArenaEnd, "1-10");
|
||||
} else if (arena.timer == 5) {
|
||||
arena.lobbyWarp.getWorld()
|
||||
.playSound(arena.lobbyWarp,
|
||||
Sound.ORB_PICKUP, 1, 0);
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_ingameArenaEnd, true,
|
||||
"1-5");
|
||||
ConfigC.normal_ingameArenaEnd, "1-5");
|
||||
} else if (arena.timer == 4) {
|
||||
arena.lobbyWarp.getWorld()
|
||||
.playSound(arena.lobbyWarp,
|
||||
Sound.ORB_PICKUP, 1, 0);
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_ingameArenaEnd, true,
|
||||
"1-4");
|
||||
ConfigC.normal_ingameArenaEnd, "1-4");
|
||||
} else if (arena.timer == 3) {
|
||||
arena.lobbyWarp.getWorld()
|
||||
.playSound(arena.lobbyWarp,
|
||||
Sound.ORB_PICKUP, 1, 1);
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_ingameArenaEnd, true,
|
||||
"1-3");
|
||||
ConfigC.normal_ingameArenaEnd, "1-3");
|
||||
} else if (arena.timer == 2) {
|
||||
arena.lobbyWarp.getWorld()
|
||||
.playSound(arena.lobbyWarp,
|
||||
Sound.ORB_PICKUP, 1, 1);
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_ingameArenaEnd, true,
|
||||
"1-2");
|
||||
ConfigC.normal_ingameArenaEnd, "1-2");
|
||||
} else if (arena.timer == 1) {
|
||||
arena.lobbyWarp.getWorld()
|
||||
.playSound(arena.lobbyWarp,
|
||||
Sound.ORB_PICKUP, 1, 2);
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_ingameArenaEnd, true,
|
||||
"1-1");
|
||||
ConfigC.normal_ingameArenaEnd, "1-1");
|
||||
}
|
||||
} else {
|
||||
ArenaHandler.hidersWin(arena);
|
||||
|
@ -101,7 +101,6 @@ public class OnEntityDamageByEntityEvent implements Listener {
|
||||
.sendFMessage(
|
||||
arena,
|
||||
ConfigC.normal_HiderDied,
|
||||
true,
|
||||
"playername-"
|
||||
+ player.getName(),
|
||||
"left-"
|
||||
@ -110,7 +109,7 @@ public class OnEntityDamageByEntityEvent implements Listener {
|
||||
.size()));
|
||||
} else {
|
||||
ArenaHandler.sendFMessage(arena,
|
||||
ConfigC.normal_SeekerDied, true,
|
||||
ConfigC.normal_SeekerDied,
|
||||
"playername-" + player.getName(),
|
||||
"secs-" + arena.waitingTimeSeeker);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user