1.7.5 rc1
This commit is contained in:
parent
1bcafe93a6
commit
dd9a6dfd88
15 changed files with 147 additions and 60 deletions
34
.project
Normal file
34
.project
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>KenshinsHideAndSeek</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
</natures>
|
||||||
|
<filteredResources>
|
||||||
|
<filter>
|
||||||
|
<id>1690577727676</id>
|
||||||
|
<name></name>
|
||||||
|
<type>30</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||||
|
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
</filteredResources>
|
||||||
|
</projectDescription>
|
2
pom.xml
2
pom.xml
|
@ -1,7 +1,7 @@
|
||||||
<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>
|
<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>net.tylermurphy</groupId>
|
||||||
<artifactId>KenshinsHideAndSeek</artifactId>
|
<artifactId>KenshinsHideAndSeek</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.5</version>
|
||||||
<name>Hide and Seek Plugin</name>
|
<name>Hide and Seek Plugin</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
|
@ -7,6 +7,7 @@ import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -33,19 +34,21 @@ public class Start implements ICommand {
|
||||||
sender.sendMessage(errorPrefix + message("START_MIN_PLAYERS").addAmount(minPlayers));
|
sender.sendMessage(errorPrefix + message("START_MIN_PLAYERS").addAmount(minPlayers));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String seekerName;
|
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
Main.getInstance().getGame().start();
|
Main.getInstance().getGame().start();
|
||||||
return;
|
return;
|
||||||
} else {
|
};
|
||||||
seekerName = args[0];
|
|
||||||
}
|
List<Player> initialSeekers = new ArrayList<>(args.length);
|
||||||
Player seeker = Bukkit.getPlayer(seekerName);
|
for (int i = 0; i < args.length; i++) {
|
||||||
if (seeker == null || !Main.getInstance().getBoard().contains(seeker)) {
|
Player seeker = Bukkit.getPlayer(args[i]);
|
||||||
sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(seekerName));
|
if (seeker == null || !Main.getInstance().getBoard().contains(seeker) || initialSeekers.contains(seeker)) {
|
||||||
return;
|
sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(args[i]));
|
||||||
}
|
return;
|
||||||
Main.getInstance().getGame().start(seeker);
|
}
|
||||||
|
}
|
||||||
|
Main.getInstance().getGame().start(initialSeekers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
|
@ -53,18 +56,15 @@ public class Start implements ICommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsage() {
|
public String getUsage() {
|
||||||
return "<*player>";
|
return "<*seekers...>";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return "Starts the game either with a random seeker or chosen one";
|
return "Starts the game either with a random set of seekers or a chosen list";
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
|
public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
|
||||||
if(parameter.equals("player")) {
|
return Main.getInstance().getBoard().getPlayers().stream().map(Player::getName).collect(Collectors.toList());
|
||||||
return Main.getInstance().getBoard().getPlayers().stream().map(Player::getName).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,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.4%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY, ChatColor.WHITE, ChatColor.GRAY) +
|
String.format("%s%sKenshin's Hide and Seek %s(%s1.7.5%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)
|
||||||
);
|
);
|
||||||
|
|
|
@ -62,8 +62,11 @@ public class Config {
|
||||||
allowNaturalCauses,
|
allowNaturalCauses,
|
||||||
saveInventory,
|
saveInventory,
|
||||||
delayedRespawn,
|
delayedRespawn,
|
||||||
|
dontRewardQuit,
|
||||||
spawnPatch,
|
spawnPatch,
|
||||||
dropItems,
|
dropItems,
|
||||||
|
respawnAsSpectator,
|
||||||
|
waitTillNoneLeft,
|
||||||
regenHealth;
|
regenHealth;
|
||||||
|
|
||||||
public static int
|
public static int
|
||||||
|
@ -82,6 +85,7 @@ public class Config {
|
||||||
lobbyItemStartPosition,
|
lobbyItemStartPosition,
|
||||||
flightToggleItemPosition,
|
flightToggleItemPosition,
|
||||||
teleportItemPosition,
|
teleportItemPosition,
|
||||||
|
startingSeekerCount,
|
||||||
delayedRespawnDelay;
|
delayedRespawnDelay;
|
||||||
|
|
||||||
public static float
|
public static float
|
||||||
|
@ -154,7 +158,9 @@ public class Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Lobby
|
//Lobby
|
||||||
minPlayers = Math.max(2, config.getInt("minPlayers"));
|
startingSeekerCount = Math.max(1, config.getInt("startingSeekerCount"));
|
||||||
|
waitTillNoneLeft = config.getBoolean("waitTillNoneLeft");
|
||||||
|
minPlayers = Math.max(1 + startingSeekerCount + (waitTillNoneLeft ? 0 : 1), config.getInt("minPlayers"));
|
||||||
countdown = Math.max(10, config.getInt("lobby.countdown"));
|
countdown = Math.max(10, config.getInt("lobby.countdown"));
|
||||||
changeCountdown = Math.max(minPlayers, config.getInt("lobby.changeCountdown"));
|
changeCountdown = Math.max(minPlayers, config.getInt("lobby.changeCountdown"));
|
||||||
lobbyMin = Math.max(minPlayers, config.getInt("lobby.min"));
|
lobbyMin = Math.max(minPlayers, config.getInt("lobby.min"));
|
||||||
|
@ -188,6 +194,9 @@ public class Config {
|
||||||
placeholderError = config.getString("placeholder.incorrect");
|
placeholderError = config.getString("placeholder.incorrect");
|
||||||
placeholderNoData = config.getString("placeholder.noData");
|
placeholderNoData = config.getString("placeholder.noData");
|
||||||
saveInventory = config.getBoolean("saveInventory");
|
saveInventory = config.getBoolean("saveInventory");
|
||||||
|
respawnAsSpectator = config.getBoolean("respawnAsSpectator");
|
||||||
|
dontRewardQuit = config.getBoolean("dontRewardQuit");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
countdownDisplay = CountdownDisplay.valueOf(config.getString("hideCountdownDisplay"));
|
countdownDisplay = CountdownDisplay.valueOf(config.getString("hideCountdownDisplay"));
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
|
|
|
@ -79,7 +79,6 @@ public class GameDataTable {
|
||||||
rs.getInt("seeker_deaths")
|
rs.getInt("seeker_deaths")
|
||||||
);
|
);
|
||||||
rs.close();
|
rs.close();
|
||||||
connection.close();
|
|
||||||
CACHE.put(uuid, info);
|
CACHE.put(uuid, info);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
@ -111,7 +110,6 @@ public class GameDataTable {
|
||||||
rs.getInt("seeker_deaths")
|
rs.getInt("seeker_deaths")
|
||||||
);
|
);
|
||||||
rs.close();
|
rs.close();
|
||||||
connection.close();
|
|
||||||
CACHE.put(uuid, info);
|
CACHE.put(uuid, info);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +143,6 @@ public class GameDataTable {
|
||||||
infoList.add(info);
|
infoList.add(info);
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
connection.close();
|
|
||||||
return infoList;
|
return infoList;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Main.getInstance().getLogger().severe("SQL Error: " + e.getMessage());
|
Main.getInstance().getLogger().severe("SQL Error: " + e.getMessage());
|
||||||
|
@ -190,8 +187,8 @@ public class GameDataTable {
|
||||||
database.encodeUUID(info.getUniqueId()),
|
database.encodeUUID(info.getUniqueId()),
|
||||||
info.getHiderWins() + (winners.contains(uuid) && type == WinType.HIDER_WIN ? 1 : 0),
|
info.getHiderWins() + (winners.contains(uuid) && type == WinType.HIDER_WIN ? 1 : 0),
|
||||||
info.getSeekerWins() + (winners.contains(uuid) && type == WinType.SEEKER_WIN ? 1 : 0),
|
info.getSeekerWins() + (winners.contains(uuid) && type == WinType.SEEKER_WIN ? 1 : 0),
|
||||||
info.getHiderGames() + (board.isHider(uuid) || (board.isSeeker(uuid) && !board.getFirstSeeker().getUniqueId().equals(uuid)) ? 1 : 0),
|
info.getHiderGames() + (board.isHider(uuid) || (board.isSeeker(uuid) && winners.contains(uuid)) ? 1 : 0),
|
||||||
info.getSeekerGames() + (board.getFirstSeeker().getUniqueId().equals(uuid) ? 1 : 0),
|
info.getSeekerGames() + (board.isSeeker(uuid) && winners.contains(uuid) ? 1 : 0),
|
||||||
info.getHiderKills() + hider_kills.getOrDefault(uuid, 0),
|
info.getHiderKills() + hider_kills.getOrDefault(uuid, 0),
|
||||||
info.getSeekerKills() + seeker_kills.getOrDefault(uuid, 0),
|
info.getSeekerKills() + seeker_kills.getOrDefault(uuid, 0),
|
||||||
info.getHiderDeaths() + hider_deaths.getOrDefault(uuid, 0),
|
info.getHiderDeaths() + hider_deaths.getOrDefault(uuid, 0),
|
||||||
|
|
|
@ -25,7 +25,6 @@ import net.tylermurphy.hideAndSeek.Main;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
|
||||||
|
|
||||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class SQLiteConnection implements DatabaseConnection {
|
||||||
public Connection connect() {
|
public Connection connect() {
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
try {
|
try {
|
||||||
String url = "jdbc:sqlite:"+databaseFile;
|
String url = "jdbc:sqlite:"+databaseFile.getPath();
|
||||||
conn = DriverManager.getConnection(url, config.toProperties());
|
conn = DriverManager.getConnection(url, config.toProperties());
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Main.getInstance().getLogger().severe(e.getMessage());
|
Main.getInstance().getLogger().severe(e.getMessage());
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class Board {
|
||||||
SPECTATOR,
|
SPECTATOR,
|
||||||
}
|
}
|
||||||
|
|
||||||
private UUID initialSeeker = null;
|
private List<UUID> initialSeekers = null;
|
||||||
private final Map<UUID, Type> Players = new HashMap<>();
|
private final Map<UUID, Type> Players = new HashMap<>();
|
||||||
private final Map<UUID, CustomBoard> customBoards = new HashMap<>();
|
private final Map<UUID, CustomBoard> customBoards = new HashMap<>();
|
||||||
private final Map<UUID, Integer> hider_kills = new HashMap<>(), seeker_kills = new HashMap<>(), hider_deaths = new HashMap<>(), seeker_deaths = new HashMap<>();
|
private final Map<UUID, Integer> hider_kills = new HashMap<>(), seeker_kills = new HashMap<>(), hider_deaths = new HashMap<>(), seeker_deaths = new HashMap<>();
|
||||||
|
@ -104,9 +104,15 @@ public class Board {
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getFirstSeeker() {
|
public void setInitialSeekers(List<UUID> seekers) {
|
||||||
if(initialSeeker == null) return null;
|
initialSeekers = seekers;
|
||||||
return Bukkit.getPlayer(initialSeeker);
|
}
|
||||||
|
|
||||||
|
public List<Player> getInitialSeekers() {
|
||||||
|
if(initialSeekers == null) return null;
|
||||||
|
return initialSeekers.stream().map(u -> {
|
||||||
|
return Bukkit.getPlayer(u);
|
||||||
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer(UUID uuid) {
|
public Player getPlayer(UUID uuid) {
|
||||||
|
@ -121,9 +127,6 @@ public class Board {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSeeker(Player player) {
|
public void addSeeker(Player player) {
|
||||||
if(initialSeeker == null) {
|
|
||||||
initialSeeker = player.getUniqueId();
|
|
||||||
}
|
|
||||||
Players.put(player.getUniqueId(), Type.SEEKER);
|
Players.put(player.getUniqueId(), Type.SEEKER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,7 +350,7 @@ public class Board {
|
||||||
|
|
||||||
public void cleanup() {
|
public void cleanup() {
|
||||||
Players.clear();;
|
Players.clear();;
|
||||||
initialSeeker = null;
|
initialSeekers = null;
|
||||||
customBoards.clear();
|
customBoards.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,22 +97,28 @@ public class Game {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
Player seeker;
|
List<Player> seekers = new ArrayList<>(startingSeekerCount);
|
||||||
try {
|
List<Player> pool = board.getPlayers();
|
||||||
int rand = (int) (Math.random() * board.getPlayers().size());
|
for (int i = 0; i < startingSeekerCount; i++) {
|
||||||
seeker = board.getPlayers().get(rand);
|
try {
|
||||||
} catch (Exception e){
|
int rand = new Random().nextInt(0, pool.size()-1);
|
||||||
Main.getInstance().getLogger().warning("Failed to select random seeker.");
|
seekers.add(pool.remove(rand));
|
||||||
return;
|
} catch (Exception e){
|
||||||
}
|
Main.getInstance().getLogger().warning("Failed to select random seeker.");
|
||||||
start(seeker);
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
start(seekers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start(Player seeker) {
|
public void start(List<Player> seekers) {
|
||||||
if (mapSaveEnabled) currentMap.getWorldLoader().rollback();
|
if (mapSaveEnabled) currentMap.getWorldLoader().rollback();
|
||||||
board.reload();
|
board.reload();
|
||||||
board.addSeeker(seeker);
|
board.setInitialSeekers(seekers.stream().map(Player::getUniqueId).collect(Collectors.toList()));
|
||||||
PlayerLoader.loadSeeker(seeker, currentMap);
|
seekers.forEach(seeker -> {
|
||||||
|
board.addSeeker(seeker);
|
||||||
|
PlayerLoader.loadSeeker(seeker, currentMap);
|
||||||
|
});
|
||||||
board.getPlayers().forEach(player -> {
|
board.getPlayers().forEach(player -> {
|
||||||
if(board.isSeeker(player)) return;
|
if(board.isSeeker(player)) return;
|
||||||
board.addHider(player);
|
board.addHider(player);
|
||||||
|
@ -133,7 +139,12 @@ public class Game {
|
||||||
Main.getInstance().getDatabase().getGameData().addWins(board, players, winners, board.getHiderKills(), board.getHiderDeaths(), board.getSeekerKills(), board.getSeekerDeaths(), type);
|
Main.getInstance().getDatabase().getGameData().addWins(board, players, winners, board.getHiderKills(), board.getHiderDeaths(), board.getSeekerKills(), board.getSeekerDeaths(), type);
|
||||||
} else if (type == WinType.SEEKER_WIN) {
|
} else if (type == WinType.SEEKER_WIN) {
|
||||||
List<UUID> winners = new ArrayList<>();
|
List<UUID> winners = new ArrayList<>();
|
||||||
winners.add(board.getFirstSeeker().getUniqueId());
|
board.getInitialSeekers().forEach(p -> {
|
||||||
|
winners.add(p.getUniqueId());
|
||||||
|
});
|
||||||
|
if (!waitTillNoneLeft && board.getHiders().size() == 1) {
|
||||||
|
winners.add(board.getHiders().get(0).getUniqueId());
|
||||||
|
}
|
||||||
Main.getInstance().getDatabase().getGameData().addWins(board, players, winners, board.getHiderKills(), board.getHiderDeaths(), board.getSeekerKills(), board.getSeekerDeaths(), type);
|
Main.getInstance().getDatabase().getGameData().addWins(board, players, winners, board.getHiderKills(), board.getHiderDeaths(), board.getSeekerKills(), board.getSeekerDeaths(), type);
|
||||||
}
|
}
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getInstance(), this::end, 5*20);
|
Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getInstance(), this::end, 5*20);
|
||||||
|
@ -351,8 +362,9 @@ public class Game {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkWinConditions() {
|
private void checkWinConditions() {
|
||||||
if (board.sizeHider() < 1) {
|
int hiderCount = board.sizeHider();
|
||||||
if (hiderLeft) {
|
if (hiderCount < 1 || (!waitTillNoneLeft && hiderCount < 2)) {
|
||||||
|
if (hiderLeft && dontRewardQuit) {
|
||||||
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_HIDERS_QUIT"));
|
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_HIDERS_QUIT"));
|
||||||
else broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_HIDERS_QUIT"));
|
else broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_HIDERS_QUIT"));
|
||||||
stop(WinType.NONE);
|
stop(WinType.NONE);
|
||||||
|
@ -364,7 +376,7 @@ public class Game {
|
||||||
} else if (board.sizeSeeker() < 1) {
|
} else if (board.sizeSeeker() < 1) {
|
||||||
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT"));
|
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT"));
|
||||||
else broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT"));
|
else broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT"));
|
||||||
stop(WinType.NONE);
|
stop(dontRewardQuit ? WinType.NONE : WinType.HIDER_WIN);
|
||||||
} else if (gameTimer < 1) {
|
} else if (gameTimer < 1) {
|
||||||
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_TIME"));
|
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_TIME"));
|
||||||
else broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_TIME"));
|
else broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_TIME"));
|
||||||
|
|
|
@ -67,6 +67,17 @@ public class PlayerLoader {
|
||||||
Titles.sendTitle(player, 10, 70, 20, ChatColor.GRAY + "" + ChatColor.BOLD + "SPECTATING", ChatColor.WHITE + message("SPECTATOR_SUBTITLE").toString());
|
Titles.sendTitle(player, 10, 70, 20, ChatColor.GRAY + "" + ChatColor.BOLD + "SPECTATING", ChatColor.WHITE + message("SPECTATOR_SUBTITLE").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void loadDeadHiderSpectator(Player player, Map map) {
|
||||||
|
map.getGameSpawn().teleport(player);
|
||||||
|
loadPlayer(player);
|
||||||
|
player.setAllowFlight(true);
|
||||||
|
player.setFlying(true);
|
||||||
|
player.setFallDistance(0.0F);
|
||||||
|
player.getInventory().setItem(flightToggleItemPosition, flightToggleItem);
|
||||||
|
player.getInventory().setItem(teleportItemPosition, teleportItem);
|
||||||
|
Main.getInstance().getBoard().getPlayers().forEach(otherPlayer -> otherPlayer.hidePlayer(player));
|
||||||
|
}
|
||||||
|
|
||||||
public static void resetPlayer(Player player, Board board){
|
public static void resetPlayer(Player player, Board board){
|
||||||
if(board.isSpectator(player)) return;
|
if(board.isSpectator(player)) return;
|
||||||
loadPlayer(player);
|
loadPlayer(player);
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class DamageHandler implements Listener {
|
||||||
// Reveal player if they are disguised
|
// Reveal player if they are disguised
|
||||||
Main.getInstance().getDisguiser().reveal(player);
|
Main.getInstance().getDisguiser().reveal(player);
|
||||||
// Teleport player to seeker spawn
|
// Teleport player to seeker spawn
|
||||||
if(delayedRespawn){
|
if(delayedRespawn && !respawnAsSpectator){
|
||||||
game.getCurrentMap().getGameSeekerLobby().teleport(player);
|
game.getCurrentMap().getGameSeekerLobby().teleport(player);
|
||||||
player.sendMessage(messagePrefix + message("RESPAWN_NOTICE").addAmount(delayedRespawnDelay));
|
player.sendMessage(messagePrefix + message("RESPAWN_NOTICE").addAmount(delayedRespawnDelay));
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.getInstance(), () -> {
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.getInstance(), () -> {
|
||||||
|
@ -117,10 +117,14 @@ public class DamageHandler implements Listener {
|
||||||
} else {
|
} else {
|
||||||
game.broadcastMessage(message("GAME_PLAYER_FOUND_BY").addPlayer(player).addPlayer(attacker).toString());
|
game.broadcastMessage(message("GAME_PLAYER_FOUND_BY").addPlayer(player).addPlayer(attacker).toString());
|
||||||
}
|
}
|
||||||
board.addSeeker(player);
|
if (respawnAsSpectator) {
|
||||||
|
board.addSpectator(player);
|
||||||
|
PlayerLoader.loadDeadHiderSpectator(player, game.getCurrentMap());
|
||||||
|
} else {
|
||||||
|
board.addSeeker(player);
|
||||||
|
PlayerLoader.resetPlayer(player, board);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//Reload player
|
|
||||||
PlayerLoader.resetPlayer(player, board);
|
|
||||||
board.reloadBoardTeams();
|
board.reloadBoardTeams();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class PAPIExpansion extends PlaceholderExpansion {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull String getVersion() {
|
public @NotNull String getVersion() {
|
||||||
return "1.4.3";
|
return "1.7.5";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -48,6 +48,24 @@ permissionsRequired: true
|
||||||
# default: 2
|
# default: 2
|
||||||
minPlayers: 2
|
minPlayers: 2
|
||||||
|
|
||||||
|
# Amount of initial seekers when game starts
|
||||||
|
# default: 1
|
||||||
|
startingSeekerCount: 1
|
||||||
|
|
||||||
|
# By default, when a HIDER dies they will join the SEEKER team. If enabled they will instead become a spectator
|
||||||
|
# default: false
|
||||||
|
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
|
||||||
|
# hider left, all inital seekers win along with the last hider.
|
||||||
|
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
|
||||||
|
|
||||||
# This plugin by default functions as not tag to catch Hiders, but to pvp. All players are given weapons,
|
# 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
|
# and seekers slightly better weapons (this can be changed in items.yml). If you want, you can disable this
|
||||||
# entire pvp functionality, and make Hiders get found on a single hit. Hiders would also not be able to fight
|
# entire pvp functionality, and make Hiders get found on a single hit. Hiders would also not be able to fight
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: KenshinsHideAndSeek
|
name: KenshinsHideAndSeek
|
||||||
main: net.tylermurphy.hideAndSeek.Main
|
main: net.tylermurphy.hideAndSeek.Main
|
||||||
version: 1.7.4
|
version: 1.7.5
|
||||||
author: KenshinEto
|
author: KenshinEto
|
||||||
load: STARTUP
|
load: STARTUP
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
|
|
Loading…
Reference in a new issue