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

View file

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

View file

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

View file

@ -22,12 +22,14 @@ public class Delete implements ICommand {
java.util.List<String> worlds = Main.getInstance().getWorlds();
if(!worlds.contains(args[0])) {
sender.sendMessage(errorPrefix + 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));
return;
}
World bukkit_world = Bukkit.getWorld(world);
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 org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@ -20,8 +21,18 @@ public class List implements ICommand {
} else {
StringBuilder response = new StringBuilder(messagePrefix + message("LIST_WORLDS"));
for (String world : worlds) {
boolean loaded = Bukkit.getWorld(world) != null;
response.append("\n ").append(world).append(": ").append(loaded ? ChatColor.GREEN + "LOADED" : ChatColor.YELLOW + "NOT LOADED").append(ChatColor.WHITE);
String status = ChatColor.GRAY + "NOT LOADED";
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());
}

View file

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

View file

@ -268,7 +268,7 @@ public class Board {
board.setLine(String.valueOf(i), line.replace("{TEAM}", value));
} else if (line.contains("{BORDER}")) {
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")));
} else if (!worldBorder.isRunning()) {
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() {
Player seeker;
try {
int rand = (int) (Math.random() * board.getPlayers().size());
Player seeker = board.getPlayers().get(rand);
start(seeker);
seeker = board.getPlayers().get(rand);
} catch (Exception e){
Main.getInstance().getLogger().warning("Failed to select random seeker.");
return;
}
start(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.configuration.Items;
import net.tylermurphy.hideAndSeek.game.Game;
import net.tylermurphy.hideAndSeek.game.util.Status;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;

View file

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

View file

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