added custom leaderboard, bug fixes

This commit is contained in:
Tyler Murphy 2022-04-12 15:11:49 -04:00
parent ec2bf9d35d
commit 38fd4f5740
10 changed files with 326 additions and 139 deletions

View file

@ -22,9 +22,12 @@ package net.tylermurphy.hideAndSeek.configuration;
import net.tylermurphy.hideAndSeek.util.Version; import net.tylermurphy.hideAndSeek.util.Version;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.Collections;
import java.util.List;
public class Config { public class Config {
private static ConfigManager manager; private static ConfigManager config, leaderboard;
public static String public static String
messagePrefix, messagePrefix,
@ -80,106 +83,148 @@ public class Config {
seekerPingLevel1, seekerPingLevel1,
seekerPingLevel2, seekerPingLevel2,
seekerPingLevel3; seekerPingLevel3;
public static String
LOBBY_TITLE,
GAME_TITLE,
COUNTDOWN_WAITING,
COUNTDOWN_COUNTING,
COUNTDOWN_ADMINSTART,
TAUNT_COUNTING,
TAUNT_ACTIVE,
TAUNT_EXPIRED,
GLOW_ACTIVE,
GLOW_INACTIVE,
BORDER_COUNTING,
BORDER_DECREASING;
public static List<String>
LOBBY_CONTENTS,
GAME_CONTENTS;
public static List<String>
blockedCommands;
public static void loadConfig() { public static void loadConfig() {
manager = new ConfigManager("config.yml"); config = new ConfigManager("config.yml");
manager.saveConfig(); config.saveConfig();
leaderboard = new ConfigManager("leaderboard.yml");
leaderboard.saveConfig();
//Spawn //Spawn
spawnPosition = new Vector( spawnPosition = new Vector(
manager.getDouble("spawns.game.x"), config.getDouble("spawns.game.x"),
Math.max(0, Math.min(255, manager.getDouble("spawns.game.y"))), Math.max(0, Math.min(255, config.getDouble("spawns.game.y"))),
manager.getDouble("spawns.game.z") config.getDouble("spawns.game.z")
); );
spawnWorld = manager.getString("spawns.game.world"); spawnWorld = config.getString("spawns.game.world");
///Lobby ///Lobby
lobbyPosition = new Vector( lobbyPosition = new Vector(
manager.getDouble("spawns.lobby.x"), config.getDouble("spawns.lobby.x"),
Math.max(0, Math.min(255, manager.getDouble("spawns.lobby.y"))), Math.max(0, Math.min(255, config.getDouble("spawns.lobby.y"))),
manager.getDouble("spawns.lobby.z") config.getDouble("spawns.lobby.z")
); );
lobbyWorld = manager.getString("spawns.lobby.world"); lobbyWorld = config.getString("spawns.lobby.world");
announceMessagesToNonPlayers = manager.getBoolean("announceMessagesToNonPlayers"); announceMessagesToNonPlayers = config.getBoolean("announceMessagesToNonPlayers");
exitPosition = new Vector( exitPosition = new Vector(
manager.getDouble("spawns.exit.x"), config.getDouble("spawns.exit.x"),
Math.max(0, Math.min(255, manager.getDouble("spawns.exit.y"))), Math.max(0, Math.min(255, config.getDouble("spawns.exit.y"))),
manager.getDouble("spawns.exit.z") config.getDouble("spawns.exit.z")
); );
exitWorld = manager.getString("spawns.exit.world"); exitWorld = config.getString("spawns.exit.world");
//World border //World border
worldborderPosition = new Vector( worldborderPosition = new Vector(
manager.getInt("worldBorder.x"), config.getInt("worldBorder.x"),
0, 0,
manager.getInt("worldBorder.z") config.getInt("worldBorder.z")
); );
worldborderSize = Math.max(100, manager.getInt("worldBorder.size")); worldborderSize = Math.max(100, config.getInt("worldBorder.size"));
worldborderDelay = Math.max(1, manager.getInt("worldBorder.delay")); worldborderDelay = Math.max(1, config.getInt("worldBorder.delay"));
worldborderEnabled = manager.getBoolean("worldBorder.enabled"); worldborderEnabled = config.getBoolean("worldBorder.enabled");
//Prefix //Prefix
char SYMBOLE = '\u00A7'; char SYMBOLE = '\u00A7';
String SYMBOLE_STRING = String.valueOf(SYMBOLE); String SYMBOLE_STRING = String.valueOf(SYMBOLE);
messagePrefix = manager.getString("prefix.default").replace("&", SYMBOLE_STRING); messagePrefix = config.getString("prefix.default").replace("&", SYMBOLE_STRING);
errorPrefix = manager.getString("prefix.error").replace("&", SYMBOLE_STRING); errorPrefix = config.getString("prefix.error").replace("&", SYMBOLE_STRING);
tauntPrefix = manager.getString("prefix.taunt").replace("&", SYMBOLE_STRING); tauntPrefix = config.getString("prefix.taunt").replace("&", SYMBOLE_STRING);
worldborderPrefix = manager.getString("prefix.border").replace("&", SYMBOLE_STRING); worldborderPrefix = config.getString("prefix.border").replace("&", SYMBOLE_STRING);
abortPrefix = manager.getString("prefix.abort").replace("&", SYMBOLE_STRING); abortPrefix = config.getString("prefix.abort").replace("&", SYMBOLE_STRING);
gameoverPrefix = manager.getString("prefix.gameover").replace("&", SYMBOLE_STRING); gameoverPrefix = config.getString("prefix.gameover").replace("&", SYMBOLE_STRING);
warningPrefix = manager.getString("prefix.warning").replace("&", SYMBOLE_STRING); warningPrefix = config.getString("prefix.warning").replace("&", SYMBOLE_STRING);
//Map Bounds //Map Bounds
saveMinX = manager.getInt("bounds.min.x"); saveMinX = config.getInt("bounds.min.x");
saveMinZ = manager.getInt("bounds.min.z"); saveMinZ = config.getInt("bounds.min.z");
saveMaxX = manager.getInt("bounds.max.x"); saveMaxX = config.getInt("bounds.max.x");
saveMaxZ = manager.getInt("bounds.max.z"); saveMaxZ = config.getInt("bounds.max.z");
//Taunt //Taunt
tauntEnabled = manager.getBoolean("taunt.enabled"); tauntEnabled = config.getBoolean("taunt.enabled");
tauntCountdown = manager.getBoolean("taunt.showCountdown"); tauntCountdown = config.getBoolean("taunt.showCountdown");
tauntDelay = Math.max(60,manager.getInt("taunt.delay")); tauntDelay = Math.max(60, config.getInt("taunt.delay"));
tauntLast = manager.getBoolean("taunt.whenLastPerson"); tauntLast = config.getBoolean("taunt.whenLastPerson");
//Glow //Glow
glowLength = Math.max(1,manager.getInt("glow.time")); glowLength = Math.max(1, config.getInt("glow.time"));
glowStackable = manager.getBoolean("glow.stackable"); glowStackable = config.getBoolean("glow.stackable");
glowEnabled = manager.getBoolean("glow.enabled") && Version.atLeast("1.9"); glowEnabled = config.getBoolean("glow.enabled") && Version.atLeast("1.9");
//Lobby //Lobby
minPlayers = Math.max(2, manager.getInt("minPlayers")); minPlayers = Math.max(2, config.getInt("minPlayers"));
countdown = Math.max(10,manager.getInt("lobby.countdown")); countdown = Math.max(10, config.getInt("lobby.countdown"));
changeCountdown = Math.max(minPlayers,manager.getInt("lobby.changeCountdown")); changeCountdown = Math.max(minPlayers, config.getInt("lobby.changeCountdown"));
lobbyMin = Math.max(minPlayers,manager.getInt("lobby.min")); lobbyMin = Math.max(minPlayers, config.getInt("lobby.min"));
lobbyMax = manager.getInt("lobby.max"); lobbyMax = config.getInt("lobby.max");
lobbyCountdownEnabled = manager.getBoolean("lobby.enabled"); lobbyCountdownEnabled = config.getBoolean("lobby.enabled");
//SeekerPing //SeekerPing
seekerPing = manager.getBoolean("seekerPing.enabled"); seekerPing = config.getBoolean("seekerPing.enabled");
seekerPingLevel1 = manager.getInt("seekerPing.distances.level1"); seekerPingLevel1 = config.getInt("seekerPing.distances.level1");
seekerPingLevel2 = manager.getInt("seekerPing.distances.level2"); seekerPingLevel2 = config.getInt("seekerPing.distances.level2");
seekerPingLevel3 = manager.getInt("seekerPing.distances.level3"); seekerPingLevel3 = config.getInt("seekerPing.distances.level3");
//Other //Other
nametagsVisible = manager.getBoolean("nametagsVisible"); nametagsVisible = config.getBoolean("nametagsVisible");
permissionsRequired = manager.getBoolean("permissionsRequired"); permissionsRequired = config.getBoolean("permissionsRequired");
gameLength = manager.getInt("gameLength"); gameLength = config.getInt("gameLength");
pvpEnabled = manager.getBoolean("pvp"); pvpEnabled = config.getBoolean("pvp");
autoJoin = manager.getBoolean("autoJoin"); autoJoin = config.getBoolean("autoJoin");
teleportToExit = manager.getBoolean("teleportToExit"); teleportToExit = config.getBoolean("teleportToExit");
locale = manager.getString("locale", "local"); locale = config.getString("locale", "local");
blockedCommands = config.getStringList("blockedCommands");
//Leaderboard
LOBBY_TITLE = leaderboard.getString("lobby.title");
GAME_TITLE = leaderboard.getString("game.title");
LOBBY_CONTENTS = leaderboard.getStringList("lobby.content");
Collections.reverse(LOBBY_CONTENTS);
GAME_CONTENTS = leaderboard.getStringList("game.content");
Collections.reverse(GAME_CONTENTS);
COUNTDOWN_WAITING = leaderboard.getString("countdown.waiting");
COUNTDOWN_COUNTING = leaderboard.getString("countdown.counting");
COUNTDOWN_ADMINSTART = leaderboard.getString("countdown.adminStart");
TAUNT_COUNTING = leaderboard.getString("taunt.counting");
TAUNT_ACTIVE = leaderboard.getString("taunt.active");
TAUNT_EXPIRED = leaderboard.getString("taunt.expired");
GLOW_ACTIVE = leaderboard.getString("glow.active");
GLOW_INACTIVE = leaderboard.getString("glow.inactive");
BORDER_COUNTING = leaderboard.getString("border.counting");
BORDER_DECREASING = leaderboard.getString("border.decreasing");
} }
public static void addToConfig(String path, Object value) { public static void addToConfig(String path, Object value) {
manager.set(path, value); config.set(path, value);
} }
public static void saveConfig() { public static void saveConfig() {
manager.saveConfig(); config.saveConfig();
} }
} }

View file

@ -26,6 +26,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.*; import java.io.*;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map; import java.util.Map;
public class ConfigManager { public class ConfigManager {
@ -121,6 +122,10 @@ public class ConfigManager {
} }
} }
public int getDefaultInt(String path){
return defaultConfig.getInt(path);
}
public String getString(String path){ public String getString(String path){
String value = config.getString(path); String value = config.getString(path);
if(value == null){ if(value == null){
@ -144,6 +149,15 @@ public class ConfigManager {
} }
} }
public List<String> getStringList(String path){
List<String> value = config.getStringList(path);
if(value == null){
return defaultConfig.getStringList(path);
} else {
return value;
}
}
public void reset(String path){ public void reset(String path){
config.set(path, defaultConfig.get(path)); config.set(path, defaultConfig.get(path));
} }

View file

@ -29,18 +29,21 @@ public class Localization {
public static final Map<String,LocalizationString> LOCAL = new HashMap<>(); public static final Map<String,LocalizationString> LOCAL = new HashMap<>();
private static final String[][] CHANGES = {{"WORLDBORDER_DECREASING"}}; private static final Map<String,String[][]> CHANGES = new HashMap<String,String[][]>() {{
put("en-US", new String[][]{{"WORLDBORDER_DECREASING"},{"START","TAUNTED"}});
put("de-DE", new String[][]{{}});
}};
public static void loadLocalization() { public static void loadLocalization() {
ConfigManager manager = new ConfigManager("localization.yml", "lang"+File.separator+"localization_"+Config.locale +".yml"); ConfigManager manager = new ConfigManager("localization.yml", "lang"+File.separator+"localization_"+Config.locale +".yml");
int PLUGIN_VERSION = 2; int PLUGIN_VERSION = manager.getDefaultInt("version");
int VERSION = manager.getInt("version"); int VERSION = manager.getInt("version");
if(VERSION < PLUGIN_VERSION){ if(VERSION < PLUGIN_VERSION){
for(int i = VERSION; i < PLUGIN_VERSION; i++){ for(int i = VERSION; i < PLUGIN_VERSION; i++){
if(i < 1) continue; if(i < 1) continue;
String[] changeList = CHANGES[i-1]; String[] changeList = CHANGES.get(Config.locale)[i-1];
for(String change : changeList) for(String change : changeList)
manager.reset("Localization." + change); manager.reset("Localization." + change);
} }

View file

@ -21,10 +21,7 @@ package net.tylermurphy.hideAndSeek.game;
import static net.tylermurphy.hideAndSeek.configuration.Config.*; import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import net.tylermurphy.hideAndSeek.util.Status; import net.tylermurphy.hideAndSeek.util.Status;
@ -151,19 +148,28 @@ public class Board {
board = new CustomBoard(player, "&l&eHIDE AND SEEK"); board = new CustomBoard(player, "&l&eHIDE AND SEEK");
board.updateTeams(); board.updateTeams();
} }
board.setLine("hiders", ChatColor.BOLD + "" + ChatColor.YELLOW + "HIDER %" + ChatColor.WHITE + getHiderPercent()); int i=0;
board.setLine("seekers", ChatColor.BOLD + "" + ChatColor.RED + "SEEKER %" + ChatColor.WHITE + getSeekerPercent()); for(String line : LOBBY_CONTENTS){
board.addBlank(); if(line.equalsIgnoreCase("")){
board.setLine("players", "Players: " + playerList.values().size()); board.addBlank();
board.addBlank(); } else if(line.contains("{COUNTDOWN}")){
if(lobbyCountdownEnabled){ if(!lobbyCountdownEnabled){
if(Game.countdownTime == -1){ board.setLine(String.valueOf(i), line.replace("{COUNTDOWN}", COUNTDOWN_ADMINSTART));
board.setLine("waiting", "Waiting for players..."); } else if(Game.countdownTime == -1){
board.setLine(String.valueOf(i), line.replace("{COUNTDOWN}", COUNTDOWN_WAITING));
} else {
board.setLine(String.valueOf(i), line.replace("{COUNTDOWN}", COUNTDOWN_COUNTING.replace("{AMOUNT}",Game.countdownTime+"")));
}
} else if(line.contains("{COUNT}")){
board.setLine(String.valueOf(i), line.replace("{COUNT}", getPlayers().size()+""));
} else if(line.contains("{SEEKER%}")){
board.setLine(String.valueOf(i), line.replace("{SEEKER%}", getSeekerPercent()+""));
} else if(line.contains("{HIDER%}")){
board.setLine(String.valueOf(i), line.replace("{HIDER%}", getHiderPercent()+""));
} else { } else {
board.setLine("waiting", "Starting in: "+ChatColor.GREEN + Game.countdownTime+"s"); board.setLine(String.valueOf(i), line);
} }
} else { i++;
board.setLine("waiting", "Waiting for gamemaster...");
} }
board.display(); board.display();
customBoards.put(player.getName(), board); customBoards.put(player.getName(), board);
@ -176,42 +182,58 @@ public class Board {
private static void createGameBoard(Player player, boolean recreate){ private static void createGameBoard(Player player, boolean recreate){
CustomBoard board = customBoards.get(player.getName()); CustomBoard board = customBoards.get(player.getName());
if(recreate) { if(recreate) {
board = new CustomBoard(player, "&l&eHIDE AND SEEK"); board = new CustomBoard(player, GAME_TITLE);
board.updateTeams(); board.updateTeams();
} }
board.setLine("hiders", ChatColor.BOLD + "" + ChatColor.YELLOW + "HIDERS:" + ChatColor.WHITE + " " + Hider.size());
board.setLine("seekers", ChatColor.BOLD + "" + ChatColor.RED + "SEEKERS:" + ChatColor.WHITE + " " + Seeker.size()); int i = 0;
board.addBlank(); for(String line : GAME_CONTENTS){
if(glowEnabled){ if(line.equalsIgnoreCase("")){
if(Game.glow == null || Game.status == Status.STARTING || !Game.glow.isRunning()) board.addBlank();
board.setLine("glow", "Glow: " + ChatColor.RED + "Inactive");
else
board.setLine("glow", "Glow: " + ChatColor.GREEN + "Active");
}
if(tauntEnabled && tauntCountdown){
if(Game.taunt == null || Game.status == Status.STARTING)
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + "0m0s");
else if(!tauntLast && Hider.size() == 1){
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + "Expired");
} else if(!Game.taunt.isRunning())
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + Game.taunt.getDelay()/60 + "m" + Game.taunt.getDelay()%60 + "s");
else
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + "Active");
}
if(worldborderEnabled){
if(Game.worldBorder == null || Game.status == Status.STARTING){
board.setLine("board", "WorldBorder: " + ChatColor.YELLOW + "0m0s");
} else if(!Game.worldBorder.isRunning()) {
board.setLine("board", "WorldBorder: " + ChatColor.YELLOW + Game.worldBorder.getDelay()/60 + "m" + Game.worldBorder.getDelay()%60 + "s");
} else { } else {
board.setLine("board", "WorldBorder: " + ChatColor.YELLOW + "Decreasing"); if(line.contains("{TIME}")) {
String value = Game.timeLeft/60 + "m" + Game.timeLeft%60 + "s";
board.setLine(String.valueOf(i), line.replace("{TIME}", value));
} else if(line.contains("{TEAM}")) {
String value = getTeam(player);
board.setLine(String.valueOf(i), line.replace("{TEAM}", value));
} else if(line.contains("{BORDER}")) {
if(!worldborderEnabled) continue;
if(Game.worldBorder == null || Game.status == Status.STARTING){
board.setLine(String.valueOf(i), line.replace("{BORDER}", BORDER_COUNTING.replace("{AMOUNT}", "0")));
} else if(!Game.worldBorder.isRunning()) {
board.setLine(String.valueOf(i), line.replace("{BORDER}", BORDER_COUNTING.replaceFirst("\\{AMOUNT}", Game.worldBorder.getDelay()/60+"").replaceFirst("\\{AMOUNT}", Game.worldBorder.getDelay()%60+"")));
} else {
board.setLine(String.valueOf(i), line.replace("{BORDER}", BORDER_DECREASING));
}
} else if(line.contains("{TAUNT}")){
if(!tauntEnabled) continue;
if(Game.taunt == null || Game.status == Status.STARTING) {
board.setLine(String.valueOf(i), line.replace("{TAUNT}", TAUNT_COUNTING.replace("{AMOUNT}", "0")));
} else if(!tauntLast && Hider.size() == 1){
board.setLine(String.valueOf(i), line.replace("{TAUNT}", TAUNT_EXPIRED));
} else if(!Game.taunt.isRunning()) {
board.setLine(String.valueOf(i), line.replace("{TAUNT}", TAUNT_COUNTING.replaceFirst("\\{AMOUNT}", Game.taunt.getDelay() / 60 + "").replaceFirst("\\{AMOUNT}", Game.taunt.getDelay() % 60 + "")));
} else {
board.setLine(String.valueOf(i), line.replace("{TAUNT}", TAUNT_ACTIVE));
}
} else if(line.contains("{GLOW}")){
if(!glowEnabled) return;
if(Game.glow == null || Game.status == Status.STARTING || !Game.glow.isRunning()) {
board.setLine(String.valueOf(i), line.replace("{GLOW}", GLOW_INACTIVE));
} else {
board.setLine(String.valueOf(i), line.replace("{GLOW}", GLOW_ACTIVE));
}
} else if(line.contains("{#SEEKER}")) {
board.setLine(String.valueOf(i), line.replace("{#SEEKER}", getSeekers().size()+""));
} else if(line.contains("{#HIDER}")) {
board.setLine(String.valueOf(i), line.replace("{#HIDER}", getHiders().size()+""));
} else {
board.setLine(String.valueOf(i), line);
}
} }
i++;
} }
if(glowEnabled || (tauntEnabled && tauntCountdown) || worldborderEnabled)
board.addBlank();
board.setLine("time", "Time Left: " + ChatColor.GREEN + Game.timeLeft/60 + "m" + Game.timeLeft%60 + "s");
board.addBlank();
board.setLine("team", "Team: " + getTeam(player));
board.display(); board.display();
customBoards.put(player.getName(), board); customBoards.put(player.getName(), board);
} }
@ -332,9 +354,9 @@ class CustomBoard {
public void setLine(String key, String message){ public void setLine(String key, String message){
Line line = LINES.get(key); Line line = LINES.get(key);
if(line == null) if(line == null)
addLine(key, message); addLine(key, ChatColor.translateAlternateColorCodes('&',message));
else else
updateLine(key, message); updateLine(key, ChatColor.translateAlternateColorCodes('&',message));
} }
private void addLine(String key, String message){ private void addLine(String key, String message){

View file

@ -271,5 +271,13 @@ public class EventListener implements Listener {
} }
} }
} }
for(String handle : blockedCommands){
System.out.println(handle);
if(array[0].substring(1).equalsIgnoreCase(handle) && Board.isPlayer(player) && Game.status != Status.STANDBY){
player.sendMessage(errorPrefix + message("BLOCKED_COMMAND"));
event.setCancelled(true);
break;
}
}
} }
} }

