1.7.5 rc4

This commit is contained in:
Freya Murphy 2023-07-30 18:12:47 -04:00
parent a4df18b0b3
commit 000219a5ff
96 changed files with 935 additions and 854 deletions

View file

@ -1,5 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion>
<groupId>net.tylermurphy</groupId>
<groupId>dev.tylerm</groupId>
<artifactId>KenshinsHideAndSeek</artifactId>
<version>1.7.5</version>
<name>Hide and Seek Plugin</name>
@ -27,11 +27,11 @@
<relocations>
<relocation>
<pattern>com.cryptomorin.xseries</pattern>
<shadedPattern>net.tylermurphy.dependencies.xseries</shadedPattern>
<shadedPattern>dev.tylerm.depend.xseries</shadedPattern>
</relocation>
<relocation>
<pattern>com.zaxxer.hikari</pattern>
<shadedPattern>net.tylermurphy.dependencies.hikari</shadedPattern>
<shadedPattern>dev.tylerm.depend.hikari</shadedPattern>
</relocation>
</relocations>
<artifactSet>

View file

@ -1,18 +1,24 @@
package net.tylermurphy.hideAndSeek;
package dev.tylerm.khs;
import net.tylermurphy.hideAndSeek.command.*;
import net.tylermurphy.hideAndSeek.command.map.*;
import net.tylermurphy.hideAndSeek.command.map.blockhunt.Enabled;
import net.tylermurphy.hideAndSeek.command.map.set.*;
import net.tylermurphy.hideAndSeek.command.world.Create;
import net.tylermurphy.hideAndSeek.command.world.Delete;
import net.tylermurphy.hideAndSeek.command.world.Tp;
import net.tylermurphy.hideAndSeek.configuration.*;
import net.tylermurphy.hideAndSeek.database.Database;
import net.tylermurphy.hideAndSeek.game.*;
import net.tylermurphy.hideAndSeek.command.util.CommandGroup;
import net.tylermurphy.hideAndSeek.game.listener.*;
import net.tylermurphy.hideAndSeek.util.PAPIExpansion;
import dev.tylerm.khs.command.*;
import dev.tylerm.khs.command.map.Debug;
import dev.tylerm.khs.command.map.GoTo;
import dev.tylerm.khs.command.map.Save;
import dev.tylerm.khs.command.map.blockhunt.blocks.Add;
import dev.tylerm.khs.command.map.blockhunt.blocks.List;
import dev.tylerm.khs.command.map.blockhunt.blocks.Remove;
import dev.tylerm.khs.command.map.set.*;
import dev.tylerm.khs.configuration.*;
import dev.tylerm.khs.game.*;
import dev.tylerm.khs.game.listener.*;
import dev.tylerm.khs.game.util.Status;
import dev.tylerm.khs.util.PAPIExpansion;
import dev.tylerm.khs.command.map.blockhunt.Enabled;
import dev.tylerm.khs.command.world.Create;
import dev.tylerm.khs.command.world.Delete;
import dev.tylerm.khs.command.world.Tp;
import dev.tylerm.khs.database.Database;
import dev.tylerm.khs.command.util.CommandGroup;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -27,8 +33,8 @@ import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.*;
import static dev.tylerm.khs.configuration.Localization.message;
public class Main extends JavaPlugin implements Listener {
@ -94,9 +100,9 @@ public class Main extends JavaPlugin implements Listener {
new CommandGroup("map",
new CommandGroup("blockhunt",
new CommandGroup("blocks",
new net.tylermurphy.hideAndSeek.command.map.blockhunt.blocks.Add(),
new net.tylermurphy.hideAndSeek.command.map.blockhunt.blocks.Remove(),
new net.tylermurphy.hideAndSeek.command.map.blockhunt.blocks.List()
new Add(),
new Remove(),
new List()
),
new Enabled()
),
@ -107,10 +113,13 @@ public class Main extends JavaPlugin implements Listener {
new Border(),
new Bounds()
),
new Add(),
new Remove(),
new List(),
new Status(),
new CommandGroup("unset",
new dev.tylerm.khs.command.map.unset.Border()
),
new dev.tylerm.khs.command.map.Add(),
new dev.tylerm.khs.command.map.Remove(),
new dev.tylerm.khs.command.map.List(),
new dev.tylerm.khs.command.map.Status(),
new Save(),
new Debug(),
new GoTo()
@ -118,7 +127,7 @@ public class Main extends JavaPlugin implements Listener {
new CommandGroup("world",
new Create(),
new Delete(),
new net.tylermurphy.hideAndSeek.command.world.List(),
new dev.tylerm.khs.command.world.List(),
new Tp()
),
new SetExitLocation(),
@ -170,7 +179,7 @@ public class Main extends JavaPlugin implements Listener {
}
private void onTick() {
if(game.getStatus() == net.tylermurphy.hideAndSeek.game.util.Status.ENDED) game = new Game(game.getCurrentMap(), board);
if(game.getStatus() == Status.ENDED) game = new Game(game.getCurrentMap(), board);
game.onTick();
disguiser.check();
}

View file

@ -1,14 +1,14 @@
package net.tylermurphy.hideAndSeek.command;
package dev.tylerm.khs.command;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import dev.tylerm.khs.command.util.ICommand;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.*;
import java.util.function.Consumer;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.errorPrefix;
import static dev.tylerm.khs.configuration.Localization.message;
public class Confirm implements ICommand {

View file

@ -1,8 +1,8 @@
package net.tylermurphy.hideAndSeek.command;
package dev.tylerm.khs.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.util.Pair;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.util.Pair;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@ -11,8 +11,8 @@ import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.errorPrefix;
import static dev.tylerm.khs.configuration.Localization.message;
public class Help implements ICommand {

View file

@ -1,15 +1,15 @@
package net.tylermurphy.hideAndSeek.command;
package dev.tylerm.khs.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.errorPrefix;
import static dev.tylerm.khs.configuration.Localization.message;
public class Join implements ICommand {

View file

@ -1,15 +1,15 @@
package net.tylermurphy.hideAndSeek.command;
package dev.tylerm.khs.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.errorPrefix;
import static dev.tylerm.khs.configuration.Localization.message;
public class Leave implements ICommand {

View file

@ -1,17 +1,17 @@
package net.tylermurphy.hideAndSeek.command;
package dev.tylerm.khs.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.*;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.*;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
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;
import static dev.tylerm.khs.configuration.Config.errorPrefix;
import static dev.tylerm.khs.configuration.Config.messagePrefix;
import static dev.tylerm.khs.configuration.Localization.message;
public class Reload implements ICommand {

View file

@ -1,41 +1,40 @@
package net.tylermurphy.hideAndSeek.command;
package dev.tylerm.khs.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Send implements ICommand {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS"));
return;
}
Map map = Maps.getMap(args[0]);
if(map == null) {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP"));
return;
}
if(map.isNotSetup()){
sender.sendMessage(errorPrefix + message("MAP_NOT_SETUP"));
sender.sendMessage(Config.errorPrefix + Localization.message("MAP_NOT_SETUP"));
return;
}
if (!Main.getInstance().getBoard().contains(sender)) {
sender.sendMessage(errorPrefix + message("GAME_NOT_INGAME"));
sender.sendMessage(Config.errorPrefix + Localization.message("GAME_NOT_INGAME"));
return;
}
@ -61,7 +60,7 @@ public class Send implements ICommand {
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().filter(map -> !map.isNotSetup()).map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
return Maps.getAllMaps().stream().filter(map -> !map.isNotSetup()).map(Map::getName).collect(Collectors.toList());
}
return null;
}

View file

@ -0,0 +1,42 @@
package dev.tylerm.khs.command;
import dev.tylerm.khs.command.location.LocationUtils;
import dev.tylerm.khs.command.location.Locations;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.util.Location;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class SetExitLocation implements ICommand {
public void execute(Player sender, String[] args) {
LocationUtils.setLocation(sender, Locations.EXIT, null, map -> {
Config.addToConfig("exit.x", sender.getLocation().getBlockX());
Config.addToConfig("exit.y", sender.getLocation().getBlockY());
Config.addToConfig("exit.z", sender.getLocation().getBlockZ());
Config.addToConfig("exit.world", sender.getLocation().getWorld().getName());
Config.exitPosition = Location.from(sender);
Config.saveConfig();
});
}
public String getLabel() {
return "setexit";
}
public String getUsage() {
return "";
}
public String getDescription() {
return "Sets the plugins exit location";
}
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
return null;
}
}

View file

@ -1,8 +1,8 @@
package net.tylermurphy.hideAndSeek.command;
package dev.tylerm.khs.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@ -11,8 +11,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.*;
import static dev.tylerm.khs.configuration.Localization.message;
public class Start implements ICommand {

View file

@ -1,16 +1,16 @@
package net.tylermurphy.hideAndSeek.command;
package dev.tylerm.khs.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import static net.tylermurphy.hideAndSeek.configuration.Config.abortPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.abortPrefix;
import static dev.tylerm.khs.configuration.Config.errorPrefix;
import static dev.tylerm.khs.configuration.Localization.message;
public class Stop implements ICommand {

View file

@ -1,8 +1,8 @@
package net.tylermurphy.hideAndSeek.command;
package dev.tylerm.khs.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.database.util.PlayerInfo;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.database.util.PlayerInfo;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@ -10,8 +10,8 @@ import org.jetbrains.annotations.NotNull;
import java.util.Collections;
import java.util.List;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.errorPrefix;
import static dev.tylerm.khs.configuration.Localization.message;
public class Top implements ICommand {

View file

@ -1,8 +1,10 @@
package net.tylermurphy.hideAndSeek.command;
package dev.tylerm.khs.command;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.database.util.PlayerInfo;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.database.util.PlayerInfo;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@ -11,9 +13,6 @@ import java.util.Collections;
import java.util.List;
import java.util.UUID;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Wins implements ICommand {
public void execute(Player sender, String[] args) {
@ -30,16 +29,16 @@ public class Wins implements ICommand {
uuid = Main.getInstance().getDatabase().getNameData().getUUID(args[0]);
}
if(uuid == null){
sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(args[0]));
sender.sendMessage(Config.errorPrefix + Localization.message("START_INVALID_NAME").addPlayer(args[0]));
return;
}
PlayerInfo info = Main.getInstance().getDatabase().getGameData().getInfo(uuid);
if (info == null) {
sender.sendMessage(errorPrefix + message("NO_GAME_INFO"));
sender.sendMessage(Config.errorPrefix + Localization.message("NO_GAME_INFO"));
return;
}
String message = ChatColor.WHITE + "" + ChatColor.BOLD + "==============================\n";
message = message + message("INFORMATION_FOR").addPlayer(name) + "\n";
message = message + Localization.message("INFORMATION_FOR").addPlayer(name) + "\n";
message = message + "==============================\n";
message = message + String.format("%sTOTAL WINS: %s%s\n%sHIDER WINS: %s%s\n%sSEEKER WINS: %s%s\n%sGAMES PLAYED: %s",
ChatColor.YELLOW, ChatColor.WHITE, info.getSeekerWins() +info.getHiderWins(), ChatColor.GOLD, ChatColor.WHITE, info.getHiderWins(),

View file

@ -1,17 +1,16 @@
package net.tylermurphy.hideAndSeek.command.location;
package dev.tylerm.khs.command.location;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.function.Consumer;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
/**
* @author bobby29831
*/
@ -20,12 +19,12 @@ public class LocationUtils {
public static void setLocation(@NotNull Player player, @NotNull Locations place, String mapName, @NotNull Consumer<Map> consumer) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
player.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
player.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS"));
return;
}
if (player.getLocation().getBlockX() == 0 || player.getLocation().getBlockZ() == 0 || player.getLocation().getBlockY() == 0){
player.sendMessage(errorPrefix + message("NOT_AT_ZERO"));
player.sendMessage(Config.errorPrefix + Localization.message("NOT_AT_ZERO"));
return;
}
@ -33,7 +32,7 @@ public class LocationUtils {
if(mapName != null) {
map = Maps.getMap(mapName);
if (map == null) {
player.sendMessage(errorPrefix + message("INVALID_MAP"));
player.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP"));
return;
}
}
@ -41,13 +40,13 @@ public class LocationUtils {
try {
consumer.accept(map);
} catch (Exception e) {
player.sendMessage(errorPrefix + e.getMessage());
player.sendMessage(Config.errorPrefix + e.getMessage());
return;
}
if(map != null)
Maps.setMap(mapName, map);
player.sendMessage(messagePrefix + message(place.message()));
player.sendMessage(Config.messagePrefix + Localization.message(place.message()));
}
}

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.command.location;
package dev.tylerm.khs.command.location;
/**
* @author bobby29831

View file

@ -1,35 +1,33 @@
package net.tylermurphy.hideAndSeek.command.map;
package dev.tylerm.khs.command.map;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Collections;
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 Add implements ICommand {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS"));
return;
}
Map map = Maps.getMap(args[0]);
if(map != null) {
sender.sendMessage(errorPrefix + message("MAP_ALREADY_EXISTS"));
sender.sendMessage(Config.errorPrefix + Localization.message("MAP_ALREADY_EXISTS"));
} else if(!args[0].matches("[a-zA-Z0-9]*") || args[0].length() < 1) {
sender.sendMessage(errorPrefix + message("INVALID_MAP_NAME"));
sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP_NAME"));
} else {
Maps.setMap(args[0], new Map(args[0]));
sender.sendMessage(messagePrefix + message("MAP_CREATED").addAmount(args[0]));
sender.sendMessage(Config.messagePrefix + Localization.message("MAP_CREATED").addAmount(args[0]));
}
}

View file

@ -1,11 +1,13 @@
package net.tylermurphy.hideAndSeek.command.map;
package dev.tylerm.khs.command.map;
import com.cryptomorin.xseries.XMaterial;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.PlayerLoader;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.configuration.Maps;
import dev.tylerm.khs.game.PlayerLoader;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -20,46 +22,43 @@ import java.util.Map;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Debug implements ICommand {
private static final Map<Player, Map<Integer, Consumer<Player>>> debugMenuFunctions = new HashMap<>();
public void execute(Player sender, String[] args) {
net.tylermurphy.hideAndSeek.configuration.Map map = Maps.getMap(args[0]);
dev.tylerm.khs.configuration.Map map = Maps.getMap(args[0]);
if(map == null) {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP"));
return;
}
Inventory debugMenu = createMenu(map, sender);
sender.openInventory(debugMenu);
}
private Inventory createMenu(net.tylermurphy.hideAndSeek.configuration.Map map, Player sender){
private Inventory createMenu(dev.tylerm.khs.configuration.Map map, Player sender){
Map<Integer, Consumer<Player>> functions = new HashMap<>();
Inventory debugMenu = Main.getInstance().getServer().createInventory(null, 9, "Debug Menu");
debugMenu.setItem(0, createOption(functions, 0, XMaterial.LEATHER_CHESTPLATE.parseMaterial(), "&6Become a &lHider", 1, player -> {
if(mapSaveEnabled) {
if(Config.mapSaveEnabled) {
if(map.getGameSpawn().getWorld() == null) map.getWorldLoader().loadMap();
}
Main.getInstance().getBoard().addHider(player);
PlayerLoader.loadHider(player, map);
if(Main.getInstance().getGame().getStatus() != Status.STARTING)
if(Main.getInstance().getGame().getStatus() != dev.tylerm.khs.game.util.Status.STARTING)
PlayerLoader.resetPlayer(player, Main.getInstance().getBoard());
}));
debugMenu.setItem(1, createOption(functions, 1, XMaterial.GOLDEN_CHESTPLATE.parseMaterial(), "&cBecome a &lSeeker", 1, player -> {
if(mapSaveEnabled) {
if(Config.mapSaveEnabled) {
if(map.getGameSpawn().getWorld() == null) map.getWorldLoader().loadMap();
}
Main.getInstance().getBoard().addSeeker(player);
PlayerLoader.loadSeeker(player, map);
if(Main.getInstance().getGame().getStatus() != Status.STARTING)
if(Main.getInstance().getGame().getStatus() != dev.tylerm.khs.game.util.Status.STARTING)
PlayerLoader.resetPlayer(player, Main.getInstance().getBoard());
}));
debugMenu.setItem(2, createOption(functions, 2, XMaterial.IRON_CHESTPLATE.parseMaterial(), "&8Become a &lSpectator", 1, player -> {
if(mapSaveEnabled) {
if(Config.mapSaveEnabled) {
if(map.getGameSpawn().getWorld() == null) map.getWorldLoader().loadMap();
}
Main.getInstance().getBoard().addSpectator(player);
@ -68,7 +67,7 @@ public class Debug implements ICommand {
debugMenu.setItem(3, createOption(functions, 3, XMaterial.BARRIER.parseMaterial(), "&cUnload from Game", 1, player -> {
Main.getInstance().getBoard().remove(player);
PlayerLoader.unloadPlayer(player);
exitPosition.teleport(player);
Config.exitPosition.teleport(player);
}));
debugMenu.setItem(4, createOption(functions, 4, XMaterial.BARRIER.parseMaterial(), "&cDie In Game", 2, player -> {
if((Main.getInstance().getBoard().isSeeker(player) || Main.getInstance().getBoard().isHider(player)) && Main.getInstance().getGame().getStatus() == Status.PLAYING){
@ -115,7 +114,7 @@ public class Debug implements ICommand {
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
return Maps.getAllMaps().stream().map(dev.tylerm.khs.configuration.Map::getName).collect(Collectors.toList());
}
return null;
}

View file

@ -1,8 +1,10 @@
package net.tylermurphy.hideAndSeek.command.map;
package dev.tylerm.khs.command.map;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@ -10,19 +12,16 @@ import java.util.Arrays;
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 GoTo implements ICommand {
public void execute(Player sender, String[] args) {
Map map = Maps.getMap(args[0]);
if(map == null) {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP"));
return;
}
if (map.isNotSetup()) {
sender.sendMessage(errorPrefix + message("MAP_NOT_SETUP").addAmount(map.getName()));
sender.sendMessage(Config.errorPrefix + Localization.message("MAP_NOT_SETUP").addAmount(map.getName()));
return;
}
switch (args[1].toLowerCase()) {
@ -33,9 +32,9 @@ public class GoTo implements ICommand {
case "seekerlobby":
map.getSeekerLobby().teleport(sender); break;
case "exit":
exitPosition.teleport(sender); break;
Config.exitPosition.teleport(sender); break;
default:
sender.sendMessage(errorPrefix + message("COMMAND_INVALID_ARG").addAmount(args[1].toLowerCase()));
sender.sendMessage(Config.errorPrefix + Localization.message("COMMAND_INVALID_ARG").addAmount(args[1].toLowerCase()));
}
}
@ -53,7 +52,7 @@ public class GoTo implements ICommand {
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList());
} else if(parameter.equals("spawn")) {
return Arrays.asList("spawn","lobby","seekerlobby","exit");
}

View file

@ -1,27 +1,25 @@
package net.tylermurphy.hideAndSeek.command.map;
package dev.tylerm.khs.command.map;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
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 List implements ICommand {
public void execute(Player sender, String[] args) {
Collection<Map> maps = Maps.getAllMaps();
if(maps.size() < 1) {
sender.sendMessage(errorPrefix + message("NO_MAPS"));
sender.sendMessage(Config.errorPrefix + Localization.message("NO_MAPS"));
return;
}
StringBuilder response = new StringBuilder(messagePrefix + message("LIST_MAPS"));
StringBuilder response = new StringBuilder(Config.messagePrefix + Localization.message("LIST_MAPS"));
for(Map map : maps) {
response.append("\n ").append(map.getName()).append(": ").append(map.isNotSetup() ? ChatColor.RED + "NOT SETUP" : ChatColor.GREEN + "SETUP").append(ChatColor.WHITE);
}

View file

@ -0,0 +1,52 @@
package dev.tylerm.khs.command.map;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.stream.Collectors;
public class Remove implements ICommand {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS"));
return;
}
Map map = Maps.getMap(args[0]);
if(map == null) {
sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP"));
} else if(!Maps.removeMap(args[0])){
sender.sendMessage(Config.errorPrefix + Localization.message("MAP_FAIL_DELETE").addAmount(args[0]));
} else {
sender.sendMessage(Config.messagePrefix + Localization.message("MAP_DELETED").addAmount(args[0]));
}
}
public String getLabel() {
return "remove";
}
public String getUsage() {
return "<map>";
}
public String getDescription() {
return "Remove a map from the plugin!";
}
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList());
}
return null;
}
}

View file

@ -1,10 +1,12 @@
package net.tylermurphy.hideAndSeek.command.map;
package dev.tylerm.khs.command.map;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@ -13,40 +15,37 @@ import org.jetbrains.annotations.NotNull;
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 Save implements ICommand {
public static boolean runningBackup = false;
public void execute(Player sender, String[] args) {
if (!mapSaveEnabled) {
sender.sendMessage(errorPrefix + message("MAPSAVE_DISABLED"));
if (!Config.mapSaveEnabled) {
sender.sendMessage(Config.errorPrefix + Localization.message("MAPSAVE_DISABLED"));
return;
}
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS"));
return;
}
Map map = Maps.getMap(args[0]);
if(map == null) {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP"));
return;
}
if (map.getSpawn().isNotSetup()) {
sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN"));
sender.sendMessage(Config.errorPrefix + Localization.message("ERROR_GAME_SPAWN"));
return;
}
if (map.isBoundsNotSetup()) {
sender.sendMessage(errorPrefix + message("ERROR_MAP_BOUNDS"));
sender.sendMessage(Config.errorPrefix + Localization.message("ERROR_MAP_BOUNDS"));
return;
}
sender.sendMessage(messagePrefix + message("MAPSAVE_START"));
sender.sendMessage(warningPrefix + message("MAPSAVE_WARNING"));
sender.sendMessage(Config.messagePrefix + Localization.message("MAPSAVE_START"));
sender.sendMessage(Config.warningPrefix + Localization.message("MAPSAVE_WARNING"));
World world = map.getSpawn().load();
if (world == null) {
sender.sendMessage(warningPrefix + message("MAPSAVE_FAIL_WORLD"));
sender.sendMessage(Config.warningPrefix + Localization.message("MAPSAVE_FAIL_WORLD"));
return;
}
world.save();
@ -76,7 +75,7 @@ public class Save implements ICommand {
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList());
}
return null;
}

View file

@ -1,58 +1,57 @@
package net.tylermurphy.hideAndSeek.command.map;
package dev.tylerm.khs.command.map;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
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 Status implements ICommand {
public void execute(Player sender, String[] args) {
String msg = message("SETUP").toString();
String msg = Localization.message("SETUP").toString();
int count = 0;
Map map = Maps.getMap(args[0]);
if(map == null) {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP"));
return;
}
if (map.getSpawn().getBlockX() == 0 && map.getSpawn().getBlockY() == 0 && map.getSpawn().getBlockZ() == 0 || !map.getSpawn().exists()) {
msg = msg + "\n" + message("SETUP_GAME");
msg = msg + "\n" + Localization.message("SETUP_GAME");
count++;
}
if (map.getLobby().getBlockX() == 0 && map.getLobby().getBlockY() == 0 && map.getLobby().getBlockZ() == 0 || !map.getLobby().exists()) {
msg = msg + "\n" + message("SETUP_LOBBY");
msg = msg + "\n" + Localization.message("SETUP_LOBBY");
count++;
}
if (map.getSeekerLobby().getBlockX() == 0 && map.getSeekerLobby().getBlockY() == 0 && map.getSeekerLobby().getBlockZ() == 0 || !map.getSeekerLobby().exists()) {
msg = msg + "\n" + message("SETUP_SEEKER_LOBBY");
msg = msg + "\n" + Localization.message("SETUP_SEEKER_LOBBY");
count++;
}
if (exitPosition.getBlockX() == 0 && exitPosition.getBlockY() == 0 && exitPosition.getBlockZ() == 0 || !exitPosition.exists()) {
msg = msg + "\n" + message("SETUP_EXIT");
if (Config.exitPosition.getBlockX() == 0 && Config.exitPosition.getBlockY() == 0 && Config.exitPosition.getBlockZ() == 0 || !Config.exitPosition.exists()) {
msg = msg + "\n" + Localization.message("SETUP_EXIT");
count++;
}
if (map.isBoundsNotSetup()) {
msg = msg + "\n" + message("SETUP_BOUNDS");
msg = msg + "\n" + Localization.message("SETUP_BOUNDS");
count++;
}
if (mapSaveEnabled && !map.getGameSpawn().exists()) {
msg = msg + "\n" + message("SETUP_SAVEMAP");
if (Config.mapSaveEnabled && !map.getGameSpawn().exists()) {
msg = msg + "\n" + Localization.message("SETUP_SAVEMAP");
count++;
}
if (map.isBlockHuntEnabled() && map.getBlockHunt().isEmpty()) {
msg = msg + "\n" + message("SETUP_BLOCKHUNT");
msg = msg + "\n" + Localization.message("SETUP_BLOCKHUNT");
count++;
}
if (count < 1) {
sender.sendMessage(messagePrefix + message("SETUP_COMPLETE"));
sender.sendMessage(Config.messagePrefix + Localization.message("SETUP_COMPLETE"));
} else {
sender.sendMessage(msg);
}
@ -72,7 +71,7 @@ public class Status implements ICommand {
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList());
}
return null;
}

View file

@ -1,10 +1,12 @@
package net.tylermurphy.hideAndSeek.command.map.blockhunt;
package dev.tylerm.khs.command.map.blockhunt;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@ -13,30 +15,26 @@ 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.messagePrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Enabled implements ICommand {
public void execute(Player sender, String[] args) {
if (!Main.getInstance().supports(9)) {
sender.sendMessage(errorPrefix + message("BLOCKHUNT_UNSUPPORTED"));
sender.sendMessage(Config.errorPrefix + Localization.message("BLOCKHUNT_UNSUPPORTED"));
return;
}
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS"));
return;
}
Map map = Maps.getMap(args[0]);
if(map == null) {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP"));
return;
}
boolean bool = Boolean.parseBoolean(args[1]);
map.setBlockhunt(bool, map.getBlockHunt());
Maps.setMap(map.getName(), map);
sender.sendMessage(messagePrefix + message("BLOCKHUNT_SET_TO")
sender.sendMessage(Config.messagePrefix + Localization.message("BLOCKHUNT_SET_TO")
.addAmount(bool ? ChatColor.GREEN + "true" : ChatColor.RED + "false") + ChatColor.WHITE);
}
@ -54,7 +52,7 @@ public class Enabled implements ICommand {
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList());
}
if(parameter.equals("bool")) {
return Arrays.asList("true", "false");

View file

@ -1,10 +1,12 @@
package net.tylermurphy.hideAndSeek.command.map.blockhunt.blocks;
package dev.tylerm.khs.command.map.blockhunt.blocks;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@ -13,40 +15,36 @@ 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.messagePrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Add implements ICommand {
public void execute(Player sender, String[] args) {
if (!Main.getInstance().supports(9)) {
sender.sendMessage(errorPrefix + message("BLOCKHUNT_UNSUPPORTED"));
sender.sendMessage(Config.errorPrefix + Localization.message("BLOCKHUNT_UNSUPPORTED"));
return;
}
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS"));
return;
}
Map map = Maps.getMap(args[0]);
if(map == null) {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP"));
return;
}
Material block;
try { block = Material.valueOf(args[1]); }
catch (IllegalArgumentException e) {
sender.sendMessage(errorPrefix + message("COMMAND_INVALID_ARG").addAmount(args[1]));
sender.sendMessage(Config.errorPrefix + Localization.message("COMMAND_INVALID_ARG").addAmount(args[1]));
return;
}
List<Material> blocks = map.getBlockHunt();
if(blocks.contains(block)) {
sender.sendMessage(errorPrefix + message("BLOCKHUNT_BLOCK_EXISTS").addAmount(args[1]));
sender.sendMessage(Config.errorPrefix + Localization.message("BLOCKHUNT_BLOCK_EXISTS").addAmount(args[1]));
}
blocks.add(block);
map.setBlockhunt(map.isBlockHuntEnabled(), blocks);
Maps.setMap(map.getName(), map);
sender.sendMessage(messagePrefix + message("BLOCKHUNT_BLOCK_ADDED").addAmount(args[1]));
sender.sendMessage(Config.messagePrefix + Localization.message("BLOCKHUNT_BLOCK_ADDED").addAmount(args[1]));
}
public String getLabel() {
@ -63,7 +61,7 @@ public class Add implements ICommand {
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList());
} else if(parameter.equals("block")) {
return Arrays.stream(Material.values())
.filter(Material::isBlock)

View file

@ -1,9 +1,11 @@
package net.tylermurphy.hideAndSeek.command.map.blockhunt.blocks;
package dev.tylerm.khs.command.map.blockhunt.blocks;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -11,28 +13,24 @@ import org.jetbrains.annotations.NotNull;
import java.util.stream.Collectors;
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 List implements ICommand {
public void execute(Player sender, String[] args) {
if (!Main.getInstance().supports(9)) {
sender.sendMessage(errorPrefix + message("BLOCKHUNT_UNSUPPORTED"));
sender.sendMessage(Config.errorPrefix + Localization.message("BLOCKHUNT_UNSUPPORTED"));
return;
}
Map map = Maps.getMap(args[0]);
if(map == null) {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP"));
return;
}
java.util.List<Material> blocks = map.getBlockHunt();
if(blocks.isEmpty()) {
sender.sendMessage(errorPrefix + message("NO_BLOCKS"));
sender.sendMessage(Config.errorPrefix + Localization.message("NO_BLOCKS"));
return;
}
StringBuilder response = new StringBuilder(messagePrefix + message("BLOCKHUNT_LIST_BLOCKS"));
StringBuilder response = new StringBuilder(Config.messagePrefix + Localization.message("BLOCKHUNT_LIST_BLOCKS"));
for(int i = 0; i < blocks.size(); i++) {
response.append(String.format("\n%s. %s", i, blocks.get(i).toString()));
}
@ -53,7 +51,7 @@ public class List implements ICommand {
public java.util.List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList());
}
return null;
}

View file

@ -1,10 +1,12 @@
package net.tylermurphy.hideAndSeek.command.map.blockhunt.blocks;
package dev.tylerm.khs.command.map.blockhunt.blocks;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@ -13,40 +15,36 @@ 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.messagePrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Remove implements ICommand {
public void execute(Player sender, String[] args) {
if (!Main.getInstance().supports(9)) {
sender.sendMessage(errorPrefix + message("BLOCKHUNT_UNSUPPORTED"));
sender.sendMessage(Config.errorPrefix + Localization.message("BLOCKHUNT_UNSUPPORTED"));
return;
}
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS"));
return;
}
Map map = Maps.getMap(args[0]);
if(map == null) {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP"));
return;
}
Material block;
try { block = Material.valueOf(args[1]); }
catch (IllegalArgumentException e) {
sender.sendMessage(errorPrefix + message("COMMAND_INVALID_ARG").addAmount(args[1]));
sender.sendMessage(Config.errorPrefix + Localization.message("COMMAND_INVALID_ARG").addAmount(args[1]));
return;
}
java.util.List<Material> blocks = map.getBlockHunt();
if(!blocks.contains(block)) {
sender.sendMessage(errorPrefix + message("BLOCKHUNT_BLOCK_DOESNT_EXIT").addAmount(args[1]));
sender.sendMessage(Config.errorPrefix + Localization.message("BLOCKHUNT_BLOCK_DOESNT_EXIT").addAmount(args[1]));
}
blocks.remove(block);
map.setBlockhunt(map.isBlockHuntEnabled(), blocks);
Maps.setMap(map.getName(), map);
sender.sendMessage(messagePrefix + message("BLOCKHUNT_BLOCK_REMOVED").addAmount(args[1]));
sender.sendMessage(Config.messagePrefix + Localization.message("BLOCKHUNT_BLOCK_REMOVED").addAmount(args[1]));
}
public String getLabel() {
@ -63,7 +61,7 @@ public class Remove implements ICommand {
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList());
} else if(parameter.equals("block")) {
return Arrays.stream(Material.values())
.filter(Material::isBlock)

View file

@ -0,0 +1,86 @@
package dev.tylerm.khs.command.map.set;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class Border implements ICommand {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS"));
return;
}
Map map = Maps.getMap(args[0]);
if(map == null) {
sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP"));
return;
}
if (map.getSpawn().isNotSetup()) {
sender.sendMessage(Config.errorPrefix + Localization.message("ERROR_GAME_SPAWN"));
return;
}
int num,delay,change;
try { num = Integer.parseInt(args[1]); } catch (Exception e) {
sender.sendMessage(Config.errorPrefix + Localization.message("WORLDBORDER_INVALID_INPUT").addAmount(args[0]));
return;
}
try { delay = Integer.parseInt(args[2]); } catch (Exception e) {
sender.sendMessage(Config.errorPrefix + Localization.message("WORLDBORDER_INVALID_INPUT").addAmount(args[1]));
return;
}
try { change = Integer.parseInt(args[3]); } catch (Exception e) {
sender.sendMessage(Config.errorPrefix + Localization.message("WORLDBORDER_INVALID_INPUT").addAmount(args[2]));
return;
}
if (num < 100) {
sender.sendMessage(Config.errorPrefix + Localization.message("WORLDBORDER_MIN_SIZE"));
return;
}
if (change < 1) {
sender.sendMessage(Config.errorPrefix + Localization.message("WORLDBORDER_CHANGE_SIZE"));
return;
}
map.setWorldBorderData(
sender.getLocation().getBlockX(),
sender.getLocation().getBlockZ(),
num,
delay,
change
);
Maps.setMap(map.getName(), map);
sender.sendMessage(Config.messagePrefix + Localization.message("WORLDBORDER_ENABLE").addAmount(num).addAmount(delay).addAmount(change));
map.getWorldBorder().resetWorldBorder();
}
public String getLabel() {
return "border";
}
public String getUsage() {
return "<map> <size> <delay> <move>";
}
public String getDescription() {
return "Sets a maps world border information";
}
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList());
}
return Collections.singletonList(parameter);
}
}

View file

@ -1,46 +1,45 @@
package net.tylermurphy.hideAndSeek.command.map.set;
package dev.tylerm.khs.command.map.set;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
import net.tylermurphy.hideAndSeek.util.Location;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import dev.tylerm.khs.game.util.Status;
import dev.tylerm.khs.util.Location;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
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 Bounds implements ICommand {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS"));
return;
}
Map map = Maps.getMap(args[0]);
if(map == null) {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP"));
return;
}
if (map.getSpawn().isNotSetup()) {
sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN"));
sender.sendMessage(Config.errorPrefix + Localization.message("ERROR_GAME_SPAWN"));
return;
}
if (map.getSeekerLobby().isNotSetup()) {
sender.sendMessage(errorPrefix + message("ERROR_GAME_SEEKER_SPAWN"));
sender.sendMessage(Config.errorPrefix + Localization.message("ERROR_GAME_SEEKER_SPAWN"));
return;
}
if (!sender.getWorld().getName().equals(map.getSpawnName())) {
sender.sendMessage(errorPrefix + message("BOUNDS_WRONG_WORLD"));
sender.sendMessage(Config.errorPrefix + Localization.message("BOUNDS_WRONG_WORLD"));
return;
}
if (sender.getLocation().getBlockX() == 0 || sender.getLocation().getBlockZ() == 0) {
sender.sendMessage(errorPrefix + message("NOT_AT_ZERO"));
sender.sendMessage(Config.errorPrefix + Localization.message("NOT_AT_ZERO"));
return;
}
boolean first = true;
@ -77,18 +76,18 @@ public class Bounds implements ICommand {
if(!map.getSpawn().isNotSetup()) {
if(map.getSpawn().isNotInBounds(bxs, bxl, bzs, bzl)) {
map.setSpawn(Location.getDefault());
sender.sendMessage(warningPrefix + message("WARN_SPAWN_RESET"));
sender.sendMessage(Config.warningPrefix + Localization.message("WARN_SPAWN_RESET"));
}
}
if(!map.getSeekerLobby().isNotSetup()) {
if(map.getSeekerLobby().isNotInBounds(bxs, bxl, bzs, bzl)) {
map.setSeekerLobby(Location.getDefault());
sender.sendMessage(warningPrefix + message("WARN_SEEKER_SPAWN_RESET"));
sender.sendMessage(Config.warningPrefix + Localization.message("WARN_SEEKER_SPAWN_RESET"));
}
}
}
Maps.setMap(map.getName(), map);
sender.sendMessage(messagePrefix + message("BOUNDS").addAmount(first ? 1 : 2));
sender.sendMessage(Config.messagePrefix + Localization.message("BOUNDS").addAmount(first ? 1 : 2));
}
public String getLabel() {
@ -105,7 +104,7 @@ public class Bounds implements ICommand {
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList());
}
return null;
}

View file

@ -1,10 +1,11 @@
package net.tylermurphy.hideAndSeek.command.map.set;
package dev.tylerm.khs.command.map.set;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.command.location.LocationUtils;
import net.tylermurphy.hideAndSeek.command.location.Locations;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.util.Location;
import dev.tylerm.khs.command.location.LocationUtils;
import dev.tylerm.khs.command.location.Locations;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import dev.tylerm.khs.util.Location;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@ -33,7 +34,7 @@ public class Lobby implements ICommand {
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList());
}
return null;
}

View file

@ -1,10 +1,11 @@
package net.tylermurphy.hideAndSeek.command.map.set;
package dev.tylerm.khs.command.map.set;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.command.location.LocationUtils;
import net.tylermurphy.hideAndSeek.command.location.Locations;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.util.Location;
import dev.tylerm.khs.command.location.LocationUtils;
import dev.tylerm.khs.command.location.Locations;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.*;
import dev.tylerm.khs.util.Location;
import dev.tylerm.khs.configuration.Maps;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
@ -12,25 +13,22 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;;
import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.warningPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class SeekerLobby implements ICommand {
public void execute(Player sender, String[] args) {
LocationUtils.setLocation(sender, Locations.SEEKER, args[0], map -> {
if(map.getSpawn().isNotSetup()) {
throw new RuntimeException(message("GAME_SPAWN_NEEDED").toString());
throw new RuntimeException(Localization.message("GAME_SPAWN_NEEDED").toString());
}
if(!map.getSpawnName().equals(sender.getLocation().getWorld().getName())) {
throw new RuntimeException(message("SEEKER_LOBBY_INVALID").toString());
throw new RuntimeException(Localization.message("SEEKER_LOBBY_INVALID").toString());
}
map.setSeekerLobby(Location.from(sender));
if(!map.isBoundsNotSetup()) {
Vector boundsMin = map.getBoundsMin();
Vector boundsMax = map.getBoundsMax();
if(map.getSeekerLobby().isNotInBounds(boundsMin.getBlockX(), boundsMax.getBlockX(), boundsMin.getBlockZ(), boundsMax.getBlockZ())) {
sender.sendMessage(warningPrefix + message("WARN_MAP_BOUNDS"));
sender.sendMessage(Config.warningPrefix + Localization.message("WARN_MAP_BOUNDS"));
}
}
});
@ -50,7 +48,7 @@ public class SeekerLobby implements ICommand {
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList());
}
return null;
}

View file

@ -1,10 +1,11 @@
package net.tylermurphy.hideAndSeek.command.map.set;
package dev.tylerm.khs.command.map.set;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.command.location.LocationUtils;
import net.tylermurphy.hideAndSeek.command.location.Locations;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.util.Location;
import dev.tylerm.khs.command.location.LocationUtils;
import dev.tylerm.khs.command.location.Locations;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.*;
import dev.tylerm.khs.util.Location;
import dev.tylerm.khs.configuration.Maps;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
@ -12,9 +13,6 @@ import org.jetbrains.annotations.NotNull;
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 Spawn implements ICommand {
public void execute(Player sender, String[] args) {
@ -22,7 +20,7 @@ public class Spawn implements ICommand {
if (map.isWorldBorderEnabled() &&
new Vector(sender.getLocation().getX(), 0, sender.getLocation().getZ()).distance(map.getWorldBorderPos()) > 100) {
sender.sendMessage(errorPrefix + message("WORLDBORDER_POSITION"));
sender.sendMessage(Config.errorPrefix + Localization.message("WORLDBORDER_POSITION"));
throw new RuntimeException("World border not enabled or not in valid position!");
}
@ -32,16 +30,16 @@ public class Spawn implements ICommand {
Vector boundsMin = map.getBoundsMin();
Vector boundsMax = map.getBoundsMax();
if(map.getSpawn().isNotInBounds(boundsMin.getBlockX(), boundsMax.getBlockX(), boundsMin.getBlockZ(), boundsMax.getBlockZ())) {
sender.sendMessage(warningPrefix + message("WARN_MAP_BOUNDS"));
sender.sendMessage(Config.warningPrefix + Localization.message("WARN_MAP_BOUNDS"));
}
}
if(map.getSeekerLobby().getWorld() != null && !map.getSeekerLobby().getWorld().equals(sender.getLocation().getWorld().getName())) {
sender.sendMessage(warningPrefix + message("SEEKER_LOBBY_SPAWN_RESET"));
sender.sendMessage(Config.warningPrefix + Localization.message("SEEKER_LOBBY_SPAWN_RESET"));
map.setSeekerLobby(Location.getDefault());
}
if (!sender.getLocation().getWorld().getName().equals(map.getSpawnName()) && mapSaveEnabled) {
if (!sender.getLocation().getWorld().getName().equals(map.getSpawnName()) && Config.mapSaveEnabled) {
map.getWorldLoader().unloadMap();
}
});
@ -61,7 +59,7 @@ public class Spawn implements ICommand {
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList());
}
return null;
}

View file

@ -0,0 +1,58 @@
package dev.tylerm.khs.command.map.unset;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.stream.Collectors;
public class Border implements ICommand {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS"));
return;
}
Map map = Maps.getMap(args[0]);
if(map == null) {
sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP"));
return;
}
if (map.getSpawn().isNotSetup()) {
sender.sendMessage(Config.errorPrefix + Localization.message("ERROR_GAME_SPAWN"));
return;
}
map.setWorldBorderData(0, 0, 0, 0, 0);
Config.addToConfig("worldBorder.enabled",false);
Config.saveConfig();
sender.sendMessage(Config.messagePrefix + Localization.message("WORLDBORDER_DISABLE"));
map.getWorldBorder().resetWorldBorder();
}
public String getLabel() {
return "border";
}
public String getUsage() {
return "<map>";
}
public String getDescription() {
return "Removes a maps world border information";
}
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList());
}
return null;
}
}

View file

@ -1,8 +1,10 @@
package net.tylermurphy.hideAndSeek.command.util;
package dev.tylerm.khs.command.util;
import net.tylermurphy.hideAndSeek.command.map.Save;
import net.tylermurphy.hideAndSeek.util.Pair;
import net.tylermurphy.hideAndSeek.util.Tuple;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.util.Pair;
import dev.tylerm.khs.util.Tuple;
import dev.tylerm.khs.command.map.Save;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;
@ -10,10 +12,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Config.permissionsRequired;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class CommandGroup {
private final Map<String, Object> commandRegister;
@ -63,25 +61,25 @@ public class CommandGroup {
String[] parameters = data.getRight();
if (Save.runningBackup) {
player.sendMessage(errorPrefix + message("MAPSAVE_INPROGRESS"));
player.sendMessage(Config.errorPrefix + Localization.message("MAPSAVE_INPROGRESS"));
return;
}
if (permissionsRequired && !player.hasPermission(permission)) {
player.sendMessage(errorPrefix + message("COMMAND_NOT_ALLOWED"));
if (Config.permissionsRequired && !player.hasPermission(permission)) {
player.sendMessage(Config.errorPrefix + Localization.message("COMMAND_NOT_ALLOWED"));
return;
}
int parameterCount = (int) Arrays.stream(command.getUsage().split(" ")).filter(p -> p.startsWith("<") && !p.startsWith("<*")).count();
if(parameters.length < parameterCount) {
player.sendMessage(errorPrefix + message("ARGUMENT_COUNT"));
player.sendMessage(Config.errorPrefix + Localization.message("ARGUMENT_COUNT"));
return;
}
try {
command.execute(player, parameters);
} catch (Exception e) {
player.sendMessage(errorPrefix + "An error has occurred.");
player.sendMessage(Config.errorPrefix + "An error has occurred.");
e.printStackTrace();
}
}
@ -122,10 +120,10 @@ public class CommandGroup {
Object object = commandRegister.get(handle);
if (object instanceof ICommand) {
ICommand command = (ICommand) object;
return !permissionsRequired || player.hasPermission(permission + "." + command.getLabel());
return !Config.permissionsRequired || player.hasPermission(permission + "." + command.getLabel());
} else if (object instanceof CommandGroup) {
CommandGroup group = (CommandGroup) object;
return !permissionsRequired || group.hasPermission(player, permission + "." + group.getLabel());
return !Config.permissionsRequired || group.hasPermission(player, permission + "." + group.getLabel());
}
return false;
})

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.command.util;
package dev.tylerm.khs.command.util;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

View file

@ -1,8 +1,10 @@
package net.tylermurphy.hideAndSeek.command.world;
package dev.tylerm.khs.command.world;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.util.Location;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.util.Location;
import dev.tylerm.khs.command.util.ICommand;
import org.bukkit.World;
import org.bukkit.WorldType;
import org.bukkit.entity.Player;
@ -12,16 +14,12 @@ import java.util.Arrays;
import java.util.Collections;
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 Create implements ICommand {
public void execute(Player sender, String[] args) {
List<String> worlds = Main.getInstance().getWorlds();
if(worlds.contains(args[0])) {
sender.sendMessage(errorPrefix + message("WORLD_EXISTS").addAmount(args[0]));
sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_EXISTS").addAmount(args[0]));
return;
}
WorldType type;
@ -44,16 +42,16 @@ public class Create implements ICommand {
environment = World.Environment.THE_END;
break;
default:
sender.sendMessage(errorPrefix + message("INVALID_WORLD_TYPE").addAmount(args[1]));
sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_WORLD_TYPE").addAmount(args[1]));
return;
}
Location temp = new Location(args[0], 0, 0, 0);
if (temp.load(type, environment) == null) {
sender.sendMessage(errorPrefix + message("WORLD_ADDED_FAILED"));
sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_ADDED_FAILED"));
} else {
sender.sendMessage(messagePrefix + message("WORLD_ADDED").addAmount(args[0]));
sender.sendMessage(Config.messagePrefix + Localization.message("WORLD_ADDED").addAmount(args[0]));
}
}

View file

@ -1,9 +1,11 @@
package net.tylermurphy.hideAndSeek.command.world;
package dev.tylerm.khs.command.world;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.Confirm;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.world.WorldLoader;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.Confirm;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.world.WorldLoader;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
@ -12,46 +14,42 @@ import org.jetbrains.annotations.NotNull;
import java.io.File;
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 Delete implements ICommand {
public void execute(Player sender, String[] args) {
java.util.List<String> worlds = Main.getInstance().getWorlds();
if(!worlds.contains(args[0])) {
sender.sendMessage(errorPrefix + message("WORLD_DOESNT_EXIST").addAmount(args[0]));
sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_DOESNT_EXIST").addAmount(args[0]));
return;
}
Confirm.Confirmation confirmation = new Confirm.Confirmation(args[0], world -> {
java.util.List<String> worlds_now = Main.getInstance().getWorlds();
if(!worlds_now.contains(world)) {
sender.sendMessage(errorPrefix + message("WORLD_DOESNT_EXIST").addAmount(world));
sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_DOESNT_EXIST").addAmount(world));
return;
}
World bukkit_world = Bukkit.getWorld(world);
if(bukkit_world != null && bukkit_world.getPlayers().size() > 0) {
sender.sendMessage(errorPrefix + message("WORLD_NOT_EMPTY"));
sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_NOT_EMPTY"));
return;
}
String path = Main.getInstance().getWorldContainer().getPath() + File.separator + world;
if (!Bukkit.getServer().unloadWorld(world, false)) {
sender.sendMessage(errorPrefix + message("WORLD_REMOVED_FAILED"));
sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_REMOVED_FAILED"));
return;
}
try {
WorldLoader.deleteDirectory(new File(path));
} catch (Exception e) {
sender.sendMessage(errorPrefix + message("WORLD_REMOVED_FAILED"));
sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_REMOVED_FAILED"));
return;
}
sender.sendMessage(messagePrefix + message("WORLD_REMOVED").addAmount(world));
sender.sendMessage(Config.messagePrefix + Localization.message("WORLD_REMOVED").addAmount(world));
});
Confirm.confirmations.put(sender.getUniqueId(), confirmation);
sender.sendMessage(messagePrefix + message("CONFIRMATION"));
sender.sendMessage(Config.messagePrefix + Localization.message("CONFIRMATION"));
}

View file

@ -1,25 +1,23 @@
package net.tylermurphy.hideAndSeek.command.world;
package dev.tylerm.khs.command.world;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.command.util.ICommand;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
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 List implements ICommand {
public void execute(Player sender, String[] args) {
java.util.List<String> worlds = Main.getInstance().getWorlds();
if(worlds.isEmpty()) {
sender.sendMessage(errorPrefix + message("NO_WORLDS"));
sender.sendMessage(Config.errorPrefix + Localization.message("NO_WORLDS"));
} else {
StringBuilder response = new StringBuilder(messagePrefix + message("LIST_WORLDS"));
StringBuilder response = new StringBuilder(Config.messagePrefix + Localization.message("LIST_WORLDS"));
for (String world : worlds) {
String status = ChatColor.GRAY + "NOT LOADED";
World bukkit_world = Bukkit.getWorld(world);

View file

@ -1,27 +1,26 @@
package net.tylermurphy.hideAndSeek.command.world;
package dev.tylerm.khs.command.world;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.util.Location;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.util.ICommand;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.configuration.Localization;
import dev.tylerm.khs.util.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
public class Tp implements ICommand {
public void execute(Player sender, String[] args) {
Location test = new Location(args[0], 0, 0,0);
if(!test.exists()) {
sender.sendMessage(errorPrefix + message("WORLD_DOESNT_EXIT"));
sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_DOESNT_EXIT"));
return;
}
World world = test.load();
if(world == null) {
sender.sendMessage(errorPrefix + message("WORLD_LOAD_FAILED"));
sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_LOAD_FAILED"));
return;
}
Location loc = new Location(world.getName(), world.getSpawnLocation());

View file

@ -1,11 +1,11 @@
package net.tylermurphy.hideAndSeek.configuration;
package dev.tylerm.khs.configuration;
import com.cryptomorin.xseries.XItemStack;
import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSound;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.game.util.CountdownDisplay;
import net.tylermurphy.hideAndSeek.util.Location;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.game.util.CountdownDisplay;
import dev.tylerm.khs.util.Location;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
@ -88,6 +88,7 @@ public class Config {
teleportItemPosition,
startingSeekerCount,
delayedRespawnDelay,
hidingTimer,
endGameDelay;
public static float
@ -200,6 +201,7 @@ public class Config {
dontRewardQuit = config.getBoolean("dontRewardQuit");
endGameDelay = Math.max(0,config.getInt("endGameDelay"));
gameOverTitle = config.getBoolean("gameOverTitle");
hidingTimer = Math.max(10, config.getInt("hidingTimer"));
try {
countdownDisplay = CountdownDisplay.valueOf(config.getString("hideCountdownDisplay"));

View file

@ -1,6 +1,6 @@
package net.tylermurphy.hideAndSeek.configuration;
package dev.tylerm.khs.configuration;
import net.tylermurphy.hideAndSeek.Main;
import dev.tylerm.khs.Main;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;

View file

@ -1,7 +1,7 @@
package net.tylermurphy.hideAndSeek.configuration;
package dev.tylerm.khs.configuration;
import com.cryptomorin.xseries.XItemStack;
import net.tylermurphy.hideAndSeek.Main;
import dev.tylerm.khs.Main;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
@ -33,28 +33,49 @@ public class Items {
SEEKER_CHEST = null;
SEEKER_LEGS = null;
SEEKER_BOOTS = null;
ConfigurationSection SeekerItems = manager.getConfigurationSection("items.seeker");
int i = 1;
while (true) {
for (int i = 0; i < 9; i++) {
ConfigurationSection section = SeekerItems.getConfigurationSection(String.valueOf(i));
if (section == null) break;
ItemStack item = createItem(section);
if (item == null) continue;
String loc = section.getString("location");
if (loc == null) {
SEEKER_ITEMS.add(item);
} else if (loc.equals("helmet")) {
SEEKER_HELM = item;
} else if (loc.equals("chestplate")) {
SEEKER_CHEST = item;
} else if (loc.equals("leggings")) {
SEEKER_LEGS = item;
} else if (loc.equals("boots")) {
SEEKER_BOOTS = item;
} else {
SEEKER_ITEMS.add(item);
if (section == null) {
SEEKER_ITEMS.add(null);
continue;
}
ItemStack item = createItem(section);
SEEKER_ITEMS.add(item);
}
ConfigurationSection SeekerHelmet = SeekerItems.getConfigurationSection("helmet");
if (SeekerHelmet != null) {
ItemStack item = createItem(SeekerHelmet);
if (item != null) {
SEEKER_HELM = item;
}
}
ConfigurationSection SeekerChestplate = SeekerItems.getConfigurationSection("chestplate");
if (SeekerChestplate != null) {
ItemStack item = createItem(SeekerChestplate);
if (item != null) {
SEEKER_CHEST = item;
}
}
ConfigurationSection SeekerLeggings = SeekerItems.getConfigurationSection("leggings");
if (SeekerLeggings != null) {
ItemStack item = createItem(SeekerLeggings);
if (item != null) {
SEEKER_LEGS = item;
}
}
ConfigurationSection SeekerBoots = SeekerItems.getConfigurationSection("boots");
if (SeekerBoots != null) {
ItemStack item = createItem(SeekerBoots);
if (item != null) {
SEEKER_BOOTS = item;
}
i++;
}
HIDER_ITEMS = new ArrayList<>();
@ -62,32 +83,55 @@ public class Items {
HIDER_CHEST = null;
HIDER_LEGS = null;
HIDER_BOOTS = null;
ConfigurationSection HiderItems = manager.getConfigurationSection("items.hider");
i = 1;
while (true) {
for (int i = 0; i < 9; i++) {
ConfigurationSection section = HiderItems.getConfigurationSection(String.valueOf(i));
if (section == null) break;
ItemStack item = createItem(section);
if (item == null) continue;
String loc = section.getString("location");
if (loc == null) {
HIDER_ITEMS.add(item);
} else if (loc.equals("helmet")) {
HIDER_HELM = item;
} else if (loc.equals("chestplate")) {
HIDER_CHEST = item;
} else if (loc.equals("leggings")) {
HIDER_LEGS = item;
} else if (loc.equals("boots")) {
HIDER_BOOTS = item;
} else {
HIDER_ITEMS.add(item);
if (section == null) {
HIDER_ITEMS.add(null);
continue;
}
i++;
ItemStack item = createItem(section);
HIDER_ITEMS.add(item);
}
ConfigurationSection HiderHelmet = HiderItems.getConfigurationSection("helmet");
if (HiderHelmet != null) {
ItemStack item = createItem(HiderHelmet);
if (item != null) {
HIDER_HELM = item;
}
}
ConfigurationSection HiderChestplate = HiderItems.getConfigurationSection("chestplate");
if (HiderChestplate != null) {
ItemStack item = createItem(HiderChestplate);
if (item != null) {
HIDER_CHEST = item;
}
}
ConfigurationSection HiderLeggings = HiderItems.getConfigurationSection("leggings");
if (HiderLeggings != null) {
ItemStack item = createItem(HiderLeggings);
if (item != null) {
HIDER_LEGS = item;
}
}
ConfigurationSection HiderBoots = HiderItems.getConfigurationSection("boots");
if (HiderBoots != null) {
ItemStack item = createItem(HiderBoots);
if (item != null) {
HIDER_BOOTS = item;
}
}
SEEKER_EFFECTS = new ArrayList<>();
ConfigurationSection SeekerEffects = manager.getConfigurationSection("effects.seeker");
i = 1;
int i = 1;
while (true) {
ConfigurationSection section = SeekerEffects.getConfigurationSection(String.valueOf(i));
if (section == null) break;
@ -135,7 +179,9 @@ public class Items {
if (material.equalsIgnoreCase("POTION") || material.equalsIgnoreCase("SPLASH_POTION") || material.equalsIgnoreCase("LINGERING_POTION"))
config.set("base-effect", String.format("%s,%s,%s", item.getString("type"), false, splash));
ItemStack stack = XItemStack.deserialize(config);
stack.setAmount(item.getInt("amount"));
int amt = item.getInt("amount");
if (amt < 1) amt = 1;
stack.setAmount(amt);
if (stack.getData().getItemType() == Material.AIR) return null;
return stack;
}
@ -162,7 +208,7 @@ public class Items {
}
private static boolean equals(ItemStack a, ItemStack b) {
if (a == null) {
if (a == null || b == null) {
return false;
} else if (a == b) {
return true;

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.configuration;
package dev.tylerm.khs.configuration;
import java.util.Collections;
import java.util.List;

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.configuration;
package dev.tylerm.khs.configuration;
import net.md_5.bungee.api.ChatColor;

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.configuration;
package dev.tylerm.khs.configuration;
import org.bukkit.entity.Entity;

View file

@ -1,26 +1,26 @@
package net.tylermurphy.hideAndSeek.configuration;
package dev.tylerm.khs.configuration;
import java.util.ArrayList;
import java.util.List;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.game.events.Border;
import net.tylermurphy.hideAndSeek.world.WorldLoader;
import net.tylermurphy.hideAndSeek.util.Location;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.game.events.Border;
import dev.tylerm.khs.util.Location;
import dev.tylerm.khs.world.WorldLoader;
import org.bukkit.*;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static dev.tylerm.khs.configuration.Config.*;
public class Map {
private final String name;
private Location
spawnPosition = Location.getDefault(),
lobbyPosition = Location.getDefault(),
seekerLobbyPosition = Location.getDefault();
private dev.tylerm.khs.util.Location
spawnPosition = dev.tylerm.khs.util.Location.getDefault(),
lobbyPosition = dev.tylerm.khs.util.Location.getDefault(),
seekerLobbyPosition = dev.tylerm.khs.util.Location.getDefault();
private int
xBoundMin = 0,
@ -51,15 +51,15 @@ public class Map {
this.worldLoader = new WorldLoader(this);
}
public void setSpawn(Location pos) {
public void setSpawn(dev.tylerm.khs.util.Location pos) {
this.spawnPosition = pos;
}
public void setLobby(Location pos) {
public void setLobby(dev.tylerm.khs.util.Location pos) {
this.lobbyPosition = pos;
}
public void setSeekerLobby(Location pos) {
public void setSeekerLobby(dev.tylerm.khs.util.Location pos) {
this.seekerLobbyPosition = pos;
}
@ -100,7 +100,7 @@ public class Map {
}
@NotNull
public Location getGameSpawn() {
public dev.tylerm.khs.util.Location getGameSpawn() {
if(mapSaveEnabled) {
return spawnPosition.changeWorld("hs_"+name);
} else {
@ -117,7 +117,7 @@ public class Map {
}
@NotNull
public Location getSpawn() {
public dev.tylerm.khs.util.Location getSpawn() {
return spawnPosition;
}
@ -127,7 +127,7 @@ public class Map {
}
@NotNull
public Location getLobby() {
public dev.tylerm.khs.util.Location getLobby() {
return lobbyPosition;
}
@ -137,7 +137,7 @@ public class Map {
}
@NotNull
public Location getSeekerLobby() {
public dev.tylerm.khs.util.Location getSeekerLobby() {
return seekerLobbyPosition;
}

View file

@ -1,10 +1,10 @@
package net.tylermurphy.hideAndSeek.configuration;
package dev.tylerm.khs.configuration;
import java.util.*;
import java.util.stream.Collectors;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.util.Location;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.util.Location;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;

View file

@ -1,6 +1,4 @@
package net.tylermurphy.hideAndSeek.database;
import static net.tylermurphy.hideAndSeek.configuration.Config.databaseType;
package dev.tylerm.khs.database;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@ -13,10 +11,11 @@ import java.util.UUID;
import com.google.common.io.ByteStreams;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.database.connections.DatabaseConnection;
import net.tylermurphy.hideAndSeek.database.connections.MySQLConnection;
import net.tylermurphy.hideAndSeek.database.connections.SQLiteConnection;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.configuration.Config;
import dev.tylerm.khs.database.connections.DatabaseConnection;
import dev.tylerm.khs.database.connections.MySQLConnection;
import dev.tylerm.khs.database.connections.SQLiteConnection;
public class Database {
@ -27,14 +26,14 @@ public class Database {
public Database(){
if(databaseType.equalsIgnoreCase("SQLITE")) {
if(Config.databaseType.equalsIgnoreCase("SQLITE")) {
Main.getInstance().getLogger().info("SQLITE database chosen");
connection = new SQLiteConnection();
} else if(databaseType.equalsIgnoreCase("MYSQL")) {
} else if(Config.databaseType.equalsIgnoreCase("MYSQL")) {
Main.getInstance().getLogger().info("MYSQL database chosen");
connection = new MySQLConnection();
} else {
throw new IllegalArgumentException("Invalid database type: " + databaseType);
throw new IllegalArgumentException("Invalid database type: " + Config.databaseType);
}
playerInfo = new GameDataTable(this);

View file

@ -17,12 +17,12 @@
*
*/
package net.tylermurphy.hideAndSeek.database;
package dev.tylerm.khs.database;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.database.util.PlayerInfo;
import net.tylermurphy.hideAndSeek.game.Board;
import net.tylermurphy.hideAndSeek.game.util.WinType;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.database.util.PlayerInfo;
import dev.tylerm.khs.game.Board;
import dev.tylerm.khs.game.util.WinType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

View file

@ -1,6 +1,6 @@
package net.tylermurphy.hideAndSeek.database;
package dev.tylerm.khs.database;
import net.tylermurphy.hideAndSeek.Main;
import dev.tylerm.khs.Main;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.io.BukkitObjectInputStream;
import org.bukkit.util.io.BukkitObjectOutputStream;

View file

@ -17,9 +17,9 @@
*
*/
package net.tylermurphy.hideAndSeek.database;
package dev.tylerm.khs.database;
import net.tylermurphy.hideAndSeek.database.util.LegacyPlayerInfo;
import dev.tylerm.khs.database.util.LegacyPlayerInfo;
import java.sql.Connection;
import java.sql.ResultSet;

View file

@ -17,9 +17,9 @@
*
*/
package net.tylermurphy.hideAndSeek.database;
package dev.tylerm.khs.database;
import net.tylermurphy.hideAndSeek.Main;
import dev.tylerm.khs.Main;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;

View file

@ -17,7 +17,7 @@
*
*/
package net.tylermurphy.hideAndSeek.database.connections;
package dev.tylerm.khs.database.connections;
import java.sql.Connection;
import java.sql.SQLException;

View file

@ -17,17 +17,16 @@
*
*/
package net.tylermurphy.hideAndSeek.database.connections;
package dev.tylerm.khs.database.connections;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import net.tylermurphy.hideAndSeek.Main;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.configuration.Config;
import java.sql.Connection;
import java.sql.SQLException;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
public class MySQLConnection implements DatabaseConnection {
private final HikariDataSource ds;
@ -36,20 +35,20 @@ public class MySQLConnection implements DatabaseConnection {
HikariConfig config = new HikariConfig();
Main.getInstance().getLogger().info("Database host: " + databaseHost);
Main.getInstance().getLogger().info("Database port: " + databasePort);
Main.getInstance().getLogger().info("Database user: " + databaseUser);
Main.getInstance().getLogger().info("Database host: " + Config.databaseHost);
Main.getInstance().getLogger().info("Database port: " + Config.databasePort);
Main.getInstance().getLogger().info("Database user: " + Config.databaseUser);
Main.getInstance().getLogger().info("Database pass: xxxxxxxxxxx");
Main.getInstance().getLogger().info("Database name: " + databaseName);
Main.getInstance().getLogger().info("Database name: " + Config.databaseName);
config.setDriverClassName(org.mariadb.jdbc.Driver.class.getName());
config.setJdbcUrl("jdbc:mariadb://"+databaseHost+":"+databasePort+"/"+databaseName.trim());
config.setJdbcUrl("jdbc:mariadb://"+ Config.databaseHost+":"+ Config.databasePort+"/"+ Config.databaseName.trim());
config.addDataSourceProperty("cachePrepStmts", "true");
config.addDataSourceProperty("prepStmtCacheSize", "250");
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
config.addDataSourceProperty("user", databaseUser);
config.addDataSourceProperty("password",databasePass);
config.addDataSourceProperty("user", Config.databaseUser);
config.addDataSourceProperty("password", Config.databasePass);
config.addDataSourceProperty("autoCommit", "true");
config.setAutoCommit(true);
config.setMaximumPoolSize(20);

View file

@ -17,9 +17,9 @@
*
*/
package net.tylermurphy.hideAndSeek.database.connections;
package dev.tylerm.khs.database.connections;
import net.tylermurphy.hideAndSeek.Main;
import dev.tylerm.khs.Main;
import org.sqlite.SQLiteConfig;
import java.io.File;

View file

@ -17,7 +17,7 @@
*
*/
package net.tylermurphy.hideAndSeek.database.util;
package dev.tylerm.khs.database.util;
public class LegacyPlayerInfo {

View file

@ -17,7 +17,7 @@
*
*/
package net.tylermurphy.hideAndSeek.database.util;
package dev.tylerm.khs.database.util;
import java.util.UUID;

View file

@ -1,10 +1,10 @@
package net.tylermurphy.hideAndSeek.game;
package dev.tylerm.khs.game;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.game.events.Border;
import net.tylermurphy.hideAndSeek.game.events.Glow;
import net.tylermurphy.hideAndSeek.game.events.Taunt;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.game.events.Border;
import dev.tylerm.khs.game.events.Glow;
import dev.tylerm.khs.game.events.Taunt;
import dev.tylerm.khs.game.util.Status;
import dev.tylerm.khs.Main;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@ -13,9 +13,9 @@ import org.bukkit.scoreboard.*;
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;
import static dev.tylerm.khs.configuration.Config.*;
import static dev.tylerm.khs.configuration.Leaderboard.*;
import static dev.tylerm.khs.configuration.Localization.message;
public class Board {
@ -230,7 +230,7 @@ public class Board {
}
public String getMapName() {
net.tylermurphy.hideAndSeek.configuration.Map map = Main.getInstance().getGame().getCurrentMap();
dev.tylerm.khs.configuration.Map map = Main.getInstance().getGame().getCurrentMap();
if(map == null) return "Invalid";
else return map.getName();
}

View file

@ -1,10 +1,10 @@
package net.tylermurphy.hideAndSeek.game;
package dev.tylerm.khs.game;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.*;
import static dev.tylerm.khs.configuration.Localization.message;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.game.util.Disguise;
import dev.tylerm.khs.game.util.Disguise;
import dev.tylerm.khs.configuration.Map;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.game;
package dev.tylerm.khs.game;
import static com.comphenix.protocol.PacketType.Play.Server.*;

View file

@ -17,19 +17,21 @@
*
*/
package net.tylermurphy.hideAndSeek.game;
package dev.tylerm.khs.game;
import com.cryptomorin.xseries.messages.ActionBar;
import com.cryptomorin.xseries.messages.Titles;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.events.Glow;
import net.tylermurphy.hideAndSeek.game.events.Taunt;
import net.tylermurphy.hideAndSeek.game.listener.RespawnHandler;
import net.tylermurphy.hideAndSeek.game.util.*;
import dev.tylerm.khs.game.events.Glow;
import dev.tylerm.khs.game.events.Taunt;
import dev.tylerm.khs.game.listener.RespawnHandler;
import dev.tylerm.khs.game.util.CountdownDisplay;
import dev.tylerm.khs.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import dev.tylerm.khs.game.util.WinType;
import org.bukkit.*;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@ -38,8 +40,8 @@ import org.bukkit.inventory.ItemStack;
import java.util.*;
import java.util.stream.Collectors;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.*;
import static dev.tylerm.khs.configuration.Localization.message;
public class Game {
@ -132,7 +134,7 @@ public class Game {
currentMap.getWorldBorder().resetWorldBorder();
if (gameLength > 0) gameTimer = gameLength;
status = Status.STARTING;
startingTimer = 30;
startingTimer = hidingTimer;
}
private void stop(WinType type) {

View file

@ -17,13 +17,13 @@
*
*/
package net.tylermurphy.hideAndSeek.game;
package dev.tylerm.khs.game;
import com.cryptomorin.xseries.messages.Titles;
import net.md_5.bungee.api.ChatColor;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.configuration.Items;
import net.tylermurphy.hideAndSeek.configuration.Map;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.configuration.Items;
import dev.tylerm.khs.configuration.Map;
import org.bukkit.GameMode;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
@ -33,8 +33,10 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.*;
import static dev.tylerm.khs.configuration.Items.HIDER_ITEMS;
import static dev.tylerm.khs.configuration.Items.SEEKER_ITEMS;
import static dev.tylerm.khs.configuration.Localization.message;
@SuppressWarnings("deprecation")
public class PlayerLoader {
@ -83,8 +85,10 @@ public class PlayerLoader {
loadPlayer(player);
if (board.isSeeker(player)) {
if (pvpEnabled) {
for(ItemStack item : Items.SEEKER_ITEMS)
player.getInventory().addItem(item);
for(int i = 0; i < 9; i++) {
if (SEEKER_ITEMS.get(i) == null) continue;
player.getInventory().setItem(i, SEEKER_ITEMS.get(i));
}
if (Items.SEEKER_HELM != null)
player.getInventory().setHelmet(Items.SEEKER_HELM);
if (Items.SEEKER_CHEST != null)
@ -98,8 +102,10 @@ public class PlayerLoader {
player.addPotionEffect(effect);
} else if (board.isHider(player)) {
if (pvpEnabled) {
for(ItemStack item : Items.HIDER_ITEMS)
player.getInventory().addItem(item);
for(int i = 0; i < 9; i++) {
if (HIDER_ITEMS.get(i) == null) continue;
player.getInventory().setItem(i, HIDER_ITEMS.get(i));
}
if (Items.HIDER_HELM != null)
player.getInventory().setHelmet(Items.HIDER_HELM);
if (Items.HIDER_CHEST != null)

View file

@ -1,10 +1,10 @@
package net.tylermurphy.hideAndSeek.game.events;
package dev.tylerm.khs.game.events;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.configuration.Map;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.configuration.Map;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.*;
import static dev.tylerm.khs.configuration.Localization.message;
public class Border {

View file

@ -1,17 +1,12 @@
package net.tylermurphy.hideAndSeek.game.events;
package dev.tylerm.khs.game.events;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.util.packet.EntityMetadataPacket;
import dev.tylerm.khs.util.packet.EntityMetadataPacket;
import dev.tylerm.khs.Main;
import org.bukkit.entity.Player;
import java.lang.reflect.InvocationTargetException;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static dev.tylerm.khs.configuration.Config.*;
public class Glow {

View file

@ -1,6 +1,6 @@
package net.tylermurphy.hideAndSeek.game.events;
package dev.tylerm.khs.game.events;
import net.tylermurphy.hideAndSeek.Main;
import dev.tylerm.khs.Main;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.World;
@ -13,9 +13,9 @@ import java.util.Optional;
import java.util.Random;
import java.util.UUID;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Config.tauntDelay;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.*;
import static dev.tylerm.khs.configuration.Config.tauntDelay;
import static dev.tylerm.khs.configuration.Localization.message;
public class Taunt {

View file

@ -1,16 +1,16 @@
package net.tylermurphy.hideAndSeek.game.listener;
package dev.tylerm.khs.game.listener;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import static net.tylermurphy.hideAndSeek.configuration.Config.blockedCommands;
import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.blockedCommands;
import static dev.tylerm.khs.configuration.Config.errorPrefix;
import static dev.tylerm.khs.configuration.Localization.message;
public class BlockedCommandHandler implements Listener {

View file

@ -1,6 +1,6 @@
package net.tylermurphy.hideAndSeek.game.listener;
package dev.tylerm.khs.game.listener;
import net.tylermurphy.hideAndSeek.Main;
import dev.tylerm.khs.Main;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;

View file

@ -1,11 +1,11 @@
package net.tylermurphy.hideAndSeek.game.listener;
package dev.tylerm.khs.game.listener;
import com.cryptomorin.xseries.XSound;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.game.Board;
import net.tylermurphy.hideAndSeek.game.Game;
import net.tylermurphy.hideAndSeek.game.PlayerLoader;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.game.Board;
import dev.tylerm.khs.game.Game;
import dev.tylerm.khs.game.PlayerLoader;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
@ -16,8 +16,8 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.*;
import static dev.tylerm.khs.configuration.Localization.message;
public class DamageHandler implements Listener {

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.game.listener;
package dev.tylerm.khs.game.listener;
import static com.comphenix.protocol.PacketType.Play.Client.*;
@ -8,15 +8,11 @@ import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.wrappers.EnumWrappers;
import com.comphenix.protocol.wrappers.WrappedEnumEntityUseAction;
import com.comphenix.protocol.wrappers.EnumWrappers.EntityUseAction;
import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.messages.ActionBar;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.game.util.Disguise;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.game.util.Disguise;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;

View file

@ -1,12 +1,11 @@
package net.tylermurphy.hideAndSeek.game.listener;
package dev.tylerm.khs.game.listener;
import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.messages.ActionBar;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.game.Board;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.game.Board;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.ChatColor;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -15,16 +14,15 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import java.util.ArrayList;
import java.util.List;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Config.glowPowerupItem;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.*;
import static dev.tylerm.khs.configuration.Config.glowPowerupItem;
import static dev.tylerm.khs.configuration.Localization.message;
@SuppressWarnings("deprecation")
public class InteractHandler implements Listener {

View file

@ -17,14 +17,14 @@
*
*/
package net.tylermurphy.hideAndSeek.game.listener;
package dev.tylerm.khs.game.listener;
import com.cryptomorin.xseries.XMaterial;
import net.tylermurphy.hideAndSeek.Main;
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;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.command.map.Debug;
import dev.tylerm.khs.configuration.Map;
import dev.tylerm.khs.configuration.Maps;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;

View file

@ -1,9 +1,9 @@
package net.tylermurphy.hideAndSeek.game.listener;
package dev.tylerm.khs.game.listener;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.configuration.Items;
import net.tylermurphy.hideAndSeek.game.PlayerLoader;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.configuration.Items;
import dev.tylerm.khs.game.PlayerLoader;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -14,8 +14,8 @@ import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.*;
import static dev.tylerm.khs.configuration.Localization.message;
public class JoinLeaveHandler implements Listener {
@ -83,12 +83,16 @@ public class JoinLeaveHandler implements Listener {
}
private void removeItems(Player player) {
for(ItemStack si : Items.SEEKER_ITEMS)
for(ItemStack i : player.getInventory().getContents())
for(ItemStack si : Items.SEEKER_ITEMS) {
if (si == null) continue;
for (ItemStack i : player.getInventory().getContents())
if (si.isSimilar(i)) player.getInventory().remove(i);
for(ItemStack hi : Items.HIDER_ITEMS)
for(ItemStack i : player.getInventory().getContents())
}
for(ItemStack hi : Items.HIDER_ITEMS) {
if (hi == null) continue;
for (ItemStack i : player.getInventory().getContents())
if (hi.isSimilar(i)) player.getInventory().remove(i);
}
}
}

View file

@ -1,9 +1,9 @@
package net.tylermurphy.hideAndSeek.game.listener;
package dev.tylerm.khs.game.listener;
import com.google.common.collect.Sets;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.game.listener.events.PlayerJumpEvent;
import dev.tylerm.khs.game.listener.events.PlayerJumpEvent;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.configuration.Map;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;

View file

@ -1,8 +1,8 @@
package net.tylermurphy.hideAndSeek.game.listener;
package dev.tylerm.khs.game.listener;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.configuration.Items;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.configuration.Items;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -13,8 +13,8 @@ import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.inventory.ItemStack;
import static net.tylermurphy.hideAndSeek.configuration.Config.dropItems;
import static net.tylermurphy.hideAndSeek.configuration.Config.regenHealth;
import static dev.tylerm.khs.configuration.Config.dropItems;
import static dev.tylerm.khs.configuration.Config.regenHealth;
public class PlayerHandler implements Listener {

View file

@ -1,6 +1,6 @@
package net.tylermurphy.hideAndSeek.game.listener;
package dev.tylerm.khs.game.listener;
import net.tylermurphy.hideAndSeek.Main;
import dev.tylerm.khs.Main;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;

View file

@ -1,7 +1,7 @@
package net.tylermurphy.hideAndSeek.game.listener;
package dev.tylerm.khs.game.listener;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.game.Board;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.game.Board;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;

View file

@ -17,7 +17,7 @@
*
*/
package net.tylermurphy.hideAndSeek.game.listener.events;
package dev.tylerm.khs.game.listener.events;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;

View file

@ -17,7 +17,7 @@
*
*/
package net.tylermurphy.hideAndSeek.game.util;
package dev.tylerm.khs.game.util;
public enum CountdownDisplay {
CHAT,

View file

@ -1,10 +1,10 @@
package net.tylermurphy.hideAndSeek.game.util;
package dev.tylerm.khs.game.util;
import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.messages.ActionBar;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.util.packet.BlockChangePacket;
import net.tylermurphy.hideAndSeek.util.packet.EntityTeleportPacket;
import dev.tylerm.khs.util.packet.BlockChangePacket;
import dev.tylerm.khs.util.packet.EntityTeleportPacket;
import dev.tylerm.khs.Main;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.game.util;
package dev.tylerm.khs.game.util;
public enum Status {

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.game.util;
package dev.tylerm.khs.game.util;
public enum WinType {

View file

@ -1,7 +1,7 @@
package net.tylermurphy.hideAndSeek.util;
package dev.tylerm.khs.util;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.world.VoidGenerator;
import dev.tylerm.khs.world.VoidGenerator;
import dev.tylerm.khs.Main;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.WorldCreator;
@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
import java.io.File;
import static net.tylermurphy.hideAndSeek.configuration.Config.spawnPatch;
import static dev.tylerm.khs.configuration.Config.spawnPatch;
public class Location {

View file

@ -1,11 +1,11 @@
package net.tylermurphy.hideAndSeek.util;
package dev.tylerm.khs.util;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.database.Database;
import net.tylermurphy.hideAndSeek.database.util.PlayerInfo;
import net.tylermurphy.hideAndSeek.game.Board;
import net.tylermurphy.hideAndSeek.game.util.Status;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.database.Database;
import dev.tylerm.khs.database.util.PlayerInfo;
import dev.tylerm.khs.game.Board;
import dev.tylerm.khs.game.util.Status;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
@ -14,8 +14,8 @@ import org.jetbrains.annotations.Nullable;
import java.util.Optional;
import java.util.UUID;
import static net.tylermurphy.hideAndSeek.configuration.Config.placeholderError;
import static net.tylermurphy.hideAndSeek.configuration.Config.placeholderNoData;
import static dev.tylerm.khs.configuration.Config.placeholderError;
import static dev.tylerm.khs.configuration.Config.placeholderNoData;
public class PAPIExpansion extends PlaceholderExpansion {

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.util;
package dev.tylerm.khs.util;
public class Pair<L, R> {

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.util;
package dev.tylerm.khs.util;
public class Tuple<L, C, R> {

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.util.packet;
package dev.tylerm.khs.util.packet;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.util.packet;
package dev.tylerm.khs.util.packet;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.wrappers.BlockPosition;

View file

@ -1,11 +1,11 @@
package net.tylermurphy.hideAndSeek.util.packet;
package dev.tylerm.khs.util.packet;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.wrappers.WrappedDataValue;
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
import net.tylermurphy.hideAndSeek.Main;
import dev.tylerm.khs.Main;
import org.bukkit.entity.Entity;
import org.jetbrains.annotations.NotNull;

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.util.packet;
package dev.tylerm.khs.util.packet;
import com.comphenix.protocol.PacketType;
import org.bukkit.entity.Entity;

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.world;
package dev.tylerm.khs.world;
import org.bukkit.Location;
import org.bukkit.World;

View file

@ -1,16 +1,17 @@
package net.tylermurphy.hideAndSeek.world;
package dev.tylerm.khs.world;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.configuration.Map;
import dev.tylerm.khs.Main;
import dev.tylerm.khs.configuration.Map;
import org.bukkit.Bukkit;
import org.bukkit.GameRule;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import java.io.*;
import java.nio.file.Files;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
import static dev.tylerm.khs.configuration.Config.*;
import static dev.tylerm.khs.configuration.Localization.message;
public class WorldLoader {

View file

@ -1,43 +0,0 @@
package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.command.location.LocationUtils;
import net.tylermurphy.hideAndSeek.command.location.Locations;
import net.tylermurphy.hideAndSeek.util.Location;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
public class SetExitLocation implements ICommand {
public void execute(Player sender, String[] args) {
LocationUtils.setLocation(sender, Locations.EXIT, null, map -> {
addToConfig("exit.x", sender.getLocation().getBlockX());
addToConfig("exit.y", sender.getLocation().getBlockY());
addToConfig("exit.z", sender.getLocation().getBlockZ());
addToConfig("exit.world", sender.getLocation().getWorld().getName());
exitPosition = Location.from(sender);
saveConfig();
});
}
public String getLabel() {
return "setexit";
}
public String getUsage() {
return "";
}
public String getDescription() {
return "Sets the plugins exit location";
}
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
return null;
}
}

View file

@ -1,54 +0,0 @@
package net.tylermurphy.hideAndSeek.command.map;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.stream.Collectors;
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 Remove implements ICommand {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
return;
}
Map map = Maps.getMap(args[0]);
if(map == null) {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
} else if(!Maps.removeMap(args[0])){
sender.sendMessage(errorPrefix + message("MAP_FAIL_DELETE").addAmount(args[0]));
} else {
sender.sendMessage(messagePrefix + message("MAP_DELETED").addAmount(args[0]));
}
}
public String getLabel() {
return "remove";
}
public String getUsage() {
return "<map>";
}
public String getDescription() {
return "Remove a map from the plugin!";
}
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
}
return null;
}
}

View file

@ -1,94 +0,0 @@
package net.tylermurphy.hideAndSeek.command.map.set;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.configuration.Map;
import net.tylermurphy.hideAndSeek.configuration.Maps;
import net.tylermurphy.hideAndSeek.game.util.Status;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Collections;
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 Border implements ICommand {
public void execute(Player sender, String[] args) {
if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
return;
}
Map map = Maps.getMap(args[0]);
if(map == null) {
sender.sendMessage(errorPrefix + message("INVALID_MAP"));
return;
}
if (map.getSpawn().isNotSetup()) {
sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN"));
return;
}
if (args.length < 4) {
map.setWorldBorderData(0, 0, 0, 0, 0);
addToConfig("worldBorder.enabled",false);
saveConfig();
sender.sendMessage(messagePrefix + message("WORLDBORDER_DISABLE"));
map.getWorldBorder().resetWorldBorder();
return;
}
int num,delay,change;
try { num = Integer.parseInt(args[1]); } catch (Exception e) {
sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[0]));
return;
}
try { delay = Integer.parseInt(args[2]); } catch (Exception e) {
sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[1]));
return;
}
try { change = Integer.parseInt(args[3]); } catch (Exception e) {
sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[2]));
return;
}
if (num < 100) {
sender.sendMessage(errorPrefix + message("WORLDBORDER_MIN_SIZE"));
return;
}
if (change < 1) {
sender.sendMessage(errorPrefix + message("WORLDBORDER_CHANGE_SIZE"));
return;
}
map.setWorldBorderData(
sender.getLocation().getBlockX(),
sender.getLocation().getBlockZ(),
num,
delay,
change
);
Maps.setMap(map.getName(), map);
sender.sendMessage(messagePrefix + message("WORLDBORDER_ENABLE").addAmount(num).addAmount(delay).addAmount(change));
map.getWorldBorder().resetWorldBorder();
}
public String getLabel() {
return "border";
}
public String getUsage() {
return "<map> <*size> <*delay> <*move>";
}
public String getDescription() {
return "Sets a maps world border information";
}
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
if(parameter.equals("map")) {
return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
}
return Collections.singletonList(parameter);
}
}

View file

@ -15,6 +15,10 @@ spawnPatch: false
# default: 1200 aka 20min
gameLength: 1200
# How long in seconds will the initial hiding period last, minimum is 10 seconds
# default: 30
hidingTimer: 30
# Announce join/leave/game over messages to people not playing the game
# default: true
announceMessagesToNonPlayers: true
@ -57,7 +61,7 @@ startingSeekerCount: 1
respawnAsSpectator: false
# If enabled, the game will go until no hiders are left. If the timer runs out all hiders left will be marked as winning.
# If disabled the game wll go until there is only one hider left. If the timer runs out, all hiders left win, if t here is one
# If disabled the game wll go until there is only one hider left. If the timer runs out, all hiders left win, if there is one
# hider left, all inital seekers win along with the last hider.
# default: true
waitTillNoneLeft: true
@ -65,7 +69,7 @@ waitTillNoneLeft: true
# By default, if the last hider or seeker quits the game, a win type of NONE is given, which doesnt mark anyone as winning. This can be
# used as a way to prevent players form quitting in a loop to get someone else points.
# default: true
dontRewardQuit: true
dontRewardQuit: false
# The amount of seconds the game will wait until the players are teleported to the lobby after a game over
# default: 5
@ -73,7 +77,7 @@ endGameDelay: 5
# Along with a chat message, display a title describing the gameover
# default: false
gameOverTitle: false
gameOverTitle: true
# This plugin by default functions as not tag to catch Hiders, but to pvp. All players are given weapons,
# and seekers slightly better weapons (this can be changed in items.yml). If you want, you can disable this

View file

@ -4,7 +4,7 @@
# If pvp is disabled in config.yml, only effects will be given to players.
items:
seeker:
'1':
'0':
material: DIAMOND_SWORD
amount: 1
enchantments:
@ -13,7 +13,7 @@ items:
unbreakable: true
lore:
- 'This is the seeker sword'
'2':
'1':
material: STICK
amount: 1
enchantments:
@ -22,8 +22,19 @@ items:
lore:
- 'It will launch people very far'
- 'Use wisely!'
'helmet':
material: LEATHER_HELMET
'chestplate':
material: LEATHER_CHESTPLATE
'leggings':
material: LEATHER_LEGGINGS
'boots':
material: LEATHER_BOOTS
enchantments:
feather_falling: 4
hider:
'1':
'0':
material: STONE_SWORD
amount: 1
enchantments:
@ -32,11 +43,11 @@ items:
unbreakable: true
lore:
- 'This is the hider sword'
'2':
'1':
material: SPLASH_POTION
amount: 1
type: REGEN
'3':
'2':
material: POTION
amount: 2
type: INSTANT_HEAL
@ -55,12 +66,6 @@ effects:
amplifier: 1
ambient: false
particles: false
'3':
type: SLOW_FALLING
duration: 1000000
amplifier: 1
ambient: false
particles: false
'4':
type: WATER_BREATHING
duration: 1000000

View file

@ -1,5 +1,5 @@
name: KenshinsHideAndSeek
main: net.tylermurphy.hideAndSeek.Main
main: dev.tylerm.khs.Main
version: 1.7.5
author: KenshinEto
load: STARTUP