1.7.0 beta 9

This commit is contained in:
Tyler Murphy 2022-11-21 23:47:04 -05:00
parent 934c04388d
commit fcc3764a14
13 changed files with 75 additions and 56 deletions

Binary file not shown.

22
pom.xml
View file

@ -4,10 +4,13 @@
<version>1.7.0</version> <version>1.7.0</version>
<name>Hide and Seek Plugin</name> <name>Hide and Seek Plugin</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build> <build>
<defaultGoal>clean install</defaultGoal> <defaultGoal>clean install</defaultGoal>
<sourceDirectory>src/main/java</sourceDirectory> <sourceDirectory>src/main/java</sourceDirectory>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -30,10 +33,6 @@
<pattern>com.zaxxer.hikari</pattern> <pattern>com.zaxxer.hikari</pattern>
<shadedPattern>net.tylermurphy.dependencies.hikari</shadedPattern> <shadedPattern>net.tylermurphy.dependencies.hikari</shadedPattern>
</relocation> </relocation>
<relocation>
<pattern>org.ibex.nestedvm</pattern>
<shadedPattern>net.tylermurphy.dependencies.nestedvm</shadedPattern>
</relocation>
</relocations> </relocations>
<artifactSet> <artifactSet>
<includes> <includes>
@ -58,7 +57,6 @@
<resource>META-INF/services/java.sql.Driver</resource> <resource>META-INF/services/java.sql.Driver</resource>
</transformer> </transformer>
</transformers> </transformers>
<minimizeJar>true</minimizeJar>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
@ -82,10 +80,10 @@
<id>spigot-repo</id> <id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/public/</url> <url>https://hub.spigotmc.org/nexus/content/repositories/public/</url>
</repository> </repository>
<!-- <repository>--> <repository>
<!-- <id>dmulloy2-repo</id>--> <id>dmulloy2-repo</id>
<!-- <url>https://repo.dmulloy2.net/repository/public/</url>--> <url>https://repo.dmulloy2.net/repository/public/</url>
<!-- </repository>--> </repository>
<repository> <repository>
<id>placeholderapi</id> <id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url> <url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
@ -109,8 +107,8 @@
<groupId>com.comphenix.protocol</groupId> <groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId> <artifactId>ProtocolLib</artifactId>
<version>4.4.0</version> <version>4.4.0</version>
<scope>system</scope> <!-- <scope>system</scope>-->
<systemPath>${project.basedir}/lib/ProtocolLib.jar</systemPath> <!-- <systemPath>${project.basedir}/lib/ProtocolLib.jar</systemPath>-->
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.xerial</groupId> <groupId>org.xerial</groupId>

View file

@ -5,22 +5,13 @@ package net.tylermurphy.hideAndSeek.command.location;
*/ */
public enum Locations { public enum Locations {
GAME("spawns.game"), GAME,
LOBBY("spawns.lobby"), LOBBY,
EXIT("spawns.exit"), EXIT,
SEEKER("spawns.seeker"); SEEKER;
private final String path;
Locations(String path) {
this.path = path;
}
public String message() { public String message() {
return this + "_SPAWN"; return this + "_SPAWN";
} }
public String path(String additive) {
return path + "." + additive;
}
} }

View file