View file

@ -96,6 +96,7 @@ public class Game {
for(Player player : Board.getSeekers()) { for(Player player : Board.getSeekers()) {
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,1000000,127,false,false)); player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,1000000,127,false,false));
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,1000000,127,false,false)); player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,1000000,127,false,false));
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,1000000,128,false,false));
Titles.sendTitle(player, 10, 70, 20, ChatColor.RED + "" + ChatColor.BOLD + "SEEKER", ChatColor.WHITE + message("SEEKERS_SUBTITLE").toString()); Titles.sendTitle(player, 10, 70, 20, ChatColor.RED + "" + ChatColor.BOLD + "SEEKER", ChatColor.WHITE + message("SEEKERS_SUBTITLE").toString());
} }
for(Player player : Board.getHiders()) { for(Player player : Board.getHiders()) {
@ -273,8 +274,10 @@ public class Game {
countdownTime = countdown; countdownTime = countdown;
if(Board.size() >= changeCountdown) if(Board.size() >= changeCountdown)
countdownTime = Math.min(countdownTime, 10); countdownTime = Math.min(countdownTime, 10);
if(tick % 20 == 0) if(tick % 20 == 0) {
countdownTime--; countdownTime--;
Board.reloadLobbyBoards();
}
if(countdownTime == 0){ if(countdownTime == 0){
Optional<Player> rand = Board.getPlayers().stream().skip(new Random().nextInt(Board.size())).findFirst(); Optional<Player> rand = Board.getPlayers().stream().skip(new Random().nextInt(Board.size())).findFirst();
if(!rand.isPresent()){ if(!rand.isPresent()){
@ -308,22 +311,6 @@ public class Game {
distance = temp; distance = temp;
} }
} }
// if(seekerPing) switch(tick%10) {
// case 0:
// if(distance < seekerPingLevel1) Packet.playSound(hider, XSound.BLOCK_NOTE_BLOCK_BASEDRUM.parseSound(), .5f, 1f);
// if(distance < seekerPingLevel3) Packet.playSound(hider, XSound.BLOCK_NOTE_BLOCK_PLING.parseSound(), .3f, 1f);
// break;
// case 3:
// if(distance < seekerPingLevel1) Packet.playSound(hider, XSound.BLOCK_NOTE_BLOCK_BASEDRUM.parseSound(), .3f, 1f);
// if(distance < seekerPingLevel3) Packet.playSound(hider, XSound.BLOCK_NOTE_BLOCK_PLING.parseSound(), .3f, 1f);
// break;
// case 6:
// if(distance < seekerPingLevel3) Packet.playSound(hider, XSound.BLOCK_NOTE_BLOCK_PLING.parseSound(), .3f, 1f);
// break;
// case 9:
// if(distance < seekerPingLevel2) Packet.playSound(hider, XSound.BLOCK_NOTE_BLOCK_PLING.parseSound(), .3f, 1f);
// break;
// }
if(seekerPing) switch(tick%10) { if(seekerPing) switch(tick%10) {
case 0: case 0:
if(distance < seekerPingLevel1) XSound.BLOCK_NOTE_BLOCK_BASEDRUM.play(hider, .5f, 1f); if(distance < seekerPingLevel1) XSound.BLOCK_NOTE_BLOCK_BASEDRUM.play(hider, .5f, 1f);
@ -390,21 +377,18 @@ class Glow {
public void onProjectile() { public void onProjectile() {
if(glowStackable) glowTime += glowLength; if(glowStackable) glowTime += glowLength;
else glowTime = glowLength; else glowTime = glowLength;
if(!running) running = true;
startGlow();
} }
private void startGlow() { private void sendPackets(){
running = true; for(Player hider : Board.getHiders())
for(Player hider : Board.getHiders()) { for(Player seeker : Board.getSeekers())
for(Player seeker : Board.getSeekers()) {
Packet.setGlow(hider, seeker, true); Packet.setGlow(hider, seeker, true);
}
}
} }
protected void update() { protected void update() {
if(running) { if(running) {
sendPackets();
glowTime--; glowTime--;
glowTime = Math.max(glowTime, 0); glowTime = Math.max(glowTime, 0);
if (glowTime == 0) { if (glowTime == 0) {

View file

@ -1,3 +1,11 @@
#============================================================#
# +--------------------------------------------------------+ #
# | Kenshins Hide and Seek | #
# | Configuration file | #
# | by KenshinEto | #
# +--------------------------------------------------------+ #
#============================================================#
# How long in seconds will the game last, set it < 1 to disable # How long in seconds will the game last, set it < 1 to disable
# default: 1200 aka 20min # default: 1200 aka 20min
gameLength: 1200 gameLength: 1200
@ -30,7 +38,7 @@ pvp: true
autoJoin: false autoJoin: false
# (When autoJoin is false), when players join the world containing the lobby, they are automatically teleported # (When autoJoin is false), when players join the world containing the lobby, they are automatically teleported
# to the designated exit position so that they possibly don't spawn in the lobby while not in the queue. Anyone # to the designated exit position so that they don't spawn in the lobby while not in the queue. Anyone
# who ever joins in the game world (the duplicated world where the game is played) will always be teleported # who ever joins in the game world (the duplicated world where the game is played) will always be teleported
# out regardless. # out regardless.
# default: false # default: false
@ -105,13 +113,27 @@ seekerPing:
# de-DE (German - Germany) # de-DE (German - Germany)
locale: "en-US" locale: "en-US"
# Block's commands being run by any user while playing the game.
# Can be usefully If you aren't using a permission plugin and want
# to op people, but still want to block certain commands.
# Not really usefully if using permission plugins.
# You can add /kill for any use, but it's already blocked on those
# playing the game.
blockedCommands:
- msg
- tp
- gamemode
- kill
- give
- effect
# ---------------------------------------------------------- # # ---------------------------------------------------------- #
# ONLY EDIT BEYOND THIS POINT IF YOU KNOW WHAT YOU ARE DOING # # ONLY EDIT BEYOND THIS POINT IF YOU KNOW WHAT YOU ARE DOING #
# ---------------------------------------------------------- # # ---------------------------------------------------------- #
# The 2 coordinate bounds that will contain your hideAndSeek map. Its recommended # The 2 coordinate bounds that will contain your hideAndSeek map. Its recommended
# that you use /hs setbounds for this, and not edit this directly, as breaking # that you use /hs setbounds for this, and not edit this directly, as breaking
# this section will completely break the entire plugin when you run /hs mapsave. # this section will completely break the entire plugin when you run /hs savemap.
bounds: bounds:
min: min:
x: 0 x: 0

View file

@ -64,6 +64,7 @@ Localization:
NOT_AT_ZERO: "Bitte nicht an einer Position setzen, die eine Koordinate bei 0 enthält." NOT_AT_ZERO: "Bitte nicht an einer Position setzen, die eine Koordinate bei 0 enthält."
NO_GAME_INFO: "Keine Informationen zum Gameplay für diesen Spieler vorhanden." NO_GAME_INFO: "Keine Informationen zum Gameplay für diesen Spieler vorhanden."
INFORMATION_FOR: "Gewinninformationen für {PLAYER}:" INFORMATION_FOR: "Gewinninformationen für {PLAYER}:"
BLOCKED_COMMAND: "Command blocked by Kenshin's Hide And Seek"
# DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE # DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE
version: 2 version: 2

View file

@ -37,7 +37,7 @@ Localization:
WORLDBORDER_ENABLE: "Set border center to current location, size to {AMOUNT}, and delay to {AMOUNT}." WORLDBORDER_ENABLE: "Set border center to current location, size to {AMOUNT}, and delay to {AMOUNT}."
WORLDBORDER_DECREASING: "World border decreasing by 100 blocks over the next 30s." WORLDBORDER_DECREASING: "World border decreasing by 100 blocks over the next 30s."
WORLDBORDER_WARN: "World border will shrink in the next 30s!" WORLDBORDER_WARN: "World border will shrink in the next 30s!"
TAUNTED: "$c$oOh no! You have been chosen to be taunted." TAUNTED: "&c&oOh no! You have been chosen to be taunted."
TAUNT: "A random hider will be taunted in the next 30s." TAUNT: "A random hider will be taunted in the next 30s."
TAUNT_ACTIVATE: "Taunt has been activated." TAUNT_ACTIVATE: "Taunt has been activated."
ERROR_GAME_SPAWN: "Please set game spawn location first" ERROR_GAME_SPAWN: "Please set game spawn location first"
@ -54,7 +54,7 @@ Localization:
START_MIN_PLAYERS: "You must have at least {AMOUNT} players to start." START_MIN_PLAYERS: "You must have at least {AMOUNT} players to start."
START_INVALID_NAME: "Invalid player: {PLAYER}." START_INVALID_NAME: "Invalid player: {PLAYER}."
START_COUNTDOWN: "Hiders have {AMOUNT} seconds to hide!" START_COUNTDOWN: "Hiders have {AMOUNT} seconds to hide!"
START: "Attention SEEKERS, its time to fin the hiders!" START: "Attention SEEKERS, its time to find the hiders!"
STOP: "Game has been force stopped." STOP: "Game has been force stopped."
HIDERS_SUBTITLE: "Hide away from the seekers" HIDERS_SUBTITLE: "Hide away from the seekers"
SEEKERS_SUBTITLE: "Eliminate all hiders" SEEKERS_SUBTITLE: "Eliminate all hiders"
@ -64,7 +64,8 @@ Localization:
NOT_AT_ZERO: "Please do not set at a location containing a coordinate at 0." NOT_AT_ZERO: "Please do not set at a location containing a coordinate at 0."
NO_GAME_INFO: "Player has no gameplay information." NO_GAME_INFO: "Player has no gameplay information."
INFORMATION_FOR: "Win information for {PLAYER}:" INFORMATION_FOR: "Win information for {PLAYER}:"
BLOCKED_COMMAND: "Command blocked by Hide And Seek plugin."
# DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE # DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE
version: 2 version: 3
type: "en-US" type: "en-US"

View file

@ -0,0 +1,87 @@
#============================================================#
# +--------------------------------------------------------+ #
# | Kenshins Hide and Seek | #
# | Leaderboard file | #
# | by KenshinEto | #
# +--------------------------------------------------------+ #
#============================================================#
# This config file allows you to change what is displayed on the scoreboard\leaderboard
# while in the lobby, or in the game. Below are a list of predefined placeholders.
#
# LOBBY BOARD PLACEHOLDERS
#
# {COUNTDOWN} - Displays the time left in the lobby countdown. If there are not enough
# people in the lobby, or the lobby countdown its disabled, it just
# displays waiting for players. The text displayed can be changed below.
# {COUNT} - The amount of player currently in the lobby.
# {SEEKER%} - The chance that a player will be selected to be a seeker.
# {HIDER%} - The chance that a player will be selected to be a hider.
#
# GAME BOARD PLACEHOLDERS
#
# {TIME} - The amount of time left in the game in MmSs.
# {TEAM} - The team you are on. Hider, Seeker, or Spectator.
# {BORDER} - The current status of the world boarder, if enabled.
# If the world border is disabled, this line is removed
# automatically. Displays the time left until the border
# moves in MmSs, or "Decreasing" if it's decreasing.
# What is displayed exactly can be changed below.
# {TAUNT} - The current status of the taunt system, if enabled.
# If taunts are disabled, any line with {TAUNT} will be
# automatically removed. Shows the time left till next
# taunt in MmSs, if the taunt is active, and if the taunt
# has expired (one player left). What is displayed exactly
# can be changed below.
# {GLOW} - The current status of the glow powerup, if enabled.
# This line is automatically removed if the glow poewrup
# is disabled. Tells all players if a Glow powerup is active,
# only Hiders will be able to see its effects though.
# {#SEEKER} - Number of current seekers.
# {#HIDER} - Number of current hiders.
#
# YOU CANNOT USE TWO PLACEHOLDERS ON THE SAME LINE. ONLY THE FIRST ONE WILL
# BE CHANGED, AND THE SECOND ONE WILL SAY A PLACEHOLDER MARKER!
lobby:
title: "&eHIDE AND SEEK"
content: [
"{COUNTDOWN}",
"",
"Players: {COUNT}",
"",
"&cSEEKER % &f{SEEKER%}",
"&6HIDER % &f{HIDER%}"
]
game:
title: "&eHIDE AND SEEK"
content: [
"Team: {TEAM}",
"",
"Time Left: &a{TIME}",
"",
"Taunt: &e{TAUNT}",
"Glow: {GLOW}",
"WorldBorder: &b{BORDER}",
"",
"&cSEEKERS: &f{#SEEKER}",
"&6HIDERS: &f{#HIDER}"
]
countdown:
waiting: "Waiting for players..."
adminStart: "Waiting for gamemaster..."
counting: "Starting in: $a{AMOUNT}s"
taunt:
counting: "{AMOUNT}m{AMOUNT}s"
active: "Active"
expired: "Expired"
glow:
active: "&aActive"
inactive: "&cInactive"
border:
counting: "{AMOUNT}m{AMOUNT}s"
decreasing: "Decreasing"