1.7.0 beta 2
This commit is contained in:
parent
7530fe5e2d
commit
bb254145ed
37 changed files with 440 additions and 301 deletions
|
@ -20,15 +20,11 @@
|
|||
package net.tylermurphy.hideAndSeek;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.command.*;
|
||||
import net.tylermurphy.hideAndSeek.command.location.*;
|
||||
import net.tylermurphy.hideAndSeek.command.map.*;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Config;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Items;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Localization;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Maps;
|
||||
import net.tylermurphy.hideAndSeek.command.map.set.*;
|
||||
import net.tylermurphy.hideAndSeek.configuration.*;
|
||||
import net.tylermurphy.hideAndSeek.database.Database;
|
||||
import net.tylermurphy.hideAndSeek.game.*;
|
||||
import net.tylermurphy.hideAndSeek.game.util.Status;
|
||||
import net.tylermurphy.hideAndSeek.command.util.CommandGroup;
|
||||
import net.tylermurphy.hideAndSeek.game.listener.*;
|
||||
import net.tylermurphy.hideAndSeek.util.PAPIExpansion;
|
||||
|
@ -41,7 +37,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -65,10 +60,17 @@ public class Main extends JavaPlugin implements Listener {
|
|||
Main.instance = this;
|
||||
this.updateVersion();
|
||||
|
||||
Config.loadConfig();
|
||||
Maps.loadMaps();
|
||||
Localization.loadLocalization();
|
||||
Items.loadItems();
|
||||
try {
|
||||
Config.loadConfig();
|
||||
Maps.loadMaps();
|
||||
Localization.loadLocalization();
|
||||
Items.loadItems();
|
||||
Leaderboard.loadLeaderboard();
|
||||
} catch (Exception e) {
|
||||
getLogger().severe(e.getMessage());
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
this.board = new Board();
|
||||
this.database = new Database();
|
||||
|
@ -77,28 +79,27 @@ public class Main extends JavaPlugin implements Listener {
|
|||
this.registerListeners();
|
||||
|
||||
this.commandGroup = new CommandGroup("hs",
|
||||
new About(),
|
||||
new Debug(),
|
||||
new Help(),
|
||||
new Reload(),
|
||||
new Join(),
|
||||
new Leave(),
|
||||
new Send(),
|
||||
new Start(),
|
||||
new Stop(),
|
||||
new CommandGroup("map",
|
||||
new CommandGroup("set",
|
||||
new SetLobbyLocation(),
|
||||
new SetSpawnLocation(),
|
||||
new SetSeekerLobbyLocation(),
|
||||
new SetBorder(),
|
||||
new SetBounds()
|
||||
new Lobby(),
|
||||
new Spawn(),
|
||||
new SeekerLobby(),
|
||||
new Border(),
|
||||
new Bounds()
|
||||
),
|
||||
new AddMap(),
|
||||
new RemoveMap(),
|
||||
new ListMaps(),
|
||||
new SetMap(),
|
||||
new Setup(),
|
||||
new SaveMap()
|
||||
new Add(),
|
||||
new Remove(),
|
||||
new List(),
|
||||
new Status(),
|
||||
new Save(),
|
||||
new Debug()
|
||||
),
|
||||
new SetExitLocation(),
|
||||
new Top(),
|
||||
|
@ -120,20 +121,25 @@ public class Main extends JavaPlugin implements Listener {
|
|||
|
||||
version = 0;
|
||||
|
||||
board.getPlayers().forEach(player -> {
|
||||
board.removeBoard(player);
|
||||
PlayerLoader.unloadPlayer(player);
|
||||
if(!Objects.equals(exitWorld, ""))
|
||||
player.teleport(exitPosition);
|
||||
});
|
||||
if(board != null) {
|
||||
board.getPlayers().forEach(player -> {
|
||||
board.removeBoard(player);
|
||||
PlayerLoader.unloadPlayer(player);
|
||||
if (!Objects.equals(exitWorld, ""))
|
||||
player.teleport(exitPosition);
|
||||
});
|
||||
board.cleanup();
|
||||
}
|
||||
|
||||
if(disguiser != null) {
|
||||
disguiser.cleanUp();
|
||||
}
|
||||
|
||||
Bukkit.getServer().getMessenger().unregisterOutgoingPluginChannel(this);
|
||||
board.cleanup();
|
||||
disguiser.cleanUp();
|
||||
}
|
||||
|
||||
private void onTick() {
|
||||
if(game.getStatus() == Status.ENDED) game = new Game(game.getCurrentMap(), board);
|
||||
if(game.getStatus() == net.tylermurphy.hideAndSeek.game.util.Status.ENDED) game = new Game(game.getCurrentMap(), board);
|
||||
game.onTick();
|
||||
disguiser.check();
|
||||
}
|
||||
|
@ -168,7 +174,7 @@ public class Main extends JavaPlugin implements Listener {
|
|||
return commandGroup.handleCommand((Player)sender, "", args);
|
||||
}
|
||||
|
||||
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
public java.util.List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
return commandGroup.handleTabComplete(sender, args);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* This file is part of Kenshins Hide and Seek
|
||||
*
|
||||
* Copyright (c) 2021 Tyler Murphy.
|
||||
*
|
||||
* Kenshins Hide and Seek free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* he Free Software Foundation version 3.
|
||||
*
|
||||
* Kenshins Hide and Seek is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package net.tylermurphy.hideAndSeek.command;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.command.util.Command;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class About extends Command {
|
||||
|
||||
public void execute(Player sender, String[] args) {
|
||||
sender.sendMessage(
|
||||
String.format("%s%sHide and Seek %s(%s1.7.0 ALPHA%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) +
|
||||
String.format("%sAuthor: %s[KenshinEto]\n", ChatColor.GRAY, ChatColor.WHITE) +
|
||||
String.format("%sHelp Command: %s/hs %shelp", ChatColor.GRAY, ChatColor.AQUA, ChatColor.WHITE)
|
||||
);
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return "about";
|
||||
}
|
||||
|
||||
public String getUsage() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return "Get information about the plugin";
|
||||
}
|
||||
|
||||
public List<String> autoComplete(String parameter) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -21,10 +21,7 @@ package net.tylermurphy.hideAndSeek.command;
|
|||
|
||||
import net.tylermurphy.hideAndSeek.Main;
|
||||
import net.tylermurphy.hideAndSeek.command.util.Command;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Config;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Items;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Localization;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Maps;
|
||||
import net.tylermurphy.hideAndSeek.configuration.*;
|
||||
import net.tylermurphy.hideAndSeek.game.util.Status;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -42,10 +39,18 @@ public class Reload extends Command {
|
|||
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
||||
return;
|
||||
}
|
||||
Config.loadConfig();
|
||||
Maps.loadMaps();
|
||||
Localization.loadLocalization();
|
||||
Items.loadItems();
|
||||
|
||||
try {
|
||||
Config.loadConfig();
|
||||
Maps.loadMaps();
|
||||
Localization.loadLocalization();
|
||||
Items.loadItems();
|
||||
Leaderboard.loadLeaderboard();
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(errorPrefix + message("CONFIG_ERROR"));
|
||||
return;
|
||||
}
|
||||
|
||||
sender.sendMessage(messagePrefix + message("CONFIG_RELOAD"));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package net.tylermurphy.hideAndSeek.command.map;
|
||||
package net.tylermurphy.hideAndSeek.command;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.Main;
|
||||
import net.tylermurphy.hideAndSeek.command.util.Command;
|
||||
|
@ -13,7 +13,7 @@ import java.util.stream.Collectors;
|
|||
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
|
||||
|
||||
public class SetMap extends Command {
|
||||
public class Send extends Command {
|
||||
|
||||
public void execute(Player sender, String[] args) {
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class SetMap extends Command {
|
|||
}
|
||||
|
||||
public String getLabel() {
|
||||
return "goto";
|
||||
return "send";
|
||||
}
|
||||
|
||||
public String getUsage() {
|
|
@ -17,11 +17,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package net.tylermurphy.hideAndSeek.command.location;
|
||||
package net.tylermurphy.hideAndSeek.command;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.command.util.Command;
|
||||
import net.tylermurphy.hideAndSeek.command.location.util.LocationUtils;
|
||||
import net.tylermurphy.hideAndSeek.command.location.util.Locations;
|
||||
import net.tylermurphy.hideAndSeek.command.location.LocationUtils;
|
||||
import net.tylermurphy.hideAndSeek.command.location.Locations;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
|
@ -57,7 +57,7 @@ public class Start extends Command {
|
|||
if (args.length < 1) {
|
||||
Optional<Player> rand = Main.getInstance().getBoard().getPlayers().stream().skip(new Random().nextInt(Main.getInstance().getBoard().size())).findFirst();
|
||||
if (!rand.isPresent()) {
|
||||
Main.getInstance().getLogger().warning("Failed to select random seeker.");
|
||||
sender.sendMessage(errorPrefix + message("START_FAILED_SEEKER"));
|
||||
return;
|
||||
}
|
||||
seekerName = rand.get().getName();
|
||||
|
@ -82,7 +82,7 @@ public class Start extends Command {
|
|||
}
|
||||
|
||||
public String getUsage() {
|
||||
return "<player>";
|
||||
return "<*player>";
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
|
|
|
@ -34,7 +34,7 @@ public class Stop extends Command {
|
|||
|
||||
public void execute(Player sender, String[] args) {
|
||||
if (Main.getInstance().getGame().checkCurrentMap()) {
|
||||
sender.sendMessage(errorPrefix + "Game is not setup. Run /hs setup to see what you needed to do");
|
||||
sender.sendMessage(errorPrefix + message("GAME_SETUP"));
|
||||
return;
|
||||
}
|
||||
if (Main.getInstance().getGame().getStatus() == Status.STARTING || Main.getInstance().getGame().getStatus() == Status.PLAYING) {
|
||||
|
|
|
@ -76,7 +76,7 @@ public class Top extends Command {
|
|||
}
|
||||
|
||||
public String getUsage() {
|
||||
return "<page>";
|
||||
return "<*page>";
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package net.tylermurphy.hideAndSeek.command.location.util;
|
||||
package net.tylermurphy.hideAndSeek.command.location;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.Main;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Map;
|
|
@ -1,4 +1,4 @@
|
|||
package net.tylermurphy.hideAndSeek.command.location.util;
|
||||
package net.tylermurphy.hideAndSeek.command.location;
|
||||
|
||||
/**
|
||||
* @author bobby29831
|
|
@ -14,7 +14,7 @@ import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
|
|||
import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
|
||||
|
||||
public class AddMap extends Command {
|
||||
public class Add extends Command {
|
||||
|
||||
public void execute(Player sender, String[] args) {
|
||||
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
|
|
@ -1,4 +1,4 @@
|
|||
package net.tylermurphy.hideAndSeek.command;
|
||||
package net.tylermurphy.hideAndSeek.command.map;
|
||||
|
||||
import com.cryptomorin.xseries.XMaterial;
|
||||
import net.tylermurphy.hideAndSeek.Main;
|
|
@ -0,0 +1,63 @@
|
|||
package net.tylermurphy.hideAndSeek.command.map;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.command.util.Command;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Map;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Maps;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Config.exitPosition;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
|
||||
|
||||
public class GoTo extends Command {
|
||||
|
||||
public void execute(Player sender, String[] args) {
|
||||
Map map = Maps.getMap(args[0]);
|
||||
if(map == null) {
|
||||
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
|
||||
return;
|
||||
}
|
||||
if (map.isNotSetup()) {
|
||||
sender.sendMessage(errorPrefix + message("MAP_NOT_SETUP").addAmount(map.getName()));
|
||||
return;
|
||||
}
|
||||
switch (args[1].toLowerCase()) {
|
||||
case "spawn":
|
||||
sender.teleport(map.getSpawn()); break;
|
||||
case "lobby":
|
||||
sender.teleport(map.getLobby()); break;
|
||||
case "seekerlobby":
|
||||
sender.teleport(map.getSeekerLobby()); break;
|
||||
case "exit":
|
||||
sender.teleport(exitPosition); break;
|
||||
default:
|
||||
sender.sendMessage(errorPrefix + message("COMMAND_INVALID_ARG").addAmount(args[1].toLowerCase()));
|
||||
}
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return "goto";
|
||||
}
|
||||
|
||||
public String getUsage() {
|
||||
return "<map> <spawn>";
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return "Get the commands for the plugin";
|
||||
}
|
||||
|
||||
public List<String> autoComplete(String parameter) {
|
||||
if(parameter != null && parameter.equals("map")) {
|
||||
return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
|
||||
} else if(parameter != null && parameter.equals("spawn")) {
|
||||
return Arrays.asList("spawn","lobby","seekerlobby","exit");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -7,13 +7,12 @@ import org.bukkit.ChatColor;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
|
||||
|
||||
public class ListMaps extends Command {
|
||||
public class List extends Command {
|
||||
|
||||
public void execute(Player sender, String[] args) {
|
||||
Collection<Map> maps = Maps.getAllMaps();
|
||||
|
@ -40,7 +39,7 @@ public class ListMaps extends Command {
|
|||
return "List all maps in the plugin";
|
||||
}
|
||||
|
||||
public List<String> autoComplete(String parameter) {
|
||||
public java.util.List<String> autoComplete(String parameter) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
|
|||
import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
|
||||
|
||||
public class RemoveMap extends Command {
|
||||
public class Remove extends Command {
|
||||
|
||||
public void execute(Player sender, String[] args) {
|
||||
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
|
|
@ -34,7 +34,7 @@ import java.util.stream.Collectors;
|
|||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
|
||||
|
||||
public class SaveMap extends Command {
|
||||
public class Save extends Command {
|
||||
|
||||
public static boolean runningBackup = false;
|
||||
|
||||
|
@ -60,7 +60,8 @@ public class SaveMap extends Command {
|
|||
sender.sendMessage(warningPrefix + message("MAPSAVE_WARNING"));
|
||||
World world = map.getSpawn().getWorld();
|
||||
if (world == null) {
|
||||
throw new RuntimeException("Unable to get spawn world");
|
||||
sender.sendMessage(warningPrefix + message("MAPSAVE_FAIL_WORLD"));
|
||||
return;
|
||||
}
|
||||
world.save();
|
||||
BukkitRunnable runnable = new BukkitRunnable() {
|
|
@ -19,20 +19,18 @@
|
|||
|
||||
package net.tylermurphy.hideAndSeek.command.map;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.Main;
|
||||
import net.tylermurphy.hideAndSeek.command.util.Command;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Map;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Maps;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
|
||||
|
||||
public class Setup extends Command {
|
||||
public class Status extends Command {
|
||||
|
||||
public void execute(Player sender, String[] args) {
|
||||
|
||||
|
@ -76,7 +74,7 @@ public class Setup extends Command {
|
|||
}
|
||||
|
||||
public String getLabel() {
|
||||
return "setup";
|
||||
return "status";
|
||||
}
|
||||
|
||||
public String getUsage() {
|
|
@ -0,0 +1,43 @@
|
|||
package net.tylermurphy.hideAndSeek.command.map.blockhunt;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.command.location.LocationUtils;
|
||||
import net.tylermurphy.hideAndSeek.command.location.Locations;
|
||||
import net.tylermurphy.hideAndSeek.command.util.Command;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Maps;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Enabled extends Command {
|
||||
|
||||
public void execute(Player sender, String[] args) {
|
||||
LocationUtils.setLocation(sender, Locations.LOBBY, args[0], map -> {
|
||||
map.setLobby(sender.getLocation());
|
||||
});
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return "enabled";
|
||||
}
|
||||
|
||||
public String getUsage() {
|
||||
return "<map> <bool>";
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return "Sets hide and seeks lobby location to current position";
|
||||
}
|
||||
|
||||
public List<String> autoComplete(String parameter) {
|
||||
if(parameter != null && parameter.equals("map")) {
|
||||
return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
|
||||
}
|
||||
if(parameter != null && parameter.equals("bool")) {
|
||||
return Arrays.asList("true", "false");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package net.tylermurphy.hideAndSeek.command.map;
|
||||
package net.tylermurphy.hideAndSeek.command.map.set;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.Main;
|
||||
import net.tylermurphy.hideAndSeek.command.util.Command;
|
||||
|
@ -33,7 +33,7 @@ import java.util.stream.Collectors;
|
|||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
|
||||
|
||||
public class SetBorder extends Command {
|
||||
public class Border extends Command {
|
||||
|
||||
public void execute(Player sender, String[] args) {
|
||||
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
|
||||
|
@ -86,7 +86,7 @@ public class SetBorder extends Command {
|
|||
change
|
||||
);
|
||||
Maps.setMap(map.getName(), map);
|
||||
sender.sendMessage(messagePrefix + message("WORLDBORDER_ENABLE").addAmount(num).addAmount(delay));
|
||||
sender.sendMessage(messagePrefix + message("WORLDBORDER_ENABLE").addAmount(num).addAmount(delay).addAmount(change));
|
||||
map.getWorldBorder().resetWorldBorder();
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package net.tylermurphy.hideAndSeek.command.map;
|
||||
package net.tylermurphy.hideAndSeek.command.map.set;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.Main;
|
||||
import net.tylermurphy.hideAndSeek.command.util.Command;
|
||||
|
@ -32,7 +32,7 @@ import java.util.stream.Collectors;
|
|||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
|
||||
|
||||
public class SetBounds extends Command {
|
||||
public class Bounds extends Command {
|
||||
|
||||
public void execute(Player sender, String[] args) {
|
||||
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
|
|
@ -17,18 +17,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package net.tylermurphy.hideAndSeek.command.location;
|
||||
package net.tylermurphy.hideAndSeek.command.map.set;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.command.util.Command;
|
||||
import net.tylermurphy.hideAndSeek.command.location.util.LocationUtils;
|
||||
import net.tylermurphy.hideAndSeek.command.location.util.Locations;
|
||||
import net.tylermurphy.hideAndSeek.command.location.LocationUtils;
|
||||
import net.tylermurphy.hideAndSeek.command.location.Locations;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Maps;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SetLobbyLocation extends Command {
|
||||
public class Lobby extends Command {
|
||||
|
||||
public void execute(Player sender, String[] args) {
|
||||
LocationUtils.setLocation(sender, Locations.LOBBY, args[0], map -> {
|
|
@ -1,8 +1,8 @@
|
|||
package net.tylermurphy.hideAndSeek.command.location;
|
||||
package net.tylermurphy.hideAndSeek.command.map.set;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.command.util.Command;
|
||||
import net.tylermurphy.hideAndSeek.command.location.util.LocationUtils;
|
||||
import net.tylermurphy.hideAndSeek.command.location.util.Locations;
|
||||
import net.tylermurphy.hideAndSeek.command.location.LocationUtils;
|
||||
import net.tylermurphy.hideAndSeek.command.location.Locations;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Maps;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -11,7 +11,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
|
||||
|
||||
public class SetSeekerLobbyLocation extends Command {
|
||||
public class SeekerLobby extends Command {
|
||||
|
||||
public void execute(Player sender, String[] args) {
|
||||
LocationUtils.setLocation(sender, Locations.SEEKER, args[0], map -> {
|
|
@ -17,11 +17,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package net.tylermurphy.hideAndSeek.command.location;
|
||||
package net.tylermurphy.hideAndSeek.command.map.set;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.command.util.Command;
|
||||
import net.tylermurphy.hideAndSeek.command.location.util.LocationUtils;
|
||||
import net.tylermurphy.hideAndSeek.command.location.util.Locations;
|
||||
import net.tylermurphy.hideAndSeek.command.location.LocationUtils;
|
||||
import net.tylermurphy.hideAndSeek.command.location.Locations;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Maps;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -33,7 +33,7 @@ import java.util.stream.Collectors;
|
|||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
|
||||
|
||||
public class SetSpawnLocation extends Command {
|
||||
public class Spawn extends Command {
|
||||
|
||||
public void execute(Player sender, String[] args) {
|
||||
LocationUtils.setLocation(sender, Locations.GAME, args[0], map -> {
|
|
@ -20,7 +20,8 @@
|
|||
package net.tylermurphy.hideAndSeek.command.util;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.command.*;
|
||||
import net.tylermurphy.hideAndSeek.command.map.SaveMap;
|
||||
import net.tylermurphy.hideAndSeek.command.map.Save;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -38,7 +39,7 @@ public class CommandGroup {
|
|||
|
||||
public CommandGroup(String label, Object... data) {
|
||||
this.label = label;
|
||||
this.commandRegister = new HashMap<>();
|
||||
this.commandRegister = new LinkedHashMap<>();
|
||||
for(Object o : data) registerCommand(o);
|
||||
}
|
||||
|
||||
|
@ -65,11 +66,15 @@ public class CommandGroup {
|
|||
if (permissionsRequired && !player.hasPermission("hs.about")) {
|
||||
player.sendMessage(errorPrefix + message("COMMAND_NOT_ALLOWED"));
|
||||
} else {
|
||||
new About().execute(player, null);
|
||||
player.sendMessage(
|
||||
String.format("%s%sHide and Seek %s(%s1.7.0 ALPHA%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) +
|
||||
String.format("%sAuthor: %s[KenshinEto]\n", ChatColor.GRAY, ChatColor.WHITE) +
|
||||
String.format("%sHelp Command: %s/hs %shelp", ChatColor.GRAY, ChatColor.AQUA, ChatColor.WHITE)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
String invoke = args[0].toLowerCase();
|
||||
if (!invoke.equals("about") && !invoke.equals("help") && SaveMap.runningBackup) {
|
||||
if (!invoke.equals("about") && !invoke.equals("help") && Save.runningBackup) {
|
||||
player.sendMessage(errorPrefix + message("MAPSAVE_INPROGRESS"));
|
||||
} else if (permissionsRequired && !player.hasPermission(permission+"."+invoke)) {
|
||||
player.sendMessage(errorPrefix + message("COMMAND_NOT_ALLOWED"));
|
||||
|
|
|
@ -101,7 +101,6 @@ public class Config {
|
|||
lobbyItemStartPosition,
|
||||
flightToggleItemPosition,
|
||||
teleportItemPosition,
|
||||
solidifyTime,
|
||||
delayedRespawnDelay;
|
||||
|
||||
public static float
|
||||
|
@ -113,24 +112,6 @@ public class Config {
|
|||
blockedCommands,
|
||||
blockedInteracts;
|
||||
|
||||
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 ItemStack
|
||||
lobbyLeaveItem,
|
||||
lobbyStartItem,
|
||||
|
@ -152,7 +133,6 @@ public class Config {
|
|||
|
||||
config = ConfigManager.create("config.yml");
|
||||
config.saveConfig();
|
||||
ConfigManager leaderboard = ConfigManager.create("leaderboard.yml");
|
||||
|
||||
announceMessagesToNonPlayers = config.getBoolean("announceMessagesToNonPlayers");
|
||||
|
||||
|
@ -247,25 +227,6 @@ public class Config {
|
|||
}
|
||||
bungeeLeave = config.getString("leaveType") == null || config.getString("leaveType").equalsIgnoreCase("proxy");
|
||||
leaveServer = config.getString("leaveServer");
|
||||
solidifyTime = Math.max(20,config.getInt("blockhunt.solidifyTime"));
|
||||
|
||||
//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");
|
||||
|
||||
//Lobby Items
|
||||
if (config.getBoolean("lobbyItems.leave.enabled")) {
|
||||
|
|
|
@ -93,6 +93,7 @@ public class ConfigManager {
|
|||
try {
|
||||
this.config.load(reader);
|
||||
} catch(InvalidConfigurationException e) {
|
||||
Main.getInstance().getLogger().severe(e.getMessage());
|
||||
throw new RuntimeException("Invalid configuration in config file: "+file.getPath());
|
||||
} catch(IOException e) {
|
||||
throw new RuntimeException("Could not access file: "+file.getPath());
|
||||
|
@ -107,9 +108,10 @@ public class ConfigManager {
|
|||
try {
|
||||
this.defaultConfig.load(default_reader);
|
||||
} catch(InvalidConfigurationException e) {
|
||||
throw new RuntimeException("Invalid configuration in config file: "+file.getPath());
|
||||
Main.getInstance().getLogger().severe(e.getMessage());
|
||||
throw new RuntimeException("Invalid configuration in internal config file: "+defaultFilename);
|
||||
} catch(IOException e) {
|
||||
throw new RuntimeException("Could not access file: "+file.getPath());
|
||||
throw new RuntimeException("Could not access internal file: "+defaultFilename);
|
||||
}
|
||||
|
||||
try{
|
||||
|
@ -240,69 +242,110 @@ public class ConfigManager {
|
|||
|
||||
public void saveConfig() {
|
||||
try {
|
||||
// open config file
|
||||
InputStream is = Main.getInstance().getResource(defaultFilename);
|
||||
// if failed error
|
||||
if (is == null) {
|
||||
throw new RuntimeException("Could not create input stream for "+defaultFilename);
|
||||
}
|
||||
// manually read in each character to preserve string data
|
||||
StringBuilder textBuilder = new StringBuilder(new String("".getBytes(), StandardCharsets.UTF_8));
|
||||
Reader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
|
||||
int c;
|
||||
while((c = reader.read()) != -1) {
|
||||
while((c = reader.read()) != -1)
|
||||
textBuilder.append((char) c);
|
||||
}
|
||||
String yamlString = new String(textBuilder.toString().getBytes(), StandardCharsets.UTF_8);
|
||||
Map<String, Object> temp = config.getValues(true);
|
||||
for(Map.Entry<String, Object> entry: temp.entrySet()) {
|
||||
if (entry.getValue() instanceof Integer || entry.getValue() instanceof Double || entry.getValue() instanceof String || entry.getValue() instanceof Boolean || entry.getValue() instanceof List) {
|
||||
String[] parts = entry.getKey().split("\\.");
|
||||
int index = 0;
|
||||
int i = 0;
|
||||
for(String part : parts) {
|
||||
if (i == 0) {
|
||||
index = yamlString.indexOf(part+":", index);
|
||||
} else {
|
||||
index = yamlString.indexOf(" " + part+":", index);
|
||||
index++;
|
||||
}
|
||||
i++;
|
||||
if (index == -1) break;
|
||||
}
|
||||
if (index < 10) continue;
|
||||
int start = yamlString.indexOf(' ', index);
|
||||
int end = yamlString.indexOf('\n', index);
|
||||
if (end == -1) end = yamlString.length();
|
||||
StringBuilder replace = new StringBuilder(new String("".getBytes(), StandardCharsets.UTF_8));
|
||||
if (entry.getValue() instanceof List) {
|
||||
if (((List<?>) entry.getValue()).isEmpty()) {
|
||||
replace.append("[]");
|
||||
} else {
|
||||
replace.append("[");
|
||||
for (Object o : (List<?>) entry.getValue()) {
|
||||
replace.append(o.toString()).append(", ");
|
||||
}
|
||||
replace = new StringBuilder(replace.substring(0, replace.length() - 2));
|
||||
replace.append("]");
|
||||
}
|
||||
// store yaml file into a string
|
||||
String yaml = new String(textBuilder.toString().getBytes(), StandardCharsets.UTF_8);
|
||||
// get config values
|
||||
Map<String, Object> data = config.getValues(true);
|
||||
// write each stored config value into the yaml string
|
||||
for(Map.Entry<String, Object> entry: data.entrySet()) {
|
||||
// if type isn't supported, skip
|
||||
if(!isSupported(entry.getValue())) continue;
|
||||
// get index of key in yaml string
|
||||
int index = getIndex(yaml, entry.getKey());
|
||||
// if index not found, skip
|
||||
if (index < 10) continue;
|
||||
// get start and end of the value
|
||||
int start = yaml.indexOf(' ', index) + 1;
|
||||
int end = yaml.indexOf('\n', index);
|
||||
// if end not found, set it to the end of the file
|
||||
if (end == -1) end = yaml.length();
|
||||
// create new replace sting
|
||||
StringBuilder replace = new StringBuilder(new String("".getBytes(), StandardCharsets.UTF_8));
|
||||
// get value
|
||||
Object value = entry.getValue();
|
||||
// if the value is a list,
|
||||
if (value instanceof List) {
|
||||
end = yaml.indexOf(']', start) + 1;
|
||||
List<?> list = (List<?>) entry.getValue();
|
||||
if (list.isEmpty()) {
|
||||
// if list is empty, put an empty list
|
||||
replace.append("[]");
|
||||
} else {
|
||||
replace.append(entry.getValue());
|
||||
// if list has values, populate values into the string
|
||||
// get gap before key
|
||||
int gap = whitespaceBefore(yaml, index);
|
||||
String space = new String(new char[gap]).replace('\0', ' ');
|
||||
replace.append("[\n");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
replace.append(space).append(" ").append(convert(list.get(i)));
|
||||
if(i != list.size() -1) replace.append(",\n");
|
||||
}
|
||||
replace.append('\n').append(space).append("]");
|
||||
}
|
||||
if (entry.getValue() instanceof String) {
|
||||
replace.append("\"");
|
||||
replace.reverse();
|
||||
replace.append("\"");
|
||||
replace.reverse();
|
||||
}
|
||||
StringBuilder builder = new StringBuilder(yamlString);
|
||||
builder.replace(start+1, end, replace.toString());
|
||||
yamlString = builder.toString();
|
||||
// otherwise just put the value directly
|
||||
} else {
|
||||
replace.append(convert(value));
|
||||
}
|
||||
// replace the new value in the yaml string
|
||||
StringBuilder builder = new StringBuilder(yaml);
|
||||
builder.replace(start, end, replace.toString());
|
||||
yaml = builder.toString();
|
||||
}
|
||||
|
||||
// write yaml string to file
|
||||
Writer fileWriter = new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(file.toPath()), StandardCharsets.UTF_8));
|
||||
fileWriter.write(yamlString);
|
||||
fileWriter.write(yaml);
|
||||
fileWriter.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private int getIndex(String yaml, String key) {
|
||||
String[] parts = key.split("\\.");
|
||||
int index = 0;
|
||||
for(String part : parts) {
|
||||
if (index == 0) {
|
||||
index = yaml.indexOf(part + ":", index);
|
||||
} else {
|
||||
index = yaml.indexOf(" " + part + ":", index) + 1;
|
||||
}
|
||||
if (index == -1) break;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
public boolean isSupported(Object o) {
|
||||
return o instanceof Integer ||
|
||||
o instanceof Double ||
|
||||
o instanceof String ||
|
||||
o instanceof Boolean ||
|
||||
o instanceof List;
|
||||
}
|
||||
|
||||
public int whitespaceBefore(String yaml, int index) {
|
||||
int count = 0;
|
||||
for(int i = index - 1; yaml.charAt(i) == ' '; i--) count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
private String convert(Object o) {
|
||||
if(o instanceof String) {
|
||||
return "\"" + o + "\"";
|
||||
}
|
||||
return o.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package net.tylermurphy.hideAndSeek.configuration;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Leaderboard {
|
||||
|
||||
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 void loadLeaderboard() {
|
||||
|
||||
ConfigManager leaderboard = ConfigManager.create("leaderboard.yml");
|
||||
|
||||
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");
|
||||
|
||||
leaderboard.saveConfig();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -31,7 +31,7 @@ public class Localization {
|
|||
public static final Map<String,LocalizationString> DEFAULT_LOCAL = new HashMap<>();
|
||||
|
||||
private static final Map<String,String[][]> CHANGES = new HashMap<String,String[][]>() {{
|
||||
put("en-US", new String[][]{{"WORLDBORDER_DECREASING"},{"START","TAUNTED"}});
|
||||
put("en-US", new String[][]{{"WORLDBORDER_DECREASING"},{"START","TAUNTED"},{"GAME_SETUP"}});
|
||||
put("de-DE", new String[][]{{},{"TAUNTED"}});
|
||||
}};
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Leaderboard.*;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
|
||||
|
||||
public class Board {
|
||||
|
@ -218,7 +219,9 @@ public class Board {
|
|||
} 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()+""));
|
||||
board.setLine(String.valueOf(i), line.replace("{HIDER%}", getHiderPercent() + ""));
|
||||
} else if (line.contains("{MAP}")) {
|
||||
board.setLine(String.valueOf(i), line.replace("{MAP}", getMapName() + ""));
|
||||
} else {
|
||||
board.setLine(String.valueOf(i), line);
|
||||
}
|
||||
|
@ -228,6 +231,12 @@ public class Board {
|
|||
customBoards.put(player.getUniqueId().toString(), board);
|
||||
}
|
||||
|
||||
public String getMapName() {
|
||||
net.tylermurphy.hideAndSeek.configuration.Map map = Main.getInstance().getGame().getCurrentMap();
|
||||
if(map == null) return "Invalid";
|
||||
else return map.getName();
|
||||
}
|
||||
|
||||
public void createGameBoard(Player player) {
|
||||
createGameBoard(player, true);
|
||||
}
|
||||
|
@ -288,6 +297,8 @@ public class Board {
|
|||
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 if (line.contains("{MAP}")) {
|
||||
board.setLine(String.valueOf(i), line.replace("{MAP}", getMapName() + ""));
|
||||
} else {
|
||||
board.setLine(String.valueOf(i), line);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.tylermurphy.hideAndSeek.game;
|
||||
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.configuration.Map;
|
||||
import net.tylermurphy.hideAndSeek.game.util.Disguise;
|
||||
|
@ -49,7 +50,7 @@ public class Disguiser {
|
|||
|
||||
public void disguise(Player player, Material material, Map map){
|
||||
if(!map.isBlockHuntEnabled()){
|
||||
player.sendMessage(errorPrefix + "Please enable blockhunt in this map inside maps.yml to enable disguises. Blockhunt does not work on 1.8");
|
||||
player.sendMessage(errorPrefix + message("BLOCKHUNT_DISABLED"));
|
||||
return;
|
||||
}
|
||||
if(disguises.containsKey(player)){
|
||||
|
|
|
@ -11,7 +11,7 @@ public class ChatHandler implements Listener {
|
|||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onChat(AsyncPlayerChatEvent event) {
|
||||
if (Main.getInstance().getBoard().isSeeker(event.getPlayer())) {
|
||||
if (Main.getInstance().getBoard().isSpectator(event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
Main.getInstance().getBoard().getSpectators().forEach(spectator -> spectator.sendMessage(ChatColor.GRAY + "[SPECTATOR] " + event.getPlayer().getName() + ": " + event.getMessage()));
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package net.tylermurphy.hideAndSeek.game.listener;
|
||||
|
||||
import static com.comphenix.protocol.PacketType.Play.Client.*;
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Config.solidifyTime;
|
||||
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.ProtocolManager;
|
||||
|
@ -42,7 +41,7 @@ public class DisguiseHandler implements Listener {
|
|||
if(lastLocation.getWorld() != currentLocation.getWorld()) return;
|
||||
double distance = lastLocation.distance(currentLocation);
|
||||
disguise.setSolidify(distance < .1);
|
||||
}, solidifyTime);
|
||||
}, 20 * 3);
|
||||
if(event.getFrom().distance(event.getTo()) > .1)
|
||||
disguise.setSolidify(false);
|
||||
}
|
||||
|
|
|
@ -19,11 +19,9 @@
|
|||
|
||||
package net.tylermurphy.hideAndSeek.game.listener;
|
||||
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||
|
||||
import com.cryptomorin.xseries.XMaterial;
|
||||
import net.tylermurphy.hideAndSeek.Main;
|
||||
import net.tylermurphy.hideAndSeek.command.Debug;
|
||||
import net.tylermurphy.hideAndSeek.command.map.Debug;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Map;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Maps;
|
||||
import net.tylermurphy.hideAndSeek.game.util.Status;
|
||||
|
|
|
@ -75,7 +75,7 @@ public class WorldLoader {
|
|||
public String save() {
|
||||
World world = Bukkit.getServer().getWorld(map.getSpawnName());
|
||||
if(world == null){
|
||||
return errorPrefix + "Invalid world to save: " + map.getSpawnName();
|
||||
return errorPrefix + message("MAPSAVE_INVALID").addAmount(map.getSpawnName());
|
||||
}
|
||||
File current = new File(Main.getInstance().getWorldContainer()+File.separator+ map.getSpawnName());
|
||||
if (current.exists()) {
|
||||
|
@ -94,7 +94,7 @@ public class WorldLoader {
|
|||
}
|
||||
|
||||
if (!temp_destination.renameTo(destination)) {
|
||||
return errorPrefix + "Failed to rename directory: " + temp_destination.getPath();
|
||||
return errorPrefix + message("MAPSAVE_FAIL_DIR").addAmount(temp_destination.getPath());
|
||||
}
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -15,23 +15,23 @@ gameLength: 1200
|
|||
announceMessagesToNonPlayers: true
|
||||
|
||||
# When the game is starting, the plugin will state there is x seconds left to hide.
|
||||
# You change where countdown messages to be displayed: in the chat, action bar, or a title.
|
||||
# You change where countdown messages are to be displayed: in the chat, action bar, or a title.
|
||||
# Below you can set CHAT, ACTIONBAR, or TITLE. Any invalid option will revert to CHAT.
|
||||
#
|
||||
# CHAT - Messages will be displayed in the chat
|
||||
# CHAT - Staring messages will be displayed in the chat
|
||||
#
|
||||
# ACTIONBAR - Messages will be displayed in the action bar (area above the hotbar)
|
||||
# ACTIONBAR - Staring messages will be displayed in the action bar (area above the hotbar)
|
||||
#
|
||||
# TITLE - Messages will be displayed as a title
|
||||
# TITLE - Staring messages will be displayed as a title
|
||||
#
|
||||
# default: CHAT
|
||||
hideCountdownDisplay: CHAT
|
||||
hideCountdownDisplay: "CHAT"
|
||||
|
||||
# Allow Hiders to see their own teams nametags as well as seekers. Seekers can never see nametags regardless.
|
||||
# default: false
|
||||
nametagsVisible: false
|
||||
|
||||
# Require bukkit permissions though a plugin to run commands, recommended on large servers
|
||||
# Require bukkit permissions though a permissions plugin to run commands, or require op, recommended on most servers
|
||||
# default: true
|
||||
permissionsRequired: true
|
||||
|
||||
|
@ -80,11 +80,11 @@ leaveOnEnd: false
|
|||
# PROXY - Send the player to a specified server in a bungee-cord / velocity setup.
|
||||
#
|
||||
# default: EXIT
|
||||
leaveType: EXIT
|
||||
leaveType: "EXIT"
|
||||
|
||||
# Ignore this setting if you aren't using the PROXY leave type method above. If you are, set this to the server you want to send
|
||||
# players too.
|
||||
leaveServer: hub
|
||||
leaveServer: "hub"
|
||||
|
||||
# By default, the plugin forces you to use a map save to protect from changes to a map thought a game play though. It copies your
|
||||
# hide-and-seek world to a separate world, and loads the game there to contain the game in an isolated and backed up map This allows you to
|
||||
|
@ -117,40 +117,16 @@ delayedRespawn:
|
|||
# MYSQL - Uses a mysql server to store data, good for multi-server setups or large servers.
|
||||
#
|
||||
# default: SQLITE
|
||||
databaseType: SQLITE
|
||||
databaseType: "SQLITE"
|
||||
|
||||
# The following settings are used for MYSQL databases ONLY. If you are running SQLITE, these
|
||||
# will be ignored. If you are running MYSQL, you need to provide the database host url, database
|
||||
# host port (usually 3306), database username, and database password.
|
||||
databaseHost: localhost
|
||||
databaseHost: "localhost"
|
||||
databasePort: 3306
|
||||
databaseUser: root
|
||||
databasePass:
|
||||
databaseName: hideandseek
|
||||
|
||||
# The world border closes every interval, which is evey [delay] in minutes.
|
||||
# Thw world border starts at [size], and decreases 100 blocks every interval.
|
||||
# x & z are the center location. [enabled] is whenever the border is enabled.
|
||||
# You can choose if Hiders are warned 30 seconds before the border moves.
|
||||
|
||||
# You want block hunt? We have block hunt! Just enable it below, and set the
|
||||
# available blocks to pick from, and you're all set! It's that easy!
|
||||
# Items are displayed in the order that they are listed below.
|
||||
# The solidifyTime is the time in server ticks that it takes players to solidify.
|
||||
# Every 20 ticks is a second. Minimum solidifyTime is 20 ticks.
|
||||
blockhunt:
|
||||
enabled: false
|
||||
solidifyTime: 60
|
||||
blocks: [CRAFTING_TABLE, GRASS_BLOCK, DIRT, BEACON, BOOKSHELF]
|
||||
|
||||
worldBorder:
|
||||
x: 0
|
||||
z: 0
|
||||
delay: 10
|
||||
size: 500
|
||||
moveAmount: 100
|
||||
warn: true
|
||||
enabled: false
|
||||
databaseUser: "root"
|
||||
databasePass: "pass"
|
||||
databaseName: "hideandseek"
|
||||
|
||||
# The taunt will activate every delay set in seconds. It will spawn a firework
|
||||
# on a random Hider to alert a Seeker where someone may be. You can choose
|
||||
|
@ -173,8 +149,12 @@ glow:
|
|||
stackable: true
|
||||
enabled: true
|
||||
name: "Glow Powerup"
|
||||
lore: [ "Throw to make all seekers glow", "Last 30s, all hiders can see it", "Time stacks on multi use" ]
|
||||
material: SNOWBALL
|
||||
lore: [
|
||||
"Throw to make all seekers glow",
|
||||
"Last 30s, all hiders can see it",
|
||||
"Time stacks on multi use"
|
||||
]
|
||||
material: "SNOWBALL"
|
||||
model-data: 0
|
||||
|
||||
# This has the same glow effect as the glow powerup in that all seekers positions get
|
||||
|
@ -221,14 +201,16 @@ lobby:
|
|||
# If you set adminOnly to false, only the item will become non admin only, not the command.
|
||||
lobbyItems:
|
||||
leave:
|
||||
material: BED
|
||||
material: "BED"
|
||||
name: "&cLeave Lobby"
|
||||
lore: ["Go back to server hub"]
|
||||
lore: [
|
||||
"Go back to server hub"
|
||||
]
|
||||
position: 8
|
||||
model-data: 0
|
||||
enabled: true
|
||||
start:
|
||||
material: CLOCK
|
||||
material: "CLOCK"
|
||||
name: "&bStart Game"
|
||||
lore: []
|
||||
position: 0
|
||||
|
@ -241,15 +223,19 @@ lobbyItems:
|
|||
# and position of the item. You can also change the model data if your server is running 1.14 or above.
|
||||
spectatorItems:
|
||||
flight:
|
||||
material: FEATHER
|
||||
material: "FEATHER"
|
||||
name: "&bToggle Flight"
|
||||
lore: [ "Turns flying on and off" ]
|
||||
lore: [
|
||||
"Turns flying on and off"
|
||||
]
|
||||
position: 3
|
||||
model-data: 0
|
||||
teleport:
|
||||
material: COMPASS
|
||||
material: "COMPASS"
|
||||
name: "&bTeleport to Others"
|
||||
lore: [ "Allows you to teleport to all other players in game" ]
|
||||
lore: [
|
||||
"Allows you to teleport to all other players in game"
|
||||
]
|
||||
position: 5
|
||||
model-data: 0
|
||||
|
||||
|
@ -265,8 +251,8 @@ seekerPing:
|
|||
leadingVolume: 0.5
|
||||
volume: 0.3
|
||||
pitch: 1
|
||||
heartbeatNoise: BLOCK_NOTE_BLOCK_BASEDRUM
|
||||
ringingNoise: BLOCK_NOTE_BLOCK_PLING
|
||||
heartbeatNoise: "BLOCK_NOTE_BLOCK_BASEDRUM"
|
||||
ringingNoise: "BLOCK_NOTE_BLOCK_PLING"
|
||||
enabled: true
|
||||
|
||||
# Changes the default plugin language. Currently, Supported localizations are:
|
||||
|
@ -275,26 +261,37 @@ seekerPing:
|
|||
locale: "en-US"
|
||||
|
||||
# Stop commands being run by any user while playing the game.
|
||||
# Can be usefull If you aren't using a permission plugin and want
|
||||
# Can be usefull If you aren't using a permission plugin and don't 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]
|
||||
blockedCommands: [
|
||||
"msg",
|
||||
"tp",
|
||||
"gamemode",
|
||||
"kill",
|
||||
"give",
|
||||
"effect"
|
||||
]
|
||||
|
||||
# Stop interactions with any block by any user while playing the game.
|
||||
# If your map has things such as chests for aesthetic only, you can
|
||||
# block the use of clicking them. It shouldn't matter what version of
|
||||
# the block ID you enter, as the plugin will automatically switch to the
|
||||
# block ID of your current Minecraft server version.
|
||||
blockedInteracts: [FURNACE, CRAFTING_TABLE, ANVIL, CHEST, BARREL]
|
||||
# ---------------------------------------------------------- #
|
||||
# ONLY EDIT BEYOND THIS POINT IF YOU KNOW WHAT YOU ARE DOING #
|
||||
# ---------------------------------------------------------- #
|
||||
blockedInteracts: [
|
||||
"FURNACE",
|
||||
"CRAFTING_TABLE",
|
||||
"ANVIL",
|
||||
"CHEST",
|
||||
"BARREL"
|
||||
]
|
||||
|
||||
# Location where players are teleported when they exit (/hs leave)
|
||||
# Auto filled by /hs setexit, so you don't need to touch this here
|
||||
exit:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
world: world
|
||||
world: "world"
|
|
@ -10,6 +10,7 @@ Localization:
|
|||
COMMAND_PLAYER_ONLY: "This command can only be run as a player."
|
||||
COMMAND_NOT_ALLOWED: "You are not allowed to run this command."
|
||||
COMMAND_ERROR: "An internal error has occurred."
|
||||
COMMAND_INVALID_ARG: "Invalid argument: {AMOUNT}"
|
||||
GAME_PLAYER_DEATH: "&c{PLAYER}&f was killed."
|
||||
GAME_PLAYER_FOUND: "&e{PLAYER}&f was found and became a seeker."
|
||||
GAME_PLAYER_FOUND_BY: "&e{PLAYER}&f was found by &c{PLAYER}&f and became a seeker."
|
||||
|
@ -17,7 +18,7 @@ Localization:
|
|||
GAME_GAMEOVER_SEEKERS_QUIT: "All seekers have quit."
|
||||
GAME_GAMEOVER_HIDERS_QUIT: "All hiders have quit."
|
||||
GAME_GAMEOVER_TIME: "Seekers ran out of time. Hiders win!"
|
||||
GAME_SETUP: "There are no setup maps! Run /hs setup on a map to see what you need to do."
|
||||
GAME_SETUP: "There are no setup maps! Run /hs map status on a map to see what you need to do."
|
||||
GAME_INGAME: "You are already in the lobby/game."
|
||||
GAME_NOT_INGAME: "You are not in a lobby/game."
|
||||
GAME_INPROGRESS: "There is currently a game in progress."
|
||||
|
@ -32,6 +33,9 @@ Localization:
|
|||
MAPSAVE_END: "Map save complete."
|
||||
MAPSAVE_ERROR: "Couldn't find current map."
|
||||
MAPSAVE_DISABLED: "Mapsave is disabled in config.yml."
|
||||
MAPSAVE_FAIL_WORLD: "Mapsave failed. Failed to load current world."
|
||||
MAPSAVE_INVALID: "Invalid world to save: {AMOUNT}"
|
||||
MAPSAVE_FAIL_DIR: "Failed to rename directory: {AMOUNT}"
|
||||
WORLDBORDER_DISABLE: "Disabled world border."
|
||||
WORLDBORDER_INVALID_INPUT: "Invalid integer {AMOUNT}."
|
||||
WORLDBORDER_MIN_SIZE: "World border cannot be smaller than 100 blocks."
|
||||
|
@ -58,6 +62,7 @@ Localization:
|
|||
SEEKER_SPAWN: "Set seeker lobby position to current location"
|
||||
START_MIN_PLAYERS: "You must have at least {AMOUNT} players to start."
|
||||
START_INVALID_NAME: "Invalid player: {PLAYER}."
|
||||
START_FAILED_SEEKER: "Failed to select random seeker."
|
||||
START_COUNTDOWN: "Hiders have {AMOUNT} seconds to hide!"
|
||||
START_COUNTDOWN_LAST: "Hiders have {AMOUNT} second to hide!"
|
||||
START: "Attention SEEKERS, its time to find the hiders!"
|
||||
|
@ -77,9 +82,9 @@ Localization:
|
|||
FLYING_ENABLED: "&l&bFlying Enabled"
|
||||
FLYING_DISABLED: "&l&bFlying Disabled"
|
||||
RESPAWN_NOTICE: "You will respawn in {AMOUNT} seconds."
|
||||
INVALID_MAP: "That is an invalid map name!!"
|
||||
INVALID_MAP: "That is an invalid map name!"
|
||||
MAP_ALREADY_EXISTS: "This map already exists!"
|
||||
INVALID_MAP_NAME: "A map name can only contain numbers or letters"
|
||||
INVALID_MAP_NAME: "A map name can only contain numbers or letters."
|
||||
MAP_CREATED: "Created new map: {AMOUNT}"
|
||||
MAP_FAIL_DELETE: "Failed to delete map: {AMOUNT}"
|
||||
MAP_DELETED: "Deleted map: {AMOUNT}"
|
||||
|
@ -88,9 +93,11 @@ Localization:
|
|||
LIST_MAPS: "The current maps are:"
|
||||
ARGUMENT_COUNT: "This command requires more arguments to run."
|
||||
GAME_SPAWN_NEEDED: "Game spawn must be set before seeker spawn."
|
||||
SEEKER_LOBBY_SPAWN_RESET: "Seeker lobby spawn reset since the game spawn was moved to a new world"
|
||||
SEEKER_LOBBY_INVALID: "Seeker lobby must be in the same world as game spawn"
|
||||
SEEKER_LOBBY_SPAWN_RESET: "Seeker lobby spawn reset since the game spawn was moved to a new world."
|
||||
SEEKER_LOBBY_INVALID: "Seeker lobby must be in the same world as game spawn."
|
||||
CONFIG_ERROR: "Error reloading config. Check server logs."
|
||||
BLOCKHUNT_DISABLED: "Please enable blockhunt in this map inside maps.yml to enable disguises. Blockhunt does not work on 1.8"
|
||||
|
||||
# DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE
|
||||
version: 3
|
||||
version: 4
|
||||
type: "en-US"
|
|
@ -16,6 +16,7 @@
|
|||
# {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.
|
||||
# {MAP} - The current map the player is on
|
||||
#
|
||||
# GAME BOARD PLACEHOLDERS
|
||||
#
|
||||
|
@ -38,6 +39,7 @@
|
|||
# only Hiders will be able to see its effects though.
|
||||
# {#SEEKER} - Number of current seekers.
|
||||
# {#HIDER} - Number of current hiders.
|
||||
# {MAP} - The current map the player is on
|
||||
#
|
||||
# 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!
|
||||
|
@ -50,12 +52,15 @@ lobby:
|
|||
"Players: {COUNT}",
|
||||
"",
|
||||
"&cSEEKER % &f{SEEKER%}",
|
||||
"&6HIDER % &f{HIDER%}"
|
||||
"&6HIDER % &f{HIDER%}",
|
||||
"",
|
||||
"Map: {MAP}",
|
||||
]
|
||||
|
||||
game:
|
||||
title: "&eHIDE AND SEEK"
|
||||
content: [
|
||||
"Map: {MAP}",
|
||||
"Team: {TEAM}",
|
||||
"",
|
||||
"Time Left: &a{TIME}",
|
||||
|
|
Loading…
Reference in a new issue