@ -70,7 +70,7 @@ public class CommandGroup {
if (data == null) { if (data == null) {
player.sendMessage( player.sendMessage(
String.format("%s%sKenshin's Hide and Seek %s(%s1.7.0 BETA%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY, ChatColor.WHITE, ChatColor.GRAY) + String.format("%s%sKenshin's Hide and Seek %s(%s1.7.0%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY, ChatColor.WHITE, ChatColor.GRAY) +
String.format("%sAuthor: %s[KenshinEto]\n", ChatColor.GRAY, ChatColor.WHITE) + String.format("%sAuthor: %s[KenshinEto]\n", ChatColor.GRAY, ChatColor.WHITE) +
String.format("%sHelp Command: %s/hs %shelp", ChatColor.GRAY, ChatColor.AQUA, ChatColor.WHITE) String.format("%sHelp Command: %s/hs %shelp", ChatColor.GRAY, ChatColor.AQUA, ChatColor.WHITE)
); );

View file

@ -3,10 +3,9 @@ package net.tylermurphy.hideAndSeek.command.world;
import net.tylermurphy.hideAndSeek.Main; import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand; import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.util.Location; import net.tylermurphy.hideAndSeek.util.Location;
import org.bukkit.Bukkit; import org.bukkit.World;
import org.bukkit.WorldType; import org.bukkit.WorldType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Arrays; import java.util.Arrays;
@ -23,20 +22,35 @@ public class Create implements ICommand {
List<String> worlds = Main.getInstance().getWorlds(); List<String> worlds = Main.getInstance().getWorlds();
if(worlds.contains(args[0])) { if(worlds.contains(args[0])) {
sender.sendMessage(errorPrefix + message("WORLD_EXISTS").addAmount(args[0])); sender.sendMessage(errorPrefix + message("WORLD_EXISTS").addAmount(args[0]));
return;
} }
WorldType type; WorldType type;
if(args[1].equals("normal")) { World.Environment environment;
type = WorldType.NORMAL; switch (args[1]) {
} else if(args[1].equals("flat")) { case "normal":
type = WorldType.FLAT; type = WorldType.NORMAL;
} else { environment = World.Environment.NORMAL;
sender.sendMessage(errorPrefix + message("INVALID_WORLD_TYPE").addAmount(args[1])); break;
return; case "flat":
type = WorldType.FLAT;
environment = World.Environment.NORMAL;
break;
case "nether":
type = WorldType.NORMAL;
environment = World.Environment.NETHER;
break;
case "end":
type = WorldType.NORMAL;
environment = World.Environment.THE_END;
break;
default:
sender.sendMessage(errorPrefix + message("INVALID_WORLD_TYPE").addAmount(args[1]));
return;
} }
Location temp = new Location(args[0], 0, 0, 0); Location temp = new Location(args[0], 0, 0, 0);
if (temp.load(type) == null) { if (temp.load(type, environment) == null) {
sender.sendMessage(errorPrefix + message("WORLD_ADDED_FAILED")); sender.sendMessage(errorPrefix + message("WORLD_ADDED_FAILED"));
} else { } else {
sender.sendMessage(messagePrefix + message("WORLD_ADDED").addAmount(args[0])); sender.sendMessage(messagePrefix + message("WORLD_ADDED").addAmount(args[0]));
@ -61,7 +75,7 @@ public class Create implements ICommand {
return Collections.singletonList("name"); return Collections.singletonList("name");
} }
if(parameter.equals("type")) { if(parameter.equals("type")) {
return Arrays.asList("normal", "flat"); return Arrays.asList("normal", "flat", "nether", "end");
} }
return null; return null;
} }

View file

@ -22,12 +22,14 @@ public class Delete implements ICommand {
java.util.List<String> worlds = Main.getInstance().getWorlds(); java.util.List<String> worlds = Main.getInstance().getWorlds();
if(!worlds.contains(args[0])) { if(!worlds.contains(args[0])) {
sender.sendMessage(errorPrefix + message("WORLD_DOESNT_EXIST").addAmount(args[0])); sender.sendMessage(errorPrefix + message("WORLD_DOESNT_EXIST").addAmount(args[0]));
return;
} }
Confirm.Confirmation confirmation = new Confirm.Confirmation(args[0], world -> { Confirm.Confirmation confirmation = new Confirm.Confirmation(args[0], world -> {
java.util.List<String> worlds_now = Main.getInstance().getWorlds(); java.util.List<String> worlds_now = Main.getInstance().getWorlds();
if(!worlds_now.contains(world)) { if(!worlds_now.contains(world)) {
sender.sendMessage(errorPrefix + message("WORLD_DOESNT_EXIST").addAmount(world)); sender.sendMessage(errorPrefix + message("WORLD_DOESNT_EXIST").addAmount(world));
return;
} }
World bukkit_world = Bukkit.getWorld(world); World bukkit_world = Bukkit.getWorld(world);
if(bukkit_world != null && bukkit_world.getPlayers().size() > 0) { if(bukkit_world != null && bukkit_world.getPlayers().size() > 0) {

View file

@ -4,6 +4,7 @@ import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand; import net.tylermurphy.hideAndSeek.command.util.ICommand;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -20,8 +21,18 @@ public class List implements ICommand {
} else { } else {
StringBuilder response = new StringBuilder(messagePrefix + message("LIST_WORLDS")); StringBuilder response = new StringBuilder(messagePrefix + message("LIST_WORLDS"));
for (String world : worlds) { for (String world : worlds) {
boolean loaded = Bukkit.getWorld(world) != null; String status = ChatColor.GRAY + "NOT LOADED";
response.append("\n ").append(world).append(": ").append(loaded ? ChatColor.GREEN + "LOADED" : ChatColor.YELLOW + "NOT LOADED").append(ChatColor.WHITE); World bukkit_world = Bukkit.getWorld(world);
if(bukkit_world != null) {
if(bukkit_world.getEnvironment() == World.Environment.NETHER) {
status = ChatColor.RED + "NETHER";
} else if(bukkit_world.getEnvironment() == World.Environment.THE_END) {
status = ChatColor.YELLOW + "THE END";
} else {
status = ChatColor.GREEN + bukkit_world.getWorldType().toString();
}
}
response.append("\n ").append(world).append(": ").append(status).append(ChatColor.WHITE);
} }
sender.sendMessage(response.toString()); sender.sendMessage(response.toString());
} }

View file

@ -126,6 +126,7 @@ public class ConfigManager {
return config.contains(path); return config.contains(path);
} }
@SuppressWarnings("unused")
public double getDouble(String path) { public double getDouble(String path) {
if (!config.contains(path)) { if (!config.contains(path)) {
return defaultConfig.getDouble(path); return defaultConfig.getDouble(path);
@ -190,10 +191,6 @@ public class ConfigManager {
config.set(path, defaultConfig.get(path)); config.set(path, defaultConfig.get(path));
} }
public void resetAll() {
config = new YamlConfiguration();
}
public void resetFile(String newDefaultFilename) { public void resetFile(String newDefaultFilename) {
this.defaultFilename = newDefaultFilename; this.defaultFilename = newDefaultFilename;

View file

@ -268,7 +268,7 @@ public class Board {
board.setLine(String.valueOf(i), line.replace("{TEAM}", value)); board.setLine(String.valueOf(i), line.replace("{TEAM}", value));
} else if (line.contains("{BORDER}")) { } else if (line.contains("{BORDER}")) {
if (!Main.getInstance().getGame().getCurrentMap().isWorldBorderEnabled()) continue; if (!Main.getInstance().getGame().getCurrentMap().isWorldBorderEnabled()) continue;
if (worldBorder == null || status == Status.STARTING) { if (status == Status.STARTING) {
board.setLine(String.valueOf(i), line.replace("{BORDER}", BORDER_COUNTING.replace("{AMOUNT}", "0"))); board.setLine(String.valueOf(i), line.replace("{BORDER}", BORDER_COUNTING.replace("{AMOUNT}", "0")));
} else if (!worldBorder.isRunning()) { } else if (!worldBorder.isRunning()) {
board.setLine(String.valueOf(i), line.replace("{BORDER}", BORDER_COUNTING.replaceFirst("\\{AMOUNT}", worldBorder.getDelay()/60+"").replaceFirst("\\{AMOUNT}", worldBorder.getDelay()%60+""))); board.setLine(String.valueOf(i), line.replace("{BORDER}", BORDER_COUNTING.replaceFirst("\\{AMOUNT}", worldBorder.getDelay()/60+"").replaceFirst("\\{AMOUNT}", worldBorder.getDelay()%60+"")));

View file

@ -97,13 +97,15 @@ public class Game {
} }
public void start() { public void start() {
Player seeker;
try { try {
int rand = (int) (Math.random() * board.getPlayers().size()); int rand = (int) (Math.random() * board.getPlayers().size());
Player seeker = board.getPlayers().get(rand); seeker = board.getPlayers().get(rand);
start(seeker);
} catch (Exception e){ } catch (Exception e){
Main.getInstance().getLogger().warning("Failed to select random seeker."); Main.getInstance().getLogger().warning("Failed to select random seeker.");
return;
} }
start(seeker);
} }
public void start(Player seeker) { public void start(Player seeker) {

View file

@ -2,7 +2,6 @@ package net.tylermurphy.hideAndSeek.game.listener;
import net.tylermurphy.hideAndSeek.Main; import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.configuration.Items; import net.tylermurphy.hideAndSeek.configuration.Items;
import net.tylermurphy.hideAndSeek.game.Game;
import net.tylermurphy.hideAndSeek.game.util.Status; import net.tylermurphy.hideAndSeek.game.util.Status;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;

View file

@ -51,7 +51,7 @@ public class Location {
this.z = location.getZ(); this.z = location.getZ();
} }
public World load(WorldType type) { public World load(WorldType type, World.Environment environment) {
boolean mapSave = world.startsWith("hs_"); boolean mapSave = world.startsWith("hs_");
World bukkitWorld = Bukkit.getWorld(world); World bukkitWorld = Bukkit.getWorld(world);
if(bukkitWorld != null) return bukkitWorld; if(bukkitWorld != null) return bukkitWorld;
@ -59,6 +59,9 @@ public class Location {
if(type != null) { if(type != null) {
creator.type(type); creator.type(type);
} }
if(environment != null) {
creator.environment(environment);
}
if(mapSave) { if(mapSave) {
creator.generator(new VoidGenerator()); creator.generator(new VoidGenerator());
} }
@ -69,7 +72,7 @@ public class Location {
public World load() { public World load() {
if(!exists()) return null; if(!exists()) return null;
if(!Main.getInstance().isLoaded()) return null; if(!Main.getInstance().isLoaded()) return null;
return load(null); return load(null, null);
} }
private org.bukkit.Location toBukkit() { private org.bukkit.Location toBukkit() {

View file

@ -60,13 +60,15 @@ public class WorldLoader {
} }
public void loadMap() { public void loadMap() {
Bukkit.getServer().createWorld(new WorldCreator(map.getGameSpawnName()).generator(new VoidGenerator())); Main.getInstance().scheduleTask(() -> {
World world = Bukkit.getServer().getWorld(map.getGameSpawnName()); Bukkit.getServer().createWorld(new WorldCreator(map.getGameSpawnName()).generator(new VoidGenerator()));
if (world == null) { World world = Bukkit.getServer().getWorld(map.getGameSpawnName());
Main.getInstance().getLogger().severe("COULD NOT LOAD " + map.getGameSpawnName()); if (world == null) {
return; Main.getInstance().getLogger().severe("COULD NOT LOAD " + map.getGameSpawnName());
} return;
world.setAutoSave(false); }
world.setAutoSave(false);
});
} }
public void rollback() { public void rollback() {