Merge pull request #25 from tylermurphy534/1.4.2

1.4.2
This commit is contained in:
Tyler Murphy 2022-04-28 16:02:01 -04:00 committed by GitHub
commit 52d6f450ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 265 additions and 95 deletions

View file

@ -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>
<groupId>net.tylermurphy</groupId>
<artifactId>HideAndSeek</artifactId>
<version>1.4.1</version>
<version>1.4.2</version>
<name>Hide and Seek Plugin</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View file

@ -29,7 +29,9 @@ import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.messaging.PluginMessageListener;
import org.bukkit.scheduler.BukkitTask;
import net.tylermurphy.hideAndSeek.game.CommandHandler;
@ -70,10 +72,13 @@ public class Main extends JavaPlugin implements Listener {
e.printStackTrace();
}
},0,1).getTaskId();
Bukkit.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
}
public void onDisable() {
Main.plugin.getServer().getScheduler().cancelTask(onTickTask);
Bukkit.getServer().getMessenger().unregisterOutgoingPluginChannel(this);
UUIDFetcher.cleanup();
Board.cleanup();
}

View file

@ -26,7 +26,7 @@ public class About implements ICommand {
public void execute(CommandSender sender, String[] args) {
sender.sendMessage(
String.format("%s%sHide and Seek %s(%s1.4.1%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) +
String.format("%s%sHide and Seek %s(%s1.4.2%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

@ -47,17 +47,7 @@ public class Leave implements ICommand {
sender.sendMessage(errorPrefix + message("GAME_NOT_INGAME"));
return;
}
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + message("GAME_LEAVE").addPlayer(player));
else Game.broadcastMessage(messagePrefix + message("GAME_LEAVE").addPlayer(player));
Board.removeBoard(player);
Board.remove(player);
player.teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ()));
if(Game.status == Status.STANDBY) {
Board.reloadLobbyBoards();
} else {
Board.reloadGameBoards();
Board.reloadBoardTeams();
}
Game.leave(player);
}
public String getLabel() {

View file

@ -40,7 +40,7 @@ public class SetBorder implements ICommand {
sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN"));
return;
}
if(args.length < 2) {
if(args.length < 3) {
worldborderEnabled = false;
addToConfig("worldBorder.enabled",false);
saveConfig();
@ -48,7 +48,7 @@ public class SetBorder implements ICommand {
Game.resetWorldborder(spawnWorld);
return;
}
int num,delay;
int num,delay,change;
try { num = Integer.parseInt(args[0]); } catch (Exception e) {
sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[0]));
return;
@ -57,10 +57,18 @@ public class SetBorder implements ICommand {
sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[1]));
return;
}
try { change = Integer.parseInt(args[2]); } 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;
}
Vector newWorldborderPosition = new Vector();
Player player = (Player) sender;
newWorldborderPosition.setX(player.getLocation().getBlockX());
@ -73,12 +81,14 @@ public class SetBorder implements ICommand {
worldborderPosition = newWorldborderPosition;
worldborderSize = num;
worldborderDelay = delay;
worldborderChange = change;
worldborderEnabled = true;
addToConfig("worldBorder.x", worldborderPosition.getBlockX());
addToConfig("worldBorder.z", worldborderPosition.getBlockZ());
addToConfig("worldBorder.delay", worldborderDelay);
addToConfig("worldBorder.size", worldborderSize);
addToConfig("worldBorder.enabled", true);
addToConfig("worldBorder.move", worldborderChange);
sender.sendMessage(messagePrefix + message("WORLDBORDER_ENABLE").addAmount(num).addAmount(delay));
saveConfig();
Game.resetWorldborder(spawnWorld);
@ -89,7 +99,7 @@ public class SetBorder implements ICommand {
}
public String getUsage() {
return "<size> <delay>";
return "<size> <delay> <move>";
}
public String getDescription() {

View file

@ -19,9 +19,14 @@
package net.tylermurphy.hideAndSeek.configuration;
import com.cryptomorin.xseries.XItemStack;
import com.cryptomorin.xseries.XMaterial;
import net.tylermurphy.hideAndSeek.util.Version;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import java.util.ArrayList;
@ -44,7 +49,8 @@ public class Config {
spawnWorld,
exitWorld,
lobbyWorld,
locale;
locale,
leaveServer;
public static Vector
spawnPosition,
@ -66,13 +72,16 @@ public class Config {
autoJoin,
teleportToExit,
lobbyCountdownEnabled,
seekerPing;
seekerPing,
bungeeLeave,
lobbyItemStartAdmin;
public static int
minPlayers,
worldborderSize,
worldborderDelay,
currentWorldborderSize,
worldborderChange,
gameLength,
saveMinX,
saveMinZ,
@ -86,7 +95,9 @@ public class Config {
lobbyMax,
seekerPingLevel1,
seekerPingLevel2,
seekerPingLevel3;
seekerPingLevel3,
lobbyItemLeavePosition,
lobbyItemStartPosition;
public static List<String>
blockedCommands,
@ -110,6 +121,10 @@ public class Config {
LOBBY_CONTENTS,
GAME_CONTENTS;
public static ItemStack
lobbyLeaveItem,
lobbyStartItem;
public static void loadConfig() {
config = new ConfigManager("config.yml");
@ -119,7 +134,7 @@ public class Config {
//Spawn
spawnPosition = new Vector(
config.getDouble("spawns.game.x"),
Math.max(0, Math.min(255, config.getDouble("spawns.game.y"))),
Math.max(Version.atLeast("1.18") ? -64 : 0, Math.min(255, config.getDouble("spawns.game.y"))),
config.getDouble("spawns.game.z")
);
spawnWorld = config.getString("spawns.game.world");
@ -127,7 +142,7 @@ public class Config {
///Lobby
lobbyPosition = new Vector(
config.getDouble("spawns.lobby.x"),
Math.max(0, Math.min(255, config.getDouble("spawns.lobby.y"))),
Math.max(Version.atLeast("1.18") ? -64 : 0, Math.min(255, config.getDouble("spawns.lobby.y"))),
config.getDouble("spawns.lobby.z")
);
lobbyWorld = config.getString("spawns.lobby.world");
@ -136,7 +151,7 @@ public class Config {
exitPosition = new Vector(
config.getDouble("spawns.exit.x"),
Math.max(0, Math.min(255, config.getDouble("spawns.exit.y"))),
Math.max(Version.atLeast("1.18") ? -64 : 0, Math.min(255, config.getDouble("spawns.exit.y"))),
config.getDouble("spawns.exit.z")
);
exitWorld = config.getString("spawns.exit.world");
@ -150,6 +165,7 @@ public class Config {
worldborderSize = Math.max(100, config.getInt("worldBorder.size"));
worldborderDelay = Math.max(1, config.getInt("worldBorder.delay"));
worldborderEnabled = config.getBoolean("worldBorder.enabled");
worldborderChange = config.getInt("worldBorder.moveAmount");
//Prefix
char SYMBOLE = '\u00A7';
@ -214,6 +230,8 @@ public class Config {
}
}
}
bungeeLeave = config.getString("leaveType") == null || config.getString("leaveType").equalsIgnoreCase("proxy");
leaveServer = config.getString("leaveServer");
//Leaderboard
LOBBY_TITLE = leaderboard.getString("lobby.title");
@ -232,6 +250,31 @@ public class Config {
GLOW_INACTIVE = leaderboard.getString("glow.inactive");
BORDER_COUNTING = leaderboard.getString("border.counting");
BORDER_DECREASING = leaderboard.getString("border.decreasing");
//Lobby Items
if(config.getBoolean("lobbyItems.leave.enabled")) {
ConfigurationSection item = new YamlConfiguration().createSection("temp");
item.set("name", ChatColor.translateAlternateColorCodes('&',config.getString("lobbyItems.leave.name")));
item.set("material", config.getString("lobbyItems.leave.material"));
List<String> lore = config.getStringList("lobbyItems.leave.lore");
if (lore != null && !lore.isEmpty()) item.set("lore", lore);
ItemStack temp = null;
try{ temp = XItemStack.deserialize(item); } catch(Exception ignored){}
lobbyLeaveItem = temp;
lobbyItemLeavePosition = config.getInt("lobbyItems.leave.position");
}
if(config.getBoolean("lobbyItems.start.enabled")) {
ConfigurationSection item = new YamlConfiguration().createSection("temp");
item.set("name", ChatColor.translateAlternateColorCodes('&',config.getString("lobbyItems.start.name")));
item.set("material", config.getString("lobbyItems.start.material"));
List<String> lore = config.getStringList("lobbyItems.start.lore");
if (lore != null && !lore.isEmpty()) item.set("lore", lore);
ItemStack temp = null;
try{ temp = XItemStack.deserialize(item); } catch(Exception ignored){}
lobbyStartItem = temp;
lobbyItemStartAdmin = config.getBoolean("lobbyItems.start.adminOnly");
lobbyItemStartPosition = config.getInt("lobbyItems.start.position");
}
}
public static void addToConfig(String path, Object value) {

View file

@ -232,6 +232,7 @@ public class ConfigManager {
if(end == -1) end = yamlString.length();
String replace;
if(entry.getValue() instanceof List){
if(((List<?>) entry.getValue()).isEmpty()) continue;
replace = "[";
for(Object o : (List<Object>)entry.getValue()){
replace = replace + o.toString() + ", ";

View file

@ -34,28 +34,28 @@ import org.bukkit.scoreboard.*;
public class Board {
private static final List<UUID> Hider = new ArrayList<>(), Seeker = new ArrayList<>(), Spectator = new ArrayList<>();
private static final Map<UUID, Player> playerList = new HashMap<>();
private static final Map<UUID, CustomBoard> customBoards = new HashMap<>();
private static final List<String> Hider = new ArrayList<>(), Seeker = new ArrayList<>(), Spectator = new ArrayList<>();
private static final Map<String, Player> playerList = new HashMap<>();
private static final Map<String, CustomBoard> customBoards = new HashMap<>();
public static boolean isPlayer(Player player) {
return playerList.containsKey(player.getUniqueId());
return playerList.containsKey(player.getUniqueId().toString());
}
public static boolean isPlayer(CommandSender sender) {
return playerList.containsKey(Bukkit.getPlayer(sender.getName()).getUniqueId());
return playerList.containsKey(Bukkit.getPlayer(sender.getName()).getUniqueId().toString());
}
public static boolean isHider(Player player) {
return Hider.contains(player.getUniqueId());
return Hider.contains(player.getUniqueId().toString());
}
public static boolean isSeeker(Player player) {
return Seeker.contains(player.getUniqueId());
return Seeker.contains(player.getUniqueId().toString());
}
public static boolean isSpectator(Player player) {
return Spectator.contains(player.getUniqueId());
return Spectator.contains(player.getUniqueId().toString());
}
public static int sizeHider() {
@ -70,13 +70,6 @@ public class Board {
return playerList.values().size();
}
public static void check(){
for(UUID uuid : playerList.keySet()){
if(Bukkit.getPlayer(uuid) == null)
playerList.remove(uuid);
}
}
public static List<Player> getHiders(){
return Hider.stream().map(playerList::get).collect(Collectors.toList());
}
@ -98,41 +91,41 @@ public class Board {
}
public static Player getPlayer(UUID uuid) {
return playerList.get(uuid);
return playerList.get(uuid.toString());
}
public static void addHider(Player player) {
Hider.add(player.getUniqueId());
Seeker.remove(player.getUniqueId());
Spectator.remove(player.getUniqueId());
playerList.put(player.getUniqueId(), player);
Hider.add(player.getUniqueId().toString());
Seeker.remove(player.getUniqueId().toString());
Spectator.remove(player.getUniqueId().toString());
playerList.put(player.getUniqueId().toString(), player);
}
public static void addSeeker(Player player) {
Hider.remove(player.getUniqueId());
Seeker.add(player.getUniqueId());
Spectator.remove(player.getUniqueId());
playerList.put(player.getUniqueId(), player);
Hider.remove(player.getUniqueId().toString());
Seeker.add(player.getUniqueId().toString());
Spectator.remove(player.getUniqueId().toString());
playerList.put(player.getUniqueId().toString(), player);
}
public static void addSpectator(Player player) {
Hider.remove(player.getUniqueId());
Seeker.remove(player.getUniqueId());
Spectator.add(player.getUniqueId());
playerList.put(player.getUniqueId(), player);
Hider.remove(player.getUniqueId().toString());
Seeker.remove(player.getUniqueId().toString());
Spectator.add(player.getUniqueId().toString());
playerList.put(player.getUniqueId().toString(), player);
}
public static void remove(Player player) {
Hider.remove(player.getUniqueId());
Seeker.remove(player.getUniqueId());
Spectator.remove(player.getUniqueId());
playerList.remove(player.getUniqueId());
Hider.remove(player.getUniqueId().toString());
Seeker.remove(player.getUniqueId().toString());
Spectator.remove(player.getUniqueId().toString());
playerList.remove(player.getUniqueId().toString());
}
public static boolean onSameTeam(Player player1, Player player2) {
if(Hider.contains(player1.getUniqueId()) && Hider.contains(player2.getUniqueId())) return true;
else if(Seeker.contains(player1.getUniqueId()) && Seeker.contains(player2.getUniqueId())) return true;
else return Spectator.contains(player1.getUniqueId()) && Spectator.contains(player2.getUniqueId());
if(Hider.contains(player1.getUniqueId().toString()) && Hider.contains(player2.getUniqueId().toString())) return true;
else if(Seeker.contains(player1.getUniqueId().toString()) && Seeker.contains(player2.getUniqueId().toString())) return true;
else return Spectator.contains(player1.getUniqueId().toString()) && Spectator.contains(player2.getUniqueId().toString());
}
public static void reload() {
@ -146,7 +139,7 @@ public class Board {
}
private static void createLobbyBoard(Player player, boolean recreate) {
CustomBoard board = customBoards.get(player.getUniqueId());
CustomBoard board = customBoards.get(player.getUniqueId().toString());
if(recreate) {
board = new CustomBoard(player, "&l&eHIDE AND SEEK");
board.updateTeams();
@ -175,7 +168,7 @@ public class Board {
i++;
}
board.display();
customBoards.put(player.getUniqueId(), board);
customBoards.put(player.getUniqueId().toString(), board);
}
public static void createGameBoard(Player player){
@ -183,7 +176,7 @@ public class Board {
}
private static void createGameBoard(Player player, boolean recreate){
CustomBoard board = customBoards.get(player.getUniqueId());
CustomBoard board = customBoards.get(player.getUniqueId().toString());
if(recreate) {
board = new CustomBoard(player, GAME_TITLE);
board.updateTeams();
@ -238,14 +231,14 @@ public class Board {
i++;
}
board.display();
customBoards.put(player.getUniqueId(), board);
customBoards.put(player.getUniqueId().toString(), board);
}
public static void removeBoard(Player player) {
ScoreboardManager manager = Bukkit.getScoreboardManager();
assert manager != null;
player.setScoreboard(manager.getMainScoreboard());
customBoards.remove(player.getUniqueId());
customBoards.remove(player.getUniqueId().toString());
}
public static void reloadLobbyBoards() {

View file

@ -39,8 +39,11 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.*;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.*;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.projectiles.ProjectileSource;
@ -277,10 +280,58 @@ public class EventListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if(Board.isPlayer(event.getPlayer()) && blockedInteracts.contains(event.getClickedBlock().getType().name())){
if(!Board.isPlayer(event.getPlayer())) return;
if(event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock() != null && blockedInteracts.contains(event.getClickedBlock().getType().name())){
event.setCancelled(true);
return;
}
if(Game.status != Status.STANDBY) return;
ItemStack temp = event.getItem();
if(temp == null) return;
if (temp.getItemMeta().getDisplayName().equalsIgnoreCase(lobbyLeaveItem.getItemMeta().getDisplayName()) && temp.getType() == lobbyLeaveItem.getType()) {
event.setCancelled(true);
Game.leave(event.getPlayer());
}
if (temp.getItemMeta().getDisplayName().equalsIgnoreCase(lobbyStartItem.getItemMeta().getDisplayName()) && temp.getType() == lobbyStartItem.getType() && event.getPlayer().hasPermission("hideandseek.start")) {
event.setCancelled(true);
if (Game.isNotSetup()) {
event.getPlayer().sendMessage(errorPrefix + message("GAME_SETUP"));
return;
}
if (Game.status != Status.STANDBY) {
event.getPlayer().sendMessage(errorPrefix + message("GAME_INPROGRESS"));
return;
}
if (Board.size() < minPlayers) {
event.getPlayer().sendMessage(errorPrefix + message("START_MIN_PLAYERS").addAmount(minPlayers));
return;
}
Game.start();
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onInventoryClick(InventoryClickEvent event) {
if(event.getWhoClicked() instanceof Player){
Player player = (Player) event.getWhoClicked();
if(Board.isPlayer(player) && Game.status == Status.STANDBY){
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onItemDrop(PlayerDropItemEvent event)
{
if(Board.isPlayer(event.getPlayer()) && Game.status == Status.STANDBY){
event.setCancelled(true);
}
}
}

View file

@ -24,6 +24,8 @@ import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.messages.Titles;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import net.md_5.bungee.api.ChatColor;
import net.tylermurphy.hideAndSeek.configuration.Items;
import net.tylermurphy.hideAndSeek.database.Database;
@ -70,6 +72,26 @@ public class Game {
worldLoader = new WorldLoader(spawnWorld);
}
public static void start(){
Optional<Player> rand = Board.getPlayers().stream().skip(new Random().nextInt(Board.size())).findFirst();
if(!rand.isPresent()){
Main.plugin.getLogger().warning("Failed to select random seeker.");
return;
}
String seekerName = rand.get().getName();
Player temp = Bukkit.getPlayer(seekerName);
if(temp == null){
Main.plugin.getLogger().warning("Failed to select random seeker.");
return;
}
Player seeker = Board.getPlayer(temp.getUniqueId());
if(seeker == null){
Main.plugin.getLogger().warning("Failed to select random seeker.");
return;
}
start(seeker);
}
public static void start(Player seeker){
if(status == Status.STARTING || status == Status.PLAYING) return;
if(worldLoader.getWorld() != null) {
@ -153,6 +175,10 @@ public class Game {
player.setGameMode(GameMode.ADVENTURE);
Board.addHider(player);
player.getInventory().clear();
if(lobbyStartItem != null && (!lobbyItemStartAdmin || player.isOp()))
player.getInventory().setItem(lobbyItemStartPosition, lobbyStartItem);
if(lobbyLeaveItem != null)
player.getInventory().setItem(lobbyItemLeavePosition, lobbyLeaveItem);
player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
for(PotionEffect effect : player.getActivePotionEffects()){
player.removePotionEffect(effect.getType());
@ -187,6 +213,7 @@ public class Game {
}
public static void resetWorldborder(String worldName){
worldBorder = new Border();
worldBorder.resetWorldborder(worldName);
}
@ -233,6 +260,10 @@ public class Game {
public static void join(Player player){
if(Game.status == Status.STANDBY) {
player.getInventory().clear();
if(lobbyStartItem != null && (!lobbyItemStartAdmin || player.hasPermission("hideandseek.start")))
player.getInventory().setItem(lobbyItemStartPosition, lobbyStartItem);
if(lobbyLeaveItem != null)
player.getInventory().setItem(lobbyItemLeavePosition, lobbyLeaveItem);
Board.addHider(player);
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player));
else Game.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player));
@ -258,6 +289,28 @@ public class Game {
}
}
public static void leave(Player player){
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + message("GAME_LEAVE").addPlayer(player));
else Game.broadcastMessage(messagePrefix + message("GAME_LEAVE").addPlayer(player));
Board.removeBoard(player);
Board.remove(player);
player.getInventory().clear();
if(Game.status == Status.STANDBY) {
Board.reloadLobbyBoards();
} else {
Board.reloadGameBoards();
Board.reloadBoardTeams();
}
if(bungeeLeave) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Connect");
out.writeUTF(leaveServer);
player.sendPluginMessage(Main.plugin, "BungeeCord", out.toByteArray());
} else {
player.teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ()));
}
}
public static void removeItems(Player player){
for(ItemStack si : Items.SEEKER_ITEMS)
for(ItemStack i : player.getInventory().getContents())
@ -279,23 +332,7 @@ public class Game {
Board.reloadLobbyBoards();
}
if(countdownTime == 0){
Optional<Player> rand = Board.getPlayers().stream().skip(new Random().nextInt(Board.size())).findFirst();
if(!rand.isPresent()){
Main.plugin.getLogger().warning("Failed to select random seeker.");
return;
}
String seekerName = rand.get().getName();
Player temp = Bukkit.getPlayer(seekerName);
if(temp == null){
Main.plugin.getLogger().warning("Failed to select random seeker.");
return;
}
Player seeker = Board.getPlayer(temp.getUniqueId());
if(seeker == null){
Main.plugin.getLogger().warning("Failed to select random seeker.");
return;
}
start(seeker);
start();
}
} else {
countdownTime = -1;
@ -527,17 +564,20 @@ class Border {
}
private void decreaceWorldborder() {
if(currentWorldborderSize-100 > 100) {
if(currentWorldborderSize == 100) return;
int change = worldborderChange;
if(currentWorldborderSize-worldborderChange < 100){
change = currentWorldborderSize-100;
}
running = true;
broadcastMessage(worldborderPrefix + message("WORLDBORDER_DECREASING"));
currentWorldborderSize -= 100;
broadcastMessage(worldborderPrefix + message("WORLDBORDER_DECREASING").addAmount(change));
currentWorldborderSize -= worldborderChange;
World world = Bukkit.getWorld("hideandseek_"+spawnWorld);
assert world != null;
org.bukkit.WorldBorder border = world.getWorldBorder();
border.setSize(border.getSize()-100,30);
border.setSize(border.getSize()-change,30);
delay = 30;
}
}
public void resetWorldborder(String worldName) {
World world = Bukkit.getWorld(worldName);

View file

@ -44,6 +44,21 @@ autoJoin: false
# default: false
teleportToExit: false
# What do you want to happen when a player leaves the lobby. If you are running a single server, maybe you want to send
# them to the world hub. But if you are running a bungee-cord or velocity server, maybe you want to send them to the servers
# hub.
#
# EXIT - Sends the player to the specified exit position set by /hs setexit
#
# PROXY - Send the player to a specified server in a bungee-cord / velocity setup.
#
# default: EXIT
leaveType: EXIT
# Ignore this setting if you aren't using the PROXY leave type method above. If you are, set this to the server you want to send
# players too.
leaveServer: hub
# The worldborder closes every interval, which is evey [delay] in minutes.
# Thw worldborder starts at [size], and decreases 100 blocks every interval.
# x & z are the center location. [enabled] is whenever the border is enabled.
@ -53,6 +68,7 @@ worldBorder:
z: 0
delay: 10
size: 500
moveAmount: 100
warn: true
enabled: false
@ -99,6 +115,26 @@ lobby:
max: 10
enabled: true
# Below are the two items given to you when you join a lobby. A item to click to leave the lobby, and another
# to start the game. Each of these items can be toggled separately, but only these items are currently supported.
# You can customize the material, name, lore, and position of the item. And finally, the start item is marked as
# adminOnly be default since the /hs start command is also admin by default. If you set adminOnly to false, only
# the item will become non admin only, not the command.
lobbyItems:
leave:
material: BED
name: "&cLeave Lobby"
lore: ["Go back to server hub"]
position: 8
enabled: true
start:
material: CLOCK
name: "&bStart Game"
lore: []
position: 0
enabled: true
adminOnly: true
# As a hider, the closer a seeker gets to you, the louder and faster a pining noise will play.
# There are 3 separate distances (in blocks) you can set to the 3 different levels for the noise.
# The higher the level, the closer the seeker.
@ -128,7 +164,6 @@ blockedCommands: [msg, tp, gamemode, kill, give, effect]
# the block ID you enter, as the plugin will automatically switch to the
# block ID of your current Minecraft server version.
blockedInteracts: [FURNACE, CRAFTING_TABLE, ANVIL, CHEST, BARREL]
# ---------------------------------------------------------- #
# ONLY EDIT BEYOND THIS POINT IF YOU KNOW WHAT YOU ARE DOING #
# ---------------------------------------------------------- #

View file

@ -40,6 +40,7 @@ items:
material: POTION
amount: 2
type: INSTANT_HEAL
effects:
seeker:
'1':

View file

@ -34,9 +34,10 @@ Localization:
WORLDBORDER_INVALID_INPUT: "Invalid integer {AMOUNT}."
WORLDBORDER_MIN_SIZE: "World border cannot be smaller than 100 blocks."
WORLDBORDER_POSITION: "Spawn position must be 100 from world border center."
WORLDBORDER_ENABLE: "Set border center to current location, size to {AMOUNT}, and delay to {AMOUNT}."
WORLDBORDER_DECREASING: "World border decreasing by 100 blocks over the next 30s."
WORLDBORDER_ENABLE: "Set border center to current location, size to {AMOUNT}, delay to {AMOUNT}, and move to {AMOUNT}."
WORLDBORDER_DECREASING: "World border decreasing by {AMOUNT} blocks over the next 30s."
WORLDBORDER_WARN: "World border will shrink in the next 30s!"
WORLDBORDER_CHANGE_SIZE: "World border change cannot be 0 or less."
TAUNTED: "&c&oOh no! You have been chosen to be taunted."
TAUNT: "A random hider will be taunted in the next 30s."
TAUNT_ACTIVATE: "Taunt has been activated."

View file

@ -71,7 +71,7 @@ game:
countdown:
waiting: "Waiting for players..."
adminStart: "Waiting for gamemaster..."
counting: "Starting in: $a{AMOUNT}s"
counting: "Starting in: &a{AMOUNT}s"
taunt:
counting: "{AMOUNT}m{AMOUNT}s"

View file

@ -1,6 +1,6 @@
name: HideAndSeek
main: net.tylermurphy.hideAndSeek.Main
version: 1.4.1
version: 1.4.2
author: KenshinEto
load: STARTUP
api-version: 1.13