1.3.0 final beta

This commit is contained in:
Tyler Murphy 2021-10-21 18:26:38 -04:00
parent d076b77686
commit 91311dd23d
4 changed files with 22 additions and 33 deletions

View file

@ -12,6 +12,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
@ -52,7 +53,7 @@ public class EventListener implements Listener {
Main.plugin.board.remove(event.getPlayer());
}
@EventHandler
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntityDamage(EntityDamageEvent event) {
if(event.getEntity() instanceof Player) {
Player p = (Player) event.getEntity();
@ -93,7 +94,7 @@ public class EventListener implements Listener {
}
}
@EventHandler
@EventHandler(priority = EventPriority.HIGHEST)
public void onProjectile(ProjectileLaunchEvent event) {
if(!Main.plugin.status.equals("Playing")) return;
if(event.getEntity() instanceof Snowball) {
@ -109,7 +110,7 @@ public class EventListener implements Listener {
}
}
@EventHandler
@EventHandler(priority = EventPriority.HIGHEST)
public void onFoodLevelChange(FoodLevelChangeEvent event) {
if(event.getEntity() instanceof Player) {
if(!Main.plugin.board.isPlayer((Player) event.getEntity())) return;
@ -117,7 +118,7 @@ public class EventListener implements Listener {
}
}
@EventHandler
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerRegainHealth(EntityRegainHealthEvent event) {
if(event.getRegainReason() == RegainReason.SATIATED || event.getRegainReason() == RegainReason.REGEN) {
if(event.getEntity() instanceof Player) {

View file

@ -28,9 +28,9 @@ public class Leave implements ICommand {
}
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + sender.getName() + " has left the HideAndSeek lobby");
else Util.broadcastMessage(messagePrefix + sender.getName() + " has left the HideAndSeek lobby");
Main.plugin.board.removeBoard(player);
Main.plugin.board.remove(player);
player.teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ()));
Main.plugin.board.removeBoard(player);
if(Main.plugin.status.equals("Standby")) {
Main.plugin.board.reloadLobbyBoards();
} else {

View file

@ -41,6 +41,7 @@ public class Stop implements ICommand {
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()) {
player.setGameMode(GameMode.ADVENTURE);

View file

@ -60,7 +60,7 @@ public class Board {
}
public int size() {
return playerList.size();
return playerList.values().size();
}
public List<Player> getHiders(){
@ -87,36 +87,27 @@ public class Board {
Hider.add(player.getName());
Seeker.remove(player.getName());
Spectator.remove(player.getName());
//HiderTeam.addEntry(player.getName());
if(!playerList.containsKey(player.getName()))
playerList.put(player.getName(), player);
playerList.put(player.getName(), player);
}
public void addSeeker(Player player) {
Hider.remove(player.getName());
Seeker.add(player.getName());
Spectator.remove(player.getName());
//SeekerTeam.addEntry(player.getName());
if(!playerList.containsKey(player.getName()))
playerList.put(player.getName(), player);
playerList.put(player.getName(), player);
}
public void addSpectator(Player player) {
Hider.remove(player.getName());
Seeker.remove(player.getName());
Spectator.add(player.getName());
//SpectatorTeam.addEntry(player.getName());
if(!playerList.containsKey(player.getName()))
playerList.put(player.getName(), player);
playerList.put(player.getName(), player);
}
public void remove(Player player) {
Hider.remove(player.getName());
Seeker.remove(player.getName());
Spectator.remove(player.getName());
//HiderTeam.removeEntry(player.getName());
//SeekerTeam.removeEntry(player.getName());
//SpectatorTeam.removeEntry(player.getName());
playerList.remove(player.getName());
}
@ -137,12 +128,6 @@ public class Board {
Hider.clear();
Seeker.clear();
Spectator.clear();
// for(String entry : HiderTeam.getEntries())
// HiderTeam.removeEntry(entry);
// for(String entry : SeekerTeam.getEntries())
// SeekerTeam.removeEntry(entry);
// for(String entry : SpectatorTeam.getEntries())
// SpectatorTeam.removeEntry(entry);
}
private void createTeamsForBoard(Scoreboard board) {
@ -172,7 +157,7 @@ public class Board {
waiting.setScore(6);
Score blank1 = obj.getScore(ChatColor.RESET.toString());
blank1.setScore(5);
Score players = obj.getScore("Players: "+playerList.size());
Score players = obj.getScore("Players: "+playerList.values().size());
players.setScore(4);
Score blank2 = obj.getScore(ChatColor.RESET.toString() + ChatColor.RESET.toString());
blank2.setScore(3);
@ -193,13 +178,15 @@ public class Board {
team.setScore(6);
Score blank1 = obj.getScore(ChatColor.RESET.toString());
blank1.setScore(5);
Score waiting = obj.getScore(ChatColor.GREEN + "Time Left: " + ChatColor.WHITE + Main.plugin.timeLeft/60 + "m" + Main.plugin.timeLeft%60 + "s");
waiting.setScore(4);
Score blank2 = obj.getScore(ChatColor.RESET.toString() + ChatColor.RESET.toString());
blank2.setScore(3);
Score seeker = obj.getScore(ChatColor.BOLD + "" + ChatColor.RED + "SEEKERS:" + ChatColor.WHITE + Seeker.size());
if(gameLength > 0) {
Score waiting = obj.getScore(ChatColor.GREEN + "Time Left: " + ChatColor.WHITE + Main.plugin.timeLeft/60 + "m" + Main.plugin.timeLeft%60 + "s");
waiting.setScore(4);
Score blank2 = obj.getScore(ChatColor.RESET.toString() + ChatColor.RESET.toString());
blank2.setScore(3);
}
Score seeker = obj.getScore(ChatColor.BOLD + "" + ChatColor.RED + "SEEKERS:" + ChatColor.WHITE + " " + Seeker.size());
seeker.setScore(2);
Score hider = obj.getScore(ChatColor.BOLD + "" + ChatColor.GOLD + "HIDERS:" + ChatColor.WHITE + Hider.size());
Score hider = obj.getScore(ChatColor.BOLD + "" + ChatColor.GOLD + "HIDERS:" + ChatColor.WHITE + " " + Hider.size());
hider.setScore(1);
player.setScoreboard(board);
}
@ -219,7 +206,7 @@ public class Board {
}
private String getSeekerPercent() {
if(playerList.size() < 2)
if(playerList.values().size() < 2)
return " --";
else
return " "+(int)(100*(1.0/playerList.size()));