1.3.3 beta 2
This commit is contained in:
parent
e6f86145cf
commit
6239acb08a
28 changed files with 351 additions and 294 deletions
10
pom.xml
10
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>HideAndSeek</artifactId>
|
<artifactId>KenshinsHideAndSeek</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
<name>Hide and Seek Plugin</name>
|
<name>Hide and Seek Plugin</name>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
@ -39,5 +39,11 @@
|
||||||
<artifactId>ProtocolLib</artifactId>
|
<artifactId>ProtocolLib</artifactId>
|
||||||
<version>4.7.0</version>
|
<version>4.7.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains</groupId>
|
||||||
|
<artifactId>annotations</artifactId>
|
||||||
|
<version>RELEASE</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
|
@ -7,6 +7,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.tylermurphy.hideAndSeek.game.Status;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -16,45 +17,33 @@ import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
import net.tylermurphy.hideAndSeek.bukkit.CommandHandler;
|
import net.tylermurphy.hideAndSeek.util.CommandHandler;
|
||||||
import net.tylermurphy.hideAndSeek.bukkit.EventListener;
|
import net.tylermurphy.hideAndSeek.game.EventListener;
|
||||||
import net.tylermurphy.hideAndSeek.bukkit.TabCompleter;
|
import net.tylermurphy.hideAndSeek.util.TabCompleter;
|
||||||
import net.tylermurphy.hideAndSeek.bukkit.Tick;
|
import net.tylermurphy.hideAndSeek.game.Game;
|
||||||
import net.tylermurphy.hideAndSeek.configuration.Config;
|
import net.tylermurphy.hideAndSeek.configuration.Config;
|
||||||
import net.tylermurphy.hideAndSeek.configuration.Localization;
|
import net.tylermurphy.hideAndSeek.configuration.Localization;
|
||||||
import net.tylermurphy.hideAndSeek.configuration.Items;
|
import net.tylermurphy.hideAndSeek.configuration.Items;
|
||||||
import net.tylermurphy.hideAndSeek.events.Glow;
|
|
||||||
import net.tylermurphy.hideAndSeek.events.Taunt;
|
|
||||||
import net.tylermurphy.hideAndSeek.events.Worldborder;
|
|
||||||
import net.tylermurphy.hideAndSeek.util.Board;
|
import net.tylermurphy.hideAndSeek.util.Board;
|
||||||
import net.tylermurphy.hideAndSeek.world.WorldLoader;
|
import net.tylermurphy.hideAndSeek.world.WorldLoader;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class Main extends JavaPlugin implements Listener {
|
public class Main extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
public static Main plugin;
|
public static Main plugin;
|
||||||
public static File root, data;
|
public static File root, data;
|
||||||
|
|
||||||
public Taunt taunt;
|
public Game game;
|
||||||
public Glow glow;
|
|
||||||
public Worldborder worldborder;
|
|
||||||
|
|
||||||
public Board board;
|
public Board board;
|
||||||
|
|
||||||
public WorldLoader worldLoader;
|
public WorldLoader worldLoader;
|
||||||
|
public Status status = Status.STANDBY;
|
||||||
public Map<String,Player> playerList = new HashMap<String,Player>();
|
|
||||||
|
|
||||||
public String status = "Standby";
|
|
||||||
|
|
||||||
public int timeLeft = 0, gameId = 0;;
|
|
||||||
|
|
||||||
private BukkitTask onTickTask;
|
private BukkitTask onTickTask;
|
||||||
|
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
|
||||||
plugin = this;
|
plugin = this;
|
||||||
|
|
||||||
// Setup Initial Player Count
|
// Setup Event Listener
|
||||||
getServer().getPluginManager().registerEvents(new EventListener(), this);
|
getServer().getPluginManager().registerEvents(new EventListener(), this);
|
||||||
|
|
||||||
// Get Data Folder
|
// Get Data Folder
|
||||||
|
@ -79,7 +68,8 @@ public class Main extends JavaPlugin implements Listener {
|
||||||
// Start Tick Timer
|
// Start Tick Timer
|
||||||
onTickTask = Bukkit.getServer().getScheduler().runTaskTimer(this, () -> {
|
onTickTask = Bukkit.getServer().getScheduler().runTaskTimer(this, () -> {
|
||||||
try{
|
try{
|
||||||
Tick.onTick();
|
game = new Game();
|
||||||
|
game.onTick();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -92,11 +82,11 @@ public class Main extends JavaPlugin implements Listener {
|
||||||
onTickTask.cancel();
|
onTickTask.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
|
||||||
return CommandHandler.handleCommand(sender, cmd, label, args);
|
return CommandHandler.handleCommand(sender, cmd, label, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
return TabCompleter.handleTabComplete(sender, command, label, args);
|
return TabCompleter.handleTabComplete(sender, command, label, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,85 +0,0 @@
|
||||||
package net.tylermurphy.hideAndSeek.bukkit;
|
|
||||||
|
|
||||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import net.tylermurphy.hideAndSeek.Main;
|
|
||||||
import net.tylermurphy.hideAndSeek.command.Stop;
|
|
||||||
import net.tylermurphy.hideAndSeek.util.Packet;
|
|
||||||
import net.tylermurphy.hideAndSeek.util.Util;
|
|
||||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
|
|
||||||
|
|
||||||
public class Tick {
|
|
||||||
|
|
||||||
static int tick = 0;
|
|
||||||
|
|
||||||
public static void onTick() {
|
|
||||||
|
|
||||||
if(Main.plugin.status.equals("Standby")) tick = 0;
|
|
||||||
else if(Main.plugin.status.equals("Playing")) onPlaying();
|
|
||||||
|
|
||||||
if(( Main.plugin.status.equals("Starting") || Main.plugin.status.equals("Playing") ) && Main.plugin.board.sizeHider() < 1) {
|
|
||||||
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND"));
|
|
||||||
else Util.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND"));
|
|
||||||
Stop.onStop();
|
|
||||||
}
|
|
||||||
if(( Main.plugin.status.equals("Starting") || Main.plugin.status.equals("Playing") ) && Main.plugin.board.sizeSeeker() < 1) {
|
|
||||||
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT"));
|
|
||||||
else Util.broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT"));
|
|
||||||
Stop.onStop();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void onPlaying() {
|
|
||||||
|
|
||||||
if(tick<1000000) tick++;
|
|
||||||
else tick = 1;
|
|
||||||
|
|
||||||
for(Player hider : Main.plugin.board.getHiders()) {
|
|
||||||
int distance = 100, temp = 100;
|
|
||||||
for(Player seeker : Main.plugin.board.getSeekers()) {
|
|
||||||
try {
|
|
||||||
temp = (int) hider.getLocation().distance(seeker.getLocation());
|
|
||||||
} catch (Exception e){
|
|
||||||
//Players in different worlds, NOT OK!!!
|
|
||||||
}
|
|
||||||
if(distance > temp) {
|
|
||||||
distance = temp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch(tick%10) {
|
|
||||||
case 0:
|
|
||||||
if(distance < 30) Packet.playSound(hider, Sound.BLOCK_NOTE_BLOCK_BASEDRUM, .5f, 1f);
|
|
||||||
if(distance < 10) Packet.playSound(hider, Sound.BLOCK_NOTE_BLOCK_BIT, .3f, 1f);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
if(distance < 30) Packet.playSound(hider, Sound.BLOCK_NOTE_BLOCK_BASEDRUM, .3f, 1f);
|
|
||||||
if(distance < 10) Packet.playSound(hider, Sound.BLOCK_NOTE_BLOCK_BIT, .3f, 1f);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
if(distance < 10) Packet.playSound(hider, Sound.BLOCK_NOTE_BLOCK_BIT, .3f, 1f);
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
if(distance < 20) Packet.playSound(hider, Sound.BLOCK_NOTE_BLOCK_BIT, .3f, 1f);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(tick%20 == 0) {
|
|
||||||
if(gameLength > 0) {
|
|
||||||
Main.plugin.board.reloadGameBoards();
|
|
||||||
Main.plugin.timeLeft--;
|
|
||||||
if(Main.plugin.timeLeft < 1) {
|
|
||||||
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_TIME"));
|
|
||||||
else Util.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_TIME"));
|
|
||||||
Stop.onStop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,7 +3,7 @@ package net.tylermurphy.hideAndSeek.command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.tylermurphy.hideAndSeek.bukkit.CommandHandler;
|
import net.tylermurphy.hideAndSeek.util.CommandHandler;
|
||||||
|
|
||||||
public class Help implements ICommand {
|
public class Help implements ICommand {
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.tylermurphy.hideAndSeek.command;
|
||||||
|
|
||||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||||
|
|
||||||
|
import net.tylermurphy.hideAndSeek.game.Status;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -34,7 +35,7 @@ public class Join implements ICommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void join(Player player){
|
public static void join(Player player){
|
||||||
if(Main.plugin.status.equals("Standby")) {
|
if(Main.plugin.status == Status.STANDBY) {
|
||||||
player.getInventory().clear();
|
player.getInventory().clear();
|
||||||
Main.plugin.board.addHider(player);
|
Main.plugin.board.addHider(player);
|
||||||
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player));
|
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player));
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.tylermurphy.hideAndSeek.command;
|
||||||
|
|
||||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||||
|
|
||||||
|
import net.tylermurphy.hideAndSeek.game.Status;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -32,7 +33,7 @@ public class Leave implements ICommand {
|
||||||
Main.plugin.board.removeBoard(player);
|
Main.plugin.board.removeBoard(player);
|
||||||
Main.plugin.board.remove(player);
|
Main.plugin.board.remove(player);
|
||||||
player.teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ()));
|
player.teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ()));
|
||||||
if(Main.plugin.status.equals("Standby")) {
|
if(Main.plugin.status == Status.STANDBY) {
|
||||||
Main.plugin.board.reloadLobbyBoards();
|
Main.plugin.board.reloadLobbyBoards();
|
||||||
} else {
|
} else {
|
||||||
Main.plugin.board.reloadGameBoards();
|
Main.plugin.board.reloadGameBoards();
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.tylermurphy.hideAndSeek.command;
|
||||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||||
|
|
||||||
import net.tylermurphy.hideAndSeek.configuration.Items;
|
import net.tylermurphy.hideAndSeek.configuration.Items;
|
||||||
|
import net.tylermurphy.hideAndSeek.game.Status;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import net.tylermurphy.hideAndSeek.Main;
|
import net.tylermurphy.hideAndSeek.Main;
|
||||||
|
@ -15,7 +16,7 @@ public class Reload implements ICommand {
|
||||||
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
|
||||||
if(!Main.plugin.status.equals("Standby")) {
|
if(Main.plugin.status != Status.STANDBY) {
|
||||||
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.tylermurphy.hideAndSeek.command;
|
||||||
|
|
||||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||||
|
|
||||||
|
import net.tylermurphy.hideAndSeek.game.Status;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
@ -14,7 +15,7 @@ public class SaveMap implements ICommand {
|
||||||
public static boolean runningBackup = false;
|
public static boolean runningBackup = false;
|
||||||
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
if(!Main.plugin.status.equals("Standby")) {
|
if(Main.plugin.status != Status.STANDBY) {
|
||||||
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,7 @@ package net.tylermurphy.hideAndSeek.command;
|
||||||
|
|
||||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import net.tylermurphy.hideAndSeek.game.Status;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
@ -16,7 +14,7 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
|
||||||
public class SetBorder implements ICommand {
|
public class SetBorder implements ICommand {
|
||||||
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
if(!Main.plugin.status.equals("Standby")) {
|
if(Main.plugin.status != Status.STANDBY) {
|
||||||
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.tylermurphy.hideAndSeek.command;
|
||||||
|
|
||||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||||
|
|
||||||
|
import net.tylermurphy.hideAndSeek.game.Status;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@ -11,7 +12,7 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
|
||||||
public class SetBounds implements ICommand {
|
public class SetBounds implements ICommand {
|
||||||
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
if(!Main.plugin.status.equals("Standby")) {
|
if(Main.plugin.status != Status.STANDBY) {
|
||||||
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.tylermurphy.hideAndSeek.game.Status;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
@ -15,7 +16,7 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
|
||||||
public class SetExitLocation implements ICommand {
|
public class SetExitLocation implements ICommand {
|
||||||
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
if(!Main.plugin.status.equals("Standby")) {
|
if(Main.plugin.status != Status.STANDBY) {
|
||||||
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.tylermurphy.hideAndSeek.game.Status;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
@ -15,7 +16,7 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
|
||||||
public class SetLobbyLocation implements ICommand {
|
public class SetLobbyLocation implements ICommand {
|
||||||
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
if(!Main.plugin.status.equals("Standby")) {
|
if(Main.plugin.status != Status.STANDBY) {
|
||||||
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.tylermurphy.hideAndSeek.game.Status;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
@ -17,7 +18,7 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
|
||||||
public class SetSpawnLocation implements ICommand {
|
public class SetSpawnLocation implements ICommand {
|
||||||
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
if(!Main.plugin.status.equals("Standby")) {
|
if(Main.plugin.status != Status.STANDBY) {
|
||||||
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.tylermurphy.hideAndSeek.command;
|
package net.tylermurphy.hideAndSeek.command;
|
||||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
|
import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
|
||||||
|
|
||||||
|
import net.tylermurphy.hideAndSeek.game.Status;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -36,7 +37,7 @@ public class Start implements ICommand {
|
||||||
sender.sendMessage(errorPrefix + message("GAME_SETUP"));
|
sender.sendMessage(errorPrefix + message("GAME_SETUP"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!Main.plugin.status.equals("Standby")) {
|
if(Main.plugin.status != Status.STANDBY) {
|
||||||
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -48,11 +49,6 @@ 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;
|
||||||
}
|
}
|
||||||
if(Bukkit.getServer().getWorld("hideandseek_"+spawnWorld) != null) {
|
|
||||||
Main.plugin.worldLoader.rollback();
|
|
||||||
} else {
|
|
||||||
Main.plugin.worldLoader.loadMap();
|
|
||||||
}
|
|
||||||
String seekerName;
|
String seekerName;
|
||||||
if(args.length < 1) {
|
if(args.length < 1) {
|
||||||
seekerName = Main.plugin.board.getPlayers().stream().skip(new Random().nextInt(Main.plugin.board.size())).findFirst().get().getName();
|
seekerName = Main.plugin.board.getPlayers().stream().skip(new Random().nextInt(Main.plugin.board.size())).findFirst().get().getName();
|
||||||
|
@ -64,77 +60,7 @@ public class Start implements ICommand {
|
||||||
sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(seekerName));
|
sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(seekerName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Main.plugin.board.reload();
|
Main.plugin.game.start(seeker);
|
||||||
for(Player temp : Main.plugin.board.getPlayers()) {
|
|
||||||
if(temp.getName().equals(seeker.getName()))
|
|
||||||
continue;
|
|
||||||
Main.plugin.board.addHider(temp);
|
|
||||||
}
|
|
||||||
Main.plugin.board.addSeeker(seeker);
|
|
||||||
currentWorldborderSize = worldborderSize;
|
|
||||||
for(Player player : Main.plugin.board.getPlayers()) {
|
|
||||||
player.getInventory().clear();
|
|
||||||
player.setGameMode(GameMode.ADVENTURE);
|
|
||||||
player.teleport(new Location(Bukkit.getWorld("hideandseek_"+spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
|
|
||||||
for(PotionEffect effect : player.getActivePotionEffects()){
|
|
||||||
player.removePotionEffect(effect.getType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(Player player : Main.plugin.board.getSeekers()) {
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,1000000,127,false,false));
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,1000000,127,false,false));
|
|
||||||
player.sendTitle(ChatColor.RED + "" + ChatColor.BOLD + "SEEKER", ChatColor.WHITE + message("SEEKERS_SUBTITLE").toString(), 10, 70, 20);
|
|
||||||
}
|
|
||||||
for(Player player : Main.plugin.board.getHiders()) {
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,1000000,5,false,false));
|
|
||||||
player.sendTitle(ChatColor.GOLD + "" + ChatColor.BOLD + "HIDER", ChatColor.WHITE + message("HIDERS_SUBTITLE").toString(), 10, 70, 20);
|
|
||||||
}
|
|
||||||
Worldborder.resetWorldborder("hideandseek_"+spawnWorld);
|
|
||||||
for(Player player : Main.plugin.board.getPlayers()){
|
|
||||||
Main.plugin.board.createGameBoard(player);
|
|
||||||
}
|
|
||||||
Main.plugin.board.reloadGameBoards();
|
|
||||||
Main.plugin.status = "Starting";
|
|
||||||
int temp = Main.plugin.gameId;
|
|
||||||
Util.broadcastMessage(messagePrefix + message("START_COUNTDOWN").addAmount(30));
|
|
||||||
Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(20), Main.plugin.gameId, 20 * 10);
|
|
||||||
Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(10), Main.plugin.gameId, 20 * 20);
|
|
||||||
Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(5), Main.plugin.gameId, 20 * 25);
|
|
||||||
Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(3), Main.plugin.gameId, 20 * 27);
|
|
||||||
Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(2), Main.plugin.gameId, 20 * 28);
|
|
||||||
Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(1), Main.plugin.gameId, 20 * 29);
|
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(Main.plugin, new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
if(temp != Main.plugin.gameId) return;
|
|
||||||
Util.broadcastMessage(messagePrefix + message("START"));
|
|
||||||
Main.plugin.status = "Playing";
|
|
||||||
for(Player player : Main.plugin.board.getPlayers()) {
|
|
||||||
Util.resetPlayer(player);
|
|
||||||
}
|
|
||||||
Main.plugin.worldborder = null;
|
|
||||||
Main.plugin.taunt = null;
|
|
||||||
Main.plugin.glow = null;
|
|
||||||
|
|
||||||
if(worldborderEnabled) {
|
|
||||||
Main.plugin.worldborder = new Worldborder(Main.plugin.gameId);
|
|
||||||
Main.plugin.worldborder.schedule();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(tauntEnabled) {
|
|
||||||
Main.plugin.taunt = new Taunt(Main.plugin.gameId);
|
|
||||||
Main.plugin.taunt.schedule();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (glowEnabled) {
|
|
||||||
Main.plugin.glow = new Glow(Main.plugin.gameId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(gameLength > 0) {
|
|
||||||
Main.plugin.timeLeft = gameLength;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 20 * 30);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
|
|
|
@ -2,17 +2,11 @@ package net.tylermurphy.hideAndSeek.command;
|
||||||
|
|
||||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||||
|
|
||||||
|
import net.tylermurphy.hideAndSeek.game.Status;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
import net.tylermurphy.hideAndSeek.Main;
|
import net.tylermurphy.hideAndSeek.Main;
|
||||||
import net.tylermurphy.hideAndSeek.events.Worldborder;
|
|
||||||
import net.tylermurphy.hideAndSeek.util.Packet;
|
|
||||||
import net.tylermurphy.hideAndSeek.util.Util;
|
import net.tylermurphy.hideAndSeek.util.Util;
|
||||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
|
import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
|
||||||
|
|
||||||
|
@ -23,14 +17,12 @@ public class Stop implements ICommand {
|
||||||
sender.sendMessage(errorPrefix + "Game is not setup. Run /hs setup to see what you needed to do");
|
sender.sendMessage(errorPrefix + "Game is not setup. Run /hs setup to see what you needed to do");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(Main.plugin.status.equals("Starting") || Main.plugin.status.equals("Playing")) {
|
if(Main.plugin.status == Status.STARTING || Main.plugin.status == Status.PLAYING) {
|
||||||
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("STOP"));
|
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("STOP"));
|
||||||
else Util.broadcastMessage(abortPrefix + message("STOP"));
|
else Util.broadcastMessage(abortPrefix + message("STOP"));
|
||||||
onStop();
|
Main.plugin.game.stop();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(errorPrefix + message("GAME_NOT_INPROGRESS"));
|
sender.sendMessage(errorPrefix + message("GAME_NOT_INPROGRESS"));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,30 +30,6 @@ public class Stop implements ICommand {
|
||||||
return "stop";
|
return "stop";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onStop() {
|
|
||||||
if(Main.plugin.status.equals("Standby")) return;
|
|
||||||
Main.plugin.status = "Standby";
|
|
||||||
Main.plugin.gameId++;
|
|
||||||
Main.plugin.timeLeft = 0;
|
|
||||||
Worldborder.resetWorldborder("hideandseek_"+spawnWorld);
|
|
||||||
for(Player player : Main.plugin.board.getPlayers()) {
|
|
||||||
Main.plugin.board.createLobbyBoard(player);
|
|
||||||
player.setGameMode(GameMode.ADVENTURE);
|
|
||||||
Main.plugin.board.addHider(player);
|
|
||||||
player.getInventory().clear();
|
|
||||||
player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
|
|
||||||
for(PotionEffect effect : player.getActivePotionEffects()){
|
|
||||||
player.removePotionEffect(effect.getType());
|
|
||||||
}
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 100));
|
|
||||||
for(Player temp : Main.plugin.board.getPlayers()) {
|
|
||||||
Packet.setGlow(player, temp, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Main.plugin.worldLoader.unloadMap();
|
|
||||||
Main.plugin.board.reloadLobbyBoards();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUsage() {
|
public String getUsage() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,8 @@ public class Config {
|
||||||
glowStackable,
|
glowStackable,
|
||||||
pvpEnabled,
|
pvpEnabled,
|
||||||
autoJoin,
|
autoJoin,
|
||||||
teleportToExit;
|
teleportToExit,
|
||||||
|
lobbyCountdownEnabled;
|
||||||
|
|
||||||
public static int
|
public static int
|
||||||
minPlayers,
|
minPlayers,
|
||||||
|
@ -50,7 +51,11 @@ public class Config {
|
||||||
saveMaxX,
|
saveMaxX,
|
||||||
saveMaxZ,
|
saveMaxZ,
|
||||||
tauntDelay,
|
tauntDelay,
|
||||||
glowLength;
|
glowLength,
|
||||||
|
countdown,
|
||||||
|
changeCountdown,
|
||||||
|
lobbyMin,
|
||||||
|
lobbyMax;
|
||||||
|
|
||||||
public static void loadConfig() {
|
public static void loadConfig() {
|
||||||
|
|
||||||
|
@ -121,10 +126,17 @@ public class Config {
|
||||||
glowStackable = manager.getBoolean("glow.stackable");
|
glowStackable = manager.getBoolean("glow.stackable");
|
||||||
glowEnabled = manager.getBoolean("glow.enabled");
|
glowEnabled = manager.getBoolean("glow.enabled");
|
||||||
|
|
||||||
|
//Lobby
|
||||||
|
minPlayers = Math.max(2, manager.getInt("minPlayers"));
|
||||||
|
countdown = Math.max(10,manager.getInt("lobby.countdown"));
|
||||||
|
changeCountdown = Math.max(minPlayers,manager.getInt("lobby.changeCountdown"));
|
||||||
|
lobbyMin = Math.max(minPlayers,manager.getInt("lobby.min"));
|
||||||
|
lobbyMax = manager.getInt("lobby.max");
|
||||||
|
lobbyCountdownEnabled = manager.getBoolean("lobby.enabled");
|
||||||
|
|
||||||
//Other
|
//Other
|
||||||
nametagsVisible = manager.getBoolean("nametagsVisible");
|
nametagsVisible = manager.getBoolean("nametagsVisible");
|
||||||
permissionsRequired = manager.getBoolean("permissionsRequired");
|
permissionsRequired = manager.getBoolean("permissionsRequired");
|
||||||
minPlayers = Math.max(2, manager.getInt("minPlayers"));
|
|
||||||
gameLength = manager.getInt("gameLength");
|
gameLength = manager.getInt("gameLength");
|
||||||
pvpEnabled = manager.getBoolean("pvp");
|
pvpEnabled = manager.getBoolean("pvp");
|
||||||
autoJoin = manager.getBoolean("autoJoin");
|
autoJoin = manager.getBoolean("autoJoin");
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class Glow {
|
||||||
this.glowTime = 0;
|
this.glowTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onProjectilve() {
|
public void onProjectile() {
|
||||||
if(glowStackable) glowTime += glowLength;
|
if(glowStackable) glowTime += glowLength;
|
||||||
else glowTime = glowLength;
|
else glowTime = glowLength;
|
||||||
if(!running)
|
if(!running)
|
||||||
|
@ -38,7 +38,7 @@ public class Glow {
|
||||||
|
|
||||||
private void waitGlow() {
|
private void waitGlow() {
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.plugin, () -> {
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.plugin, () -> {
|
||||||
if(temp != Main.plugin.gameId) return;
|
if(temp != Main.plugin.game.gameId) return;
|
||||||
glowTime--;
|
glowTime--;
|
||||||
glowTime = Math.max(glowTime, 0);
|
glowTime = Math.max(glowTime, 0);
|
||||||
if(glowTime == 0) {
|
if(glowTime == 0) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class Taunt {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executeTaunt() {
|
private void executeTaunt() {
|
||||||
if(temp != Main.plugin.gameId) return;
|
if(temp != Main.plugin.game.gameId) return;
|
||||||
Player taunted = null;
|
Player taunted = null;
|
||||||
int rand = (int) (Math.random()*Main.plugin.board.sizeHider());
|
int rand = (int) (Math.random()*Main.plugin.board.sizeHider());
|
||||||
for(Player player : Main.plugin.board.getPlayers()) {
|
for(Player player : Main.plugin.board.getPlayers()) {
|
||||||
|
@ -62,7 +62,7 @@ public class Taunt {
|
||||||
Util.broadcastMessage(tauntPrefix + message("TAUNT"));
|
Util.broadcastMessage(tauntPrefix + message("TAUNT"));
|
||||||
tauntPlayer = taunted.getName();
|
tauntPlayer = taunted.getName();
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.plugin, () -> {
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.plugin, () -> {
|
||||||
if(temp != Main.plugin.gameId) return;
|
if(temp != Main.plugin.game.gameId) return;
|
||||||
Player taunted1 = Main.plugin.board.getPlayer(tauntPlayer);
|
Player taunted1 = Main.plugin.board.getPlayer(tauntPlayer);
|
||||||
if(taunted1 != null) {
|
if(taunted1 != null) {
|
||||||
Firework fw = (Firework) taunted1.getLocation().getWorld().spawnEntity(taunted1.getLocation(), EntityType.FIREWORK);
|
Firework fw = (Firework) taunted1.getLocation().getWorld().spawnEntity(taunted1.getLocation(), EntityType.FIREWORK);
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class Worldborder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void decreaceWorldborder() {
|
private void decreaceWorldborder() {
|
||||||
if(temp != Main.plugin.gameId) return;
|
if(temp != Main.plugin.game.gameId) return;
|
||||||
if(currentWorldborderSize-100 > 100) {
|
if(currentWorldborderSize-100 > 100) {
|
||||||
running = true;
|
running = true;
|
||||||
Util.broadcastMessage(worldborderPrefix + message("WORLDBORDER_DECREASING"));
|
Util.broadcastMessage(worldborderPrefix + message("WORLDBORDER_DECREASING"));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package net.tylermurphy.hideAndSeek.bukkit;
|
package net.tylermurphy.hideAndSeek.game;
|
||||||
|
|
||||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public class EventListener implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onQuit(PlayerQuitEvent event) {
|
public void onQuit(PlayerQuitEvent event) {
|
||||||
Main.plugin.board.remove(event.getPlayer());
|
Main.plugin.board.remove(event.getPlayer());
|
||||||
if(Main.plugin.status.equals("Standby")) {
|
if(Main.plugin.status == Status.STANDBY) {
|
||||||
Main.plugin.board.reloadLobbyBoards();
|
Main.plugin.board.reloadLobbyBoards();
|
||||||
} else {
|
} else {
|
||||||
Main.plugin.board.reloadGameBoards();
|
Main.plugin.board.reloadGameBoards();
|
||||||
|
@ -70,7 +70,7 @@ public class EventListener implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onKick(PlayerKickEvent event) {
|
public void onKick(PlayerKickEvent event) {
|
||||||
Main.plugin.board.remove(event.getPlayer());
|
Main.plugin.board.remove(event.getPlayer());
|
||||||
if(Main.plugin.status.equals("Standby")) {
|
if(Main.plugin.status == Status.STANDBY) {
|
||||||
Main.plugin.board.reloadLobbyBoards();
|
Main.plugin.board.reloadLobbyBoards();
|
||||||
} else {
|
} else {
|
||||||
Main.plugin.board.reloadGameBoards();
|
Main.plugin.board.reloadGameBoards();
|
||||||
|
@ -86,7 +86,7 @@ public class EventListener implements Listener {
|
||||||
if (event.getEntity() instanceof Player) {
|
if (event.getEntity() instanceof Player) {
|
||||||
Player p = (Player) event.getEntity();
|
Player p = (Player) event.getEntity();
|
||||||
if (!Main.plugin.board.isPlayer(p)) return;
|
if (!Main.plugin.board.isPlayer(p)) return;
|
||||||
if (!Main.plugin.status.equals("Playing")) {
|
if (Main.plugin.status != Status.PLAYING) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -128,14 +128,14 @@ public class EventListener implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onProjectile(ProjectileLaunchEvent event) {
|
public void onProjectile(ProjectileLaunchEvent event) {
|
||||||
if(!Main.plugin.status.equals("Playing")) return;
|
if(Main.plugin.status != Status.PLAYING) return;
|
||||||
if(event.getEntity() instanceof Snowball) {
|
if(event.getEntity() instanceof Snowball) {
|
||||||
if(!glowEnabled) return;
|
if(!glowEnabled) return;
|
||||||
Snowball snowball = (Snowball) event.getEntity();
|
Snowball snowball = (Snowball) event.getEntity();
|
||||||
if(snowball.getShooter() instanceof Player) {
|
if(snowball.getShooter() instanceof Player) {
|
||||||
Player player = (Player) snowball.getShooter();
|
Player player = (Player) snowball.getShooter();
|
||||||
if(Main.plugin.board.isHider(player)) {
|
if(Main.plugin.board.isHider(player)) {
|
||||||
Main.plugin.glow.onProjectilve();
|
Main.plugin.game.glow.onProjectile();
|
||||||
snowball.remove();
|
snowball.remove();
|
||||||
player.getInventory().remove(Material.SNOWBALL);
|
player.getInventory().remove(Material.SNOWBALL);
|
||||||
}
|
}
|
227
src/main/java/net/tylermurphy/hideAndSeek/game/Game.java
Normal file
227
src/main/java/net/tylermurphy/hideAndSeek/game/Game.java
Normal file
|
@ -0,0 +1,227 @@
|
||||||
|
package net.tylermurphy.hideAndSeek.game;
|
||||||
|
|
||||||
|
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
import net.tylermurphy.hideAndSeek.events.Glow;
|
||||||
|
import net.tylermurphy.hideAndSeek.events.Taunt;
|
||||||
|
import net.tylermurphy.hideAndSeek.events.Worldborder;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import net.tylermurphy.hideAndSeek.Main;
|
||||||
|
import net.tylermurphy.hideAndSeek.util.Packet;
|
||||||
|
import net.tylermurphy.hideAndSeek.util.Util;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
|
||||||
|
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||||
|
|
||||||
|
public class Game {
|
||||||
|
|
||||||
|
public Taunt taunt;
|
||||||
|
public Glow glow;
|
||||||
|
public Worldborder worldborder;
|
||||||
|
|
||||||
|
private int tick = 0;
|
||||||
|
public int countdownTime = -1;
|
||||||
|
public int gameId = 0;
|
||||||
|
public int timeLeft = 0;
|
||||||
|
|
||||||
|
public void start(Player seeker){
|
||||||
|
if(Main.plugin.status == Status.STARTING || Main.plugin.status == Status.PLAYING) return;
|
||||||
|
if(Bukkit.getServer().getWorld("hideandseek_"+spawnWorld) != null) {
|
||||||
|
Main.plugin.worldLoader.rollback();
|
||||||
|
} else {
|
||||||
|
Main.plugin.worldLoader.loadMap();
|
||||||
|
}
|
||||||
|
Main.plugin.board.reload();
|
||||||
|
for(Player temp : Main.plugin.board.getPlayers()) {
|
||||||
|
if(temp.getName().equals(seeker.getName()))
|
||||||
|
continue;
|
||||||
|
Main.plugin.board.addHider(temp);
|
||||||
|
}
|
||||||
|
Main.plugin.board.addSeeker(seeker);
|
||||||
|
currentWorldborderSize = worldborderSize;
|
||||||
|
for(Player player : Main.plugin.board.getPlayers()) {
|
||||||
|
player.getInventory().clear();
|
||||||
|
player.setGameMode(GameMode.ADVENTURE);
|
||||||
|
player.teleport(new Location(Bukkit.getWorld("hideandseek_"+spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
|
||||||
|
for(PotionEffect effect : player.getActivePotionEffects()){
|
||||||
|
player.removePotionEffect(effect.getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(Player player : Main.plugin.board.getSeekers()) {
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,1000000,127,false,false));
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,1000000,127,false,false));
|
||||||
|
player.sendTitle(ChatColor.RED + "" + ChatColor.BOLD + "SEEKER", ChatColor.WHITE + message("SEEKERS_SUBTITLE").toString(), 10, 70, 20);
|
||||||
|
}
|
||||||
|
for(Player player : Main.plugin.board.getHiders()) {
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,1000000,5,false,false));
|
||||||
|
player.sendTitle(ChatColor.GOLD + "" + ChatColor.BOLD + "HIDER", ChatColor.WHITE + message("HIDERS_SUBTITLE").toString(), 10, 70, 20);
|
||||||
|
}
|
||||||
|
Worldborder.resetWorldborder("hideandseek_"+spawnWorld);
|
||||||
|
for(Player player : Main.plugin.board.getPlayers()){
|
||||||
|
Main.plugin.board.createGameBoard(player);
|
||||||
|
}
|
||||||
|
Main.plugin.board.reloadGameBoards();
|
||||||
|
Main.plugin.status = Status.STARTING;
|
||||||
|
int temp = Main.plugin.game.gameId;
|
||||||
|
Util.broadcastMessage(messagePrefix + message("START_COUNTDOWN").addAmount(30));
|
||||||
|
Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(20), Main.plugin.game.gameId, 20 * 10);
|
||||||
|
Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(10), Main.plugin.game.gameId, 20 * 20);
|
||||||
|
Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(5), Main.plugin.game.gameId, 20 * 25);
|
||||||
|
Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(3), Main.plugin.game.gameId, 20 * 27);
|
||||||
|
Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(2), Main.plugin.game.gameId, 20 * 28);
|
||||||
|
Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(1), Main.plugin.game.gameId, 20 * 29);
|
||||||
|
Bukkit.getServer().getScheduler().runTaskLater(Main.plugin, new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
if(temp != Main.plugin.game.gameId) return;
|
||||||
|
Util.broadcastMessage(messagePrefix + message("START"));
|
||||||
|
Main.plugin.status = Status.PLAYING;
|
||||||
|
for(Player player : Main.plugin.board.getPlayers()) {
|
||||||
|
Util.resetPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(worldborderEnabled) {
|
||||||
|
worldborder = new Worldborder(Main.plugin.game.gameId);
|
||||||
|
worldborder.schedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tauntEnabled) {
|
||||||
|
taunt = new Taunt(Main.plugin.game.gameId);
|
||||||
|
taunt.schedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (glowEnabled) {
|
||||||
|
glow = new Glow(Main.plugin.game.gameId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(gameLength > 0) {
|
||||||
|
timeLeft = gameLength;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 20 * 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stop(){
|
||||||
|
if(Main.plugin.status == Status.STANDBY) return;
|
||||||
|
tick = 0;
|
||||||
|
countdownTime = -1;
|
||||||
|
Main.plugin.status = Status.STANDBY;
|
||||||
|
Main.plugin.game.gameId++;
|
||||||
|
timeLeft = 0;
|
||||||
|
Worldborder.resetWorldborder("hideandseek_"+spawnWorld);
|
||||||
|
for(Player player : Main.plugin.board.getPlayers()) {
|
||||||
|
Main.plugin.board.createLobbyBoard(player);
|
||||||
|
player.setGameMode(GameMode.ADVENTURE);
|
||||||
|
Main.plugin.board.addHider(player);
|
||||||
|
player.getInventory().clear();
|
||||||
|
player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
|
||||||
|
for(PotionEffect effect : player.getActivePotionEffects()){
|
||||||
|
player.removePotionEffect(effect.getType());
|
||||||
|
}
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 100));
|
||||||
|
for(Player temp : Main.plugin.board.getPlayers()) {
|
||||||
|
Packet.setGlow(player, temp, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Main.plugin.worldLoader.unloadMap();
|
||||||
|
Main.plugin.board.reloadLobbyBoards();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onTick() {
|
||||||
|
|
||||||
|
if(!Util.isSetup()) return;
|
||||||
|
|
||||||
|
if(Main.plugin.status == Status.STANDBY) whileWaiting();
|
||||||
|
else if(Main.plugin.status == Status.PLAYING) whilePlaying();
|
||||||
|
|
||||||
|
if(( Main.plugin.status == Status.STARTING || Main.plugin.status == Status.PLAYING ) && Main.plugin.board.sizeHider() < 1) {
|
||||||
|
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND"));
|
||||||
|
else Util.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND"));
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
if(( Main.plugin.status == Status.STARTING || Main.plugin.status == Status.PLAYING ) && Main.plugin.board.sizeSeeker() < 1) {
|
||||||
|
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT"));
|
||||||
|
else Util.broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT"));
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
tick++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void whileWaiting() {
|
||||||
|
if(lobbyCountdownEnabled){
|
||||||
|
if(lobbyMin <= Main.plugin.board.size()){
|
||||||
|
if(countdownTime == -1)
|
||||||
|
countdownTime = countdown;
|
||||||
|
if(Main.plugin.board.size() >= changeCountdown)
|
||||||
|
countdownTime = Math.min(countdownTime, 10);
|
||||||
|
if(tick % 20 == 0)
|
||||||
|
countdownTime--;
|
||||||
|
if(countdownTime == 0){
|
||||||
|
String seekerName = Main.plugin.board.getPlayers().stream().skip(new Random().nextInt(Main.plugin.board.size())).findFirst().get().getName();
|
||||||
|
Player seeker = Main.plugin.board.getPlayer(seekerName);
|
||||||
|
start(seeker);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
countdownTime = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void whilePlaying() {
|
||||||
|
|
||||||
|
for(Player hider : Main.plugin.board.getHiders()) {
|
||||||
|
int distance = 100, temp = 100;
|
||||||
|
for(Player seeker : Main.plugin.board.getSeekers()) {
|
||||||
|
try {
|
||||||
|
temp = (int) hider.getLocation().distance(seeker.getLocation());
|
||||||
|
} catch (Exception e){
|
||||||
|
//Players in different worlds, NOT OK!!!
|
||||||
|
}
|
||||||
|
if(distance > temp) {
|
||||||
|
distance = temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch(tick%10) {
|
||||||
|
case 0:
|
||||||
|
if(distance < 30) Packet.playSound(hider, Sound.BLOCK_NOTE_BLOCK_BASEDRUM, .5f, 1f);
|
||||||
|
if(distance < 10) Packet.playSound(hider, Sound.BLOCK_NOTE_BLOCK_BIT, .3f, 1f);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if(distance < 30) Packet.playSound(hider, Sound.BLOCK_NOTE_BLOCK_BASEDRUM, .3f, 1f);
|
||||||
|
if(distance < 10) Packet.playSound(hider, Sound.BLOCK_NOTE_BLOCK_BIT, .3f, 1f);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
if(distance < 10) Packet.playSound(hider, Sound.BLOCK_NOTE_BLOCK_BIT, .3f, 1f);
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
if(distance < 20) Packet.playSound(hider, Sound.BLOCK_NOTE_BLOCK_BIT, .3f, 1f);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tick%20 == 0) {
|
||||||
|
if(gameLength > 0) {
|
||||||
|
Main.plugin.board.reloadGameBoards();
|
||||||
|
timeLeft--;
|
||||||
|
if(timeLeft < 1) {
|
||||||
|
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_TIME"));
|
||||||
|
else Util.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_TIME"));
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package net.tylermurphy.hideAndSeek.game;
|
||||||
|
|
||||||
|
public enum Status {
|
||||||
|
STANDBY,
|
||||||
|
STARTING,
|
||||||
|
PLAYING
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import net.tylermurphy.hideAndSeek.game.Status;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -25,8 +26,8 @@ import net.tylermurphy.hideAndSeek.Main;
|
||||||
public class Board {
|
public class Board {
|
||||||
|
|
||||||
private List<String> Hider, Seeker, Spectator;
|
private List<String> Hider, Seeker, Spectator;
|
||||||
private Map<String, Player> playerList = new HashMap<String,Player>();
|
private Map<String, Player> playerList = new HashMap<>();
|
||||||
private Map<String, CustomBoard> customBoards = new HashMap<String, CustomBoard>();
|
private Map<String, CustomBoard> customBoards = new HashMap<>();
|
||||||
|
|
||||||
public boolean isPlayer(Player player) {
|
public boolean isPlayer(Player player) {
|
||||||
return playerList.containsKey(player.getName());
|
return playerList.containsKey(player.getName());
|
||||||
|
@ -120,31 +121,9 @@ public class Board {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reload() {
|
public void reload() {
|
||||||
Hider = new ArrayList<String>();
|
Hider = new ArrayList<>();
|
||||||
Seeker = new ArrayList<String>();
|
Seeker = new ArrayList<>();
|
||||||
Spectator = new ArrayList<String>();
|
Spectator = new ArrayList<>();
|
||||||
}
|
|
||||||
|
|
||||||
public void reset() {
|
|
||||||
Hider.clear();
|
|
||||||
Seeker.clear();
|
|
||||||
Spectator.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createTeamsForBoard(Scoreboard board) {
|
|
||||||
Team hiderTeam = board.registerNewTeam("Hider");
|
|
||||||
for(String name : Hider)
|
|
||||||
hiderTeam.addEntry(name);
|
|
||||||
Team seekerTeam = board.registerNewTeam("Seeker");
|
|
||||||
for(String name : Seeker)
|
|
||||||
seekerTeam.addEntry(name);
|
|
||||||
if(nametagsVisible) {
|
|
||||||
hiderTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.FOR_OWN_TEAM);
|
|
||||||
seekerTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.FOR_OTHER_TEAMS);
|
|
||||||
} else {
|
|
||||||
hiderTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
|
|
||||||
seekerTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createLobbyBoard(Player player) {
|
public void createLobbyBoard(Player player) {
|
||||||
|
@ -162,7 +141,15 @@ public class Board {
|
||||||
board.addBlank();
|
board.addBlank();
|
||||||
board.setLine("players", "Players: " + playerList.values().size());
|
board.setLine("players", "Players: " + playerList.values().size());
|
||||||
board.addBlank();
|
board.addBlank();
|
||||||
board.setLine("waiting", "Waiting to start...");
|
if(lobbyCountdownEnabled){
|
||||||
|
if(Main.plugin.game.countdownTime == -1){
|
||||||
|
board.setLine("waiting", "Waiting for players...");
|
||||||
|
} else {
|
||||||
|
board.setLine("waiting", "Starting in: "+ChatColor.GREEN + Main.plugin.game.countdownTime+"s");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
board.setLine("waiting", "Waiting for gamemaster...");
|
||||||
|
}
|
||||||
board.display();
|
board.display();
|
||||||
customBoards.put(player.getName(), board);
|
customBoards.put(player.getName(), board);
|
||||||
}
|
}
|
||||||
|
@ -175,38 +162,39 @@ public class Board {
|
||||||
CustomBoard board = customBoards.get(player.getName());
|
CustomBoard board = customBoards.get(player.getName());
|
||||||
if(recreate) {
|
if(recreate) {
|
||||||
board = new CustomBoard(player, "&l&eHIDE AND SEEK");
|
board = new CustomBoard(player, "&l&eHIDE AND SEEK");
|
||||||
|
board.updateTeams();
|
||||||
}
|
}
|
||||||
board.setLine("hiders", ChatColor.BOLD + "" + ChatColor.YELLOW + "HIDERS:" + ChatColor.WHITE + " " + Hider.size());
|
board.setLine("hiders", ChatColor.BOLD + "" + ChatColor.YELLOW + "HIDERS:" + ChatColor.WHITE + " " + Hider.size());
|
||||||
board.setLine("seekers", ChatColor.BOLD + "" + ChatColor.RED + "SEEKERS:" + ChatColor.WHITE + " " + Seeker.size());
|
board.setLine("seekers", ChatColor.BOLD + "" + ChatColor.RED + "SEEKERS:" + ChatColor.WHITE + " " + Seeker.size());
|
||||||
board.addBlank();
|
board.addBlank();
|
||||||
if(glowEnabled){
|
if(glowEnabled){
|
||||||
if(Main.plugin.glow == null || Main.plugin.status.equals("Starting") || !Main.plugin.glow.isRunning())
|
if(Main.plugin.game.glow == null || Main.plugin.status == Status.STARTING || !Main.plugin.game.glow.isRunning())
|
||||||
board.setLine("glow", "Glow: " + ChatColor.RED + "Inactive");
|
board.setLine("glow", "Glow: " + ChatColor.RED + "Inactive");
|
||||||
else
|
else
|
||||||
board.setLine("glow", "Glow: " + ChatColor.GREEN + "Active");
|
board.setLine("glow", "Glow: " + ChatColor.GREEN + "Active");
|
||||||
}
|
}
|
||||||
if(tauntEnabled && tauntCountdown){
|
if(tauntEnabled && tauntCountdown){
|
||||||
if(Main.plugin.taunt == null || Main.plugin.status.equals("Starting"))
|
if(Main.plugin.game.taunt == null || Main.plugin.status == Status.STARTING)
|
||||||
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + "0m0s");
|
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + "0m0s");
|
||||||
else if(!tauntLast && Hider.size() == 1){
|
else if(!tauntLast && Hider.size() == 1){
|
||||||
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + "Expired");
|
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + "Expired");
|
||||||
} else if(!Main.plugin.taunt.isRunning())
|
} else if(!Main.plugin.game.taunt.isRunning())
|
||||||
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + Main.plugin.taunt.getDelay()/60 + "m" + Main.plugin.taunt.getDelay()%60 + "s");
|
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + Main.plugin.game.taunt.getDelay()/60 + "m" + Main.plugin.game.taunt.getDelay()%60 + "s");
|
||||||
else
|
else
|
||||||
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + "Active");
|
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + "Active");
|
||||||
}
|
}
|
||||||
if(worldborderEnabled){
|
if(worldborderEnabled){
|
||||||
if(Main.plugin.worldborder == null || Main.plugin.status.equals("Starting")){
|
if(Main.plugin.game.worldborder == null || Main.plugin.status == Status.STARTING){
|
||||||
board.setLine("board", "WorldBorder: " + ChatColor.YELLOW + "0m0s");
|
board.setLine("board", "WorldBorder: " + ChatColor.YELLOW + "0m0s");
|
||||||
} else if(!Main.plugin.worldborder.isRunning()) {
|
} else if(!Main.plugin.game.worldborder.isRunning()) {
|
||||||
board.setLine("board", "WorldBorder: " + ChatColor.YELLOW + Main.plugin.worldborder.getDelay()/60 + "m" + Main.plugin.worldborder.getDelay()%60 + "s");
|
board.setLine("board", "WorldBorder: " + ChatColor.YELLOW + Main.plugin.game.worldborder.getDelay()/60 + "m" + Main.plugin.game.worldborder.getDelay()%60 + "s");
|
||||||
} else {
|
} else {
|
||||||
board.setLine("board", "WorldBorder: " + ChatColor.YELLOW + "Decreasing");
|
board.setLine("board", "WorldBorder: " + ChatColor.YELLOW + "Decreasing");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(glowEnabled || (tauntEnabled && tauntCountdown) || worldborderEnabled)
|
if(glowEnabled || (tauntEnabled && tauntCountdown) || worldborderEnabled)
|
||||||
board.addBlank();
|
board.addBlank();
|
||||||
board.setLine("time", "Time Left: " + ChatColor.GREEN + Main.plugin.timeLeft/60 + "m" + Main.plugin.timeLeft%60 + "s");
|
board.setLine("time", "Time Left: " + ChatColor.GREEN + Main.plugin.game.timeLeft/60 + "m" + Main.plugin.game.timeLeft%60 + "s");
|
||||||
board.addBlank();
|
board.addBlank();
|
||||||
board.setLine("team", "Team: " + getTeam(player));
|
board.setLine("team", "Team: " + getTeam(player));
|
||||||
board.display();
|
board.display();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package net.tylermurphy.hideAndSeek.bukkit;
|
package net.tylermurphy.hideAndSeek.util;
|
||||||
|
|
||||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||||
import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
|
import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
|
|
@ -1,4 +1,4 @@
|
||||||
package net.tylermurphy.hideAndSeek.bukkit;
|
package net.tylermurphy.hideAndSeek.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -45,7 +45,7 @@ public class Util {
|
||||||
public static void sendDelayedMessage(String message, int gameId, int delay) {
|
public static void sendDelayedMessage(String message, int gameId, int delay) {
|
||||||
Bukkit.getScheduler().runTaskLaterAsynchronously(Main.plugin, new Runnable() {
|
Bukkit.getScheduler().runTaskLaterAsynchronously(Main.plugin, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if(gameId == Main.plugin.gameId)
|
if(gameId == Main.plugin.game.gameId)
|
||||||
Util.broadcastMessage(message);
|
Util.broadcastMessage(message);
|
||||||
}
|
}
|
||||||
}, delay);
|
}, delay);
|
||||||
|
|
|
@ -79,9 +79,21 @@ prefix:
|
||||||
gameover: '&aGame Over > &f'
|
gameover: '&aGame Over > &f'
|
||||||
warning: '&cWarning > &f'
|
warning: '&cWarning > &f'
|
||||||
|
|
||||||
|
# This is the section if you want a standard "waiting for players" lobby. You can specify
|
||||||
|
# the standard countdown length under [countdown] (min 10 seconds). Then once the lobby gets to a size specified
|
||||||
|
# by [changeCountdown], the timer will automatically go to 10 seconds. [min] is the minimum players
|
||||||
|
# to start the countdown. [max] is the lobby cap, set to -1 to remove maximum cap.
|
||||||
|
lobby:
|
||||||
|
countdown: 60
|
||||||
|
changeCountdown: 5
|
||||||
|
min: 3
|
||||||
|
max: 10
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
|
||||||
# Changes the default plugin language. Currently, Supported localizations are:
|
# Changes the default plugin language. Currently, Supported localizations are:
|
||||||
# en-US (United States)
|
# en-US (English - United States)
|
||||||
# de-DE (German)
|
# de-DE (German - Germany)
|
||||||
local: "en-US"
|
local: "en-US"
|
||||||
|
|
||||||
# ---------------------------------------------------------- #
|
# ---------------------------------------------------------- #
|
||||||
|
|
Loading…
Reference in a new issue