lobby bug fixes, titles, game time
This commit is contained in:
parent
761550ac89
commit
d37ad3fc45
16 changed files with 315 additions and 330 deletions
|
@ -1,7 +1,5 @@
|
||||||
package net.tylermurphy.hideAndSeek;
|
package net.tylermurphy.hideAndSeek;
|
||||||
|
|
||||||
import static net.tylermurphy.hideAndSeek.Store.*;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -9,7 +7,6 @@ import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.Listener;
|
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;
|
||||||
|
@ -39,9 +36,6 @@ public class Main extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
// Setup Initial Player Count
|
// Setup Initial Player Count
|
||||||
getServer().getPluginManager().registerEvents(new EventListener(), this);
|
getServer().getPluginManager().registerEvents(new EventListener(), this);
|
||||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
|
||||||
playerList.put(player.getName(), player);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Init Configuration
|
// Init Configuration
|
||||||
Store.loadConfig();
|
Store.loadConfig();
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
package net.tylermurphy.hideAndSeek;
|
package net.tylermurphy.hideAndSeek;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -20,13 +18,11 @@ public class Store {
|
||||||
public static Map<String,Player>
|
public static Map<String,Player>
|
||||||
playerList = new HashMap<String,Player>();
|
playerList = new HashMap<String,Player>();
|
||||||
|
|
||||||
public static Map<String,Location>
|
|
||||||
playerLastLocationList = new HashMap<String,Location>();
|
|
||||||
|
|
||||||
public static List<String>
|
public static List<String>
|
||||||
Hider = new ArrayList<String>(),
|
Hider = new ArrayList<String>(),
|
||||||
Seeker = new ArrayList<String>(),
|
Seeker = new ArrayList<String>(),
|
||||||
Spectator = new ArrayList<String>();
|
Spectator = new ArrayList<String>(),
|
||||||
|
Deaths = new ArrayList<String>();
|
||||||
|
|
||||||
public static Scoreboard
|
public static Scoreboard
|
||||||
board;
|
board;
|
||||||
|
@ -45,30 +41,21 @@ public class Store {
|
||||||
gameoverPrefix,
|
gameoverPrefix,
|
||||||
warningPrefix,
|
warningPrefix,
|
||||||
spawnWorld,
|
spawnWorld,
|
||||||
|
exitWorld,
|
||||||
|
lobbyWorld,
|
||||||
status = "Standby";
|
status = "Standby";
|
||||||
|
|
||||||
public static Vector
|
public static Vector
|
||||||
spawnPosition,
|
spawnPosition,
|
||||||
lobbyPosition,
|
lobbyPosition,
|
||||||
|
exitPosition,
|
||||||
worldborderPosition;
|
worldborderPosition;
|
||||||
|
|
||||||
public static List<String>
|
|
||||||
blockedCommands;
|
|
||||||
|
|
||||||
public static boolean
|
public static boolean
|
||||||
nametagsVisible,
|
nametagsVisible,
|
||||||
permissionsRequired,
|
permissionsRequired,
|
||||||
lobbyManualJoin,
|
announceMessagesToNonPlayers,
|
||||||
lobbyAnnounced,
|
|
||||||
lobbyStarted = false,
|
lobbyStarted = false,
|
||||||
unbreakableArmorstands,
|
|
||||||
unbreakablePaintings,
|
|
||||||
unbreakableItemframes,
|
|
||||||
interactableArmorstands,
|
|
||||||
interactableItemframes,
|
|
||||||
interactableDoors,
|
|
||||||
interactableTrapdoors,
|
|
||||||
interactableFencegate,
|
|
||||||
worldborderEnabled = false,
|
worldborderEnabled = false,
|
||||||
runningBackup = false;
|
runningBackup = false;
|
||||||
|
|
||||||
|
@ -77,7 +64,9 @@ public class Store {
|
||||||
gameId = 0,
|
gameId = 0,
|
||||||
worldborderSize,
|
worldborderSize,
|
||||||
worldborderDelay,
|
worldborderDelay,
|
||||||
currentWorldborderSize;
|
currentWorldborderSize,
|
||||||
|
gameLength,
|
||||||
|
timeLeft = 0;
|
||||||
|
|
||||||
public static FileConfiguration getConfig() {
|
public static FileConfiguration getConfig() {
|
||||||
return Main.plugin.getConfig();
|
return Main.plugin.getConfig();
|
||||||
|
@ -92,16 +81,11 @@ public class Store {
|
||||||
Main.plugin.reloadConfig();
|
Main.plugin.reloadConfig();
|
||||||
|
|
||||||
//Default
|
//Default
|
||||||
getConfig().addDefault("spawn.x", 0);
|
|
||||||
getConfig().addDefault("spawn.y", 0);
|
|
||||||
getConfig().addDefault("spawn.z", 0);
|
|
||||||
getConfig().addDefault("spawn.world", "world");
|
|
||||||
getConfig().addDefault("worldBorder.x", 0);
|
getConfig().addDefault("worldBorder.x", 0);
|
||||||
getConfig().addDefault("worldBorder.z", 0);
|
getConfig().addDefault("worldBorder.z", 0);
|
||||||
getConfig().addDefault("worldBorder.delay", 10);
|
getConfig().addDefault("worldBorder.delay", 10);
|
||||||
getConfig().addDefault("worldBorder.size", 500);
|
getConfig().addDefault("worldBorder.size", 500);
|
||||||
getConfig().addDefault("worldBorder.enabled", false);
|
getConfig().addDefault("worldBorder.enabled", false);
|
||||||
getConfig().addDefault("blockedCommands", Arrays.asList("whisper","msg"));
|
|
||||||
getConfig().addDefault("prefix.default", "&9Hide and Seek > &f");
|
getConfig().addDefault("prefix.default", "&9Hide and Seek > &f");
|
||||||
getConfig().addDefault("prefix.error", "&cError > &f");
|
getConfig().addDefault("prefix.error", "&cError > &f");
|
||||||
getConfig().addDefault("prefix.taunt", "&eTaunt > &f");
|
getConfig().addDefault("prefix.taunt", "&eTaunt > &f");
|
||||||
|
@ -111,35 +95,46 @@ public class Store {
|
||||||
getConfig().addDefault("prefix.warning", "&cWarning > &f");
|
getConfig().addDefault("prefix.warning", "&cWarning > &f");
|
||||||
getConfig().addDefault("nametagsVisible", false);
|
getConfig().addDefault("nametagsVisible", false);
|
||||||
getConfig().addDefault("permissionsRequired", true);
|
getConfig().addDefault("permissionsRequired", true);
|
||||||
getConfig().addDefault("lobby.manualJoin", false);
|
getConfig().addDefault("announceMessagesToNonPlayers", false);
|
||||||
getConfig().addDefault("lobby.announceJoinAndLeave", false);
|
getConfig().addDefault("spawns.lobby.x", 0);
|
||||||
getConfig().addDefault("lobby.spawn.x", 0);
|
getConfig().addDefault("spawns.lobby.y", 0);
|
||||||
getConfig().addDefault("lobby.spawn.y", 0);
|
getConfig().addDefault("spawns.lobby.z", 0);
|
||||||
getConfig().addDefault("lobby.spawn.z", 0);
|
getConfig().addDefault("spawns.lobby.world", "world");
|
||||||
getConfig().addDefault("blockSettings.unbreakable.painting", false);
|
getConfig().addDefault("spawns.exit.x", 0);
|
||||||
getConfig().addDefault("blockSettings.unbreakable.armorstand", false);
|
getConfig().addDefault("spawns.exit.y", 0);
|
||||||
getConfig().addDefault("blockSettings.unbreakable.itemframe", false);
|
getConfig().addDefault("spawns.exit.z", 0);
|
||||||
getConfig().addDefault("blockSettings.interactable.armorstand", true);
|
getConfig().addDefault("spawns.exit.world", "world");
|
||||||
getConfig().addDefault("blockSettings.interactable.itemframe", true);
|
getConfig().addDefault("spawns.game.x", 0);
|
||||||
getConfig().addDefault("blockSettings.interactable.door", true);
|
getConfig().addDefault("spawns.game.y", 0);
|
||||||
getConfig().addDefault("blockSettings.interactable.trapdoor", true);
|
getConfig().addDefault("spawns.game.z", 0);
|
||||||
getConfig().addDefault("blockSettings.interactable.fence", true);
|
getConfig().addDefault("spawns.game.world", "world");
|
||||||
getConfig().addDefault("minPlayers", 2);
|
getConfig().addDefault("minPlayers", 2);
|
||||||
|
getConfig().addDefault("gameLength", 600);
|
||||||
|
|
||||||
//Spawn
|
//Spawn
|
||||||
spawnPosition = new Vector(
|
spawnPosition = new Vector(
|
||||||
getConfig().getDouble("spawn.x"),
|
getConfig().getDouble("spawns.game.x"),
|
||||||
Math.max(0,Math.min(255,getConfig().getDouble("spawn.y"))),
|
Math.max(0,Math.min(255,getConfig().getDouble("spawns.game.y"))),
|
||||||
getConfig().getDouble("spawn.z")
|
getConfig().getDouble("spawns.game.z")
|
||||||
);
|
);
|
||||||
spawnWorld = getConfig().getString("spawn.world");
|
spawnWorld = getConfig().getString("spawns.game.world");
|
||||||
|
|
||||||
///Lobby
|
///Lobby
|
||||||
lobbyPosition = new Vector(
|
lobbyPosition = new Vector(
|
||||||
getConfig().getDouble("lobby.spawn.x"),
|
getConfig().getDouble("spawns.lobby.x"),
|
||||||
Math.max(0,Math.min(255,getConfig().getDouble("lobby.spawn.y"))),
|
Math.max(0,Math.min(255,getConfig().getDouble("spawns.lobby.y"))),
|
||||||
getConfig().getDouble("lobby.spawn.z")
|
getConfig().getDouble("spawns.lobby.z")
|
||||||
);
|
);
|
||||||
|
lobbyWorld = getConfig().getString("spawns.lobby.world");
|
||||||
|
|
||||||
|
announceMessagesToNonPlayers = getConfig().getBoolean("announceMessagesToNonPlayers");
|
||||||
|
|
||||||
|
exitPosition = new Vector(
|
||||||
|
getConfig().getDouble("spawns.exit.x"),
|
||||||
|
Math.max(0,Math.min(255,getConfig().getDouble("spawns.exit.y"))),
|
||||||
|
getConfig().getDouble("spawns.exit.z")
|
||||||
|
);
|
||||||
|
exitWorld = getConfig().getString("spawns.exit.world");
|
||||||
|
|
||||||
//World border
|
//World border
|
||||||
worldborderPosition = new Vector(
|
worldborderPosition = new Vector(
|
||||||
|
@ -150,8 +145,6 @@ public class Store {
|
||||||
worldborderSize = Math.max(100,getConfig().getInt("worldBorder.size"));
|
worldborderSize = Math.max(100,getConfig().getInt("worldBorder.size"));
|
||||||
worldborderDelay = Math.max(1,getConfig().getInt("worldBorder.delay"));
|
worldborderDelay = Math.max(1,getConfig().getInt("worldBorder.delay"));
|
||||||
worldborderEnabled = getConfig().getBoolean("worldBorder.enabled");
|
worldborderEnabled = getConfig().getBoolean("worldBorder.enabled");
|
||||||
blockedCommands = getConfig().getStringList("blockedCommands");
|
|
||||||
blockedCommands.add("team");
|
|
||||||
|
|
||||||
//Prefix
|
//Prefix
|
||||||
char SYMBOLE = '\u00A7';
|
char SYMBOLE = '\u00A7';
|
||||||
|
@ -168,16 +161,8 @@ public class Store {
|
||||||
//Other
|
//Other
|
||||||
nametagsVisible = getConfig().getBoolean("nametagsVisible");
|
nametagsVisible = getConfig().getBoolean("nametagsVisible");
|
||||||
permissionsRequired = getConfig().getBoolean("permissionsRequired");
|
permissionsRequired = getConfig().getBoolean("permissionsRequired");
|
||||||
lobbyManualJoin = getConfig().getBoolean("lobby.manualJoin");
|
|
||||||
unbreakablePaintings = getConfig().getBoolean("blockSettings.unbreakable.painting");
|
|
||||||
unbreakableArmorstands = getConfig().getBoolean("blockSettings.unbreakable.armorstand");
|
|
||||||
unbreakableItemframes = getConfig().getBoolean("blockSettings.unbreakable.itemframe");
|
|
||||||
interactableArmorstands = getConfig().getBoolean("blockSettings.interactable.armorstand");
|
|
||||||
interactableItemframes = getConfig().getBoolean("blockSettings.interactable.itemframe");
|
|
||||||
interactableDoors = getConfig().getBoolean("blockSettings.interactable.door");
|
|
||||||
interactableTrapdoors = getConfig().getBoolean("blockSettings.interactable.trapdoor");
|
|
||||||
interactableFencegate = getConfig().getBoolean("blockSettings.interactable.fence");
|
|
||||||
minPlayers = Math.max(2,getConfig().getInt("minPlayers"));
|
minPlayers = Math.max(2,getConfig().getInt("minPlayers"));
|
||||||
|
gameLength = getConfig().getInt("gameLength");
|
||||||
|
|
||||||
getConfig().options().copyDefaults(true);
|
getConfig().options().copyDefaults(true);
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
|
|
@ -26,10 +26,12 @@ public class CommandHandler {
|
||||||
public static void registerCommands() {
|
public static void registerCommands() {
|
||||||
registerCommand(new About());
|
registerCommand(new About());
|
||||||
registerCommand(new Help());
|
registerCommand(new Help());
|
||||||
|
registerCommand(new Setup());
|
||||||
registerCommand(new Start());
|
registerCommand(new Start());
|
||||||
registerCommand(new Stop());
|
registerCommand(new Stop());
|
||||||
registerCommand(new SetSpawnLocation());
|
registerCommand(new SetSpawnLocation());
|
||||||
registerCommand(new SetLobbyLocation());
|
registerCommand(new SetLobbyLocation());
|
||||||
|
registerCommand(new SetExitLocation());
|
||||||
registerCommand(new SetBorder());
|
registerCommand(new SetBorder());
|
||||||
registerCommand(new Reload());
|
registerCommand(new Reload());
|
||||||
registerCommand(new SaveMap());
|
registerCommand(new SaveMap());
|
||||||
|
|
|
@ -8,9 +8,7 @@ import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.ItemFrame;
|
|
||||||
import org.bukkit.entity.Painting;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Snowball;
|
import org.bukkit.entity.Snowball;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -21,10 +19,6 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerKickEvent;
|
import org.bukkit.event.player.PlayerKickEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
@ -39,13 +33,13 @@ public class EventListener implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
event.getPlayer().setLevel(0);
|
||||||
|
if(!Functions.setup()) return;
|
||||||
|
HiderTeam.removeEntry(event.getPlayer().getName());
|
||||||
|
SeekerTeam.removeEntry(event.getPlayer().getName());
|
||||||
|
SpectatorTeam.removeEntry(event.getPlayer().getName());
|
||||||
if(status.equals("Playing") || status.equals("Starting")) {
|
if(status.equals("Playing") || status.equals("Starting")) {
|
||||||
if(lobbyManualJoin) {
|
|
||||||
event.getPlayer().teleport(new Location(Bukkit.getWorld(spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
|
|
||||||
if(event.getPlayer().getWorld().getName().equals("hideandseek_"+spawnWorld)) {
|
if(event.getPlayer().getWorld().getName().equals("hideandseek_"+spawnWorld)) {
|
||||||
return;
|
|
||||||
} else return;
|
|
||||||
}
|
|
||||||
Spectator.add(event.getPlayer().getName());
|
Spectator.add(event.getPlayer().getName());
|
||||||
SpectatorTeam.addEntry(event.getPlayer().getName());
|
SpectatorTeam.addEntry(event.getPlayer().getName());
|
||||||
event.getPlayer().sendMessage(messagePrefix + "You have joined mid game, and thus have been placed on the spectator team.");
|
event.getPlayer().sendMessage(messagePrefix + "You have joined mid game, and thus have been placed on the spectator team.");
|
||||||
|
@ -55,23 +49,17 @@ public class EventListener implements Listener {
|
||||||
event.getPlayer().removePotionEffect(effect.getType());
|
event.getPlayer().removePotionEffect(effect.getType());
|
||||||
}
|
}
|
||||||
event.getPlayer().teleport(new Location(Bukkit.getWorld("hideandseek_"+spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
|
event.getPlayer().teleport(new Location(Bukkit.getWorld("hideandseek_"+spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
|
||||||
} else if(status.equals("Setup") || status.equals("Standby")) {
|
|
||||||
if (lobbyManualJoin) {
|
|
||||||
if(event.getPlayer().getWorld().getName().equals("hideandseek_"+spawnWorld)){
|
|
||||||
if(lobbyPosition.getBlockX() != 0 || lobbyPosition.getBlockY() != 0 || lobbyPosition.getBlockZ() != 0) {
|
|
||||||
event.getPlayer().teleport(new Location(Bukkit.getWorld(spawnWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
|
|
||||||
}
|
}
|
||||||
return;
|
if(event.getPlayer().getWorld().getName().equals(spawnWorld)) {
|
||||||
}
|
event.getPlayer().teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ()));
|
||||||
}
|
event.getPlayer().setGameMode(GameMode.ADVENTURE);
|
||||||
Hider.add(event.getPlayer().getName());
|
}
|
||||||
HiderTeam.addEntry(event.getPlayer().getName());
|
} else if(status.equals("Setup") || status.equals("Standby")) {
|
||||||
|
if(Functions.playerInProtectedWorld(event.getPlayer())){
|
||||||
|
event.getPlayer().teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ()));
|
||||||
event.getPlayer().setGameMode(GameMode.ADVENTURE);
|
event.getPlayer().setGameMode(GameMode.ADVENTURE);
|
||||||
if(lobbyPosition.getBlockX() != 0 || lobbyPosition.getBlockY() != 0 || lobbyPosition.getBlockZ() != 0) {
|
|
||||||
event.getPlayer().teleport(new Location(Bukkit.getWorld(spawnWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
playerList.put(event.getPlayer().getName(), event.getPlayer());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -101,10 +89,21 @@ public class EventListener implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
if(event.getEntity() instanceof Player) {
|
if(event.getEntity() instanceof Player) {
|
||||||
if(!Functions.playerInProtectedWorld((Player) event.getEntity())) return;
|
Player p = (Player) event.getEntity();
|
||||||
|
if(!playerList.containsKey(p.getName())) return;
|
||||||
if(!status.equals("Playing")) {
|
if(!status.equals("Playing")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
Player attacker = null;
|
||||||
|
if(event instanceof EntityDamageByEntityEvent) {
|
||||||
|
Entity damager = ((EntityDamageByEntityEvent)event).getDamager();
|
||||||
|
if(damager instanceof Player) {
|
||||||
|
attacker = (Player) damager;
|
||||||
|
if(Hider.contains(attacker.getName()) && Hider.contains(p.getName())) event.setCancelled(true);
|
||||||
|
if(Seeker.contains(attacker.getName()) && Seeker.contains(p.getName())) event.setCancelled(true);
|
||||||
|
if(Spectator.contains(attacker.getName())) event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
if(player.getHealth()-event.getDamage() < 0) {
|
if(player.getHealth()-event.getDamage() < 0) {
|
||||||
|
@ -113,144 +112,20 @@ public class EventListener implements Listener {
|
||||||
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
||||||
player.teleport(new Location(Bukkit.getWorld("hideandseek_"+spawnWorld), spawnPosition.getX(), spawnPosition.getY(), spawnPosition.getZ()));
|
player.teleport(new Location(Bukkit.getWorld("hideandseek_"+spawnWorld), spawnPosition.getX(), spawnPosition.getY(), spawnPosition.getZ()));
|
||||||
Packet.playSound(player, Sound.ENTITY_PLAYER_DEATH, 1, 1);
|
Packet.playSound(player, Sound.ENTITY_PLAYER_DEATH, 1, 1);
|
||||||
if(Hider.contains(event.getEntity().getName())) {
|
|
||||||
Bukkit.broadcastMessage(String.format(messagePrefix + "%s%s%s was found and became a seeker", ChatColor.GOLD, event.getEntity().getName(), ChatColor.WHITE));
|
|
||||||
}
|
|
||||||
if(Seeker.contains(event.getEntity().getName())) {
|
if(Seeker.contains(event.getEntity().getName())) {
|
||||||
Bukkit.broadcastMessage(String.format(messagePrefix + "%s%s%s was killed", ChatColor.RED, event.getEntity().getName(), ChatColor.WHITE));
|
Bukkit.broadcastMessage(String.format(messagePrefix + "%s%s%s was killed", ChatColor.RED, event.getEntity().getName(), ChatColor.WHITE));
|
||||||
}
|
}
|
||||||
Seeker.add(player.getName());
|
if(Hider.contains(event.getEntity().getName())) {
|
||||||
|
if(attacker == null) {
|
||||||
|
Functions.broadcastMessage(String.format(messagePrefix + "%s%s%s was found and became a seeker", ChatColor.GOLD, event.getEntity().getName(), ChatColor.WHITE));
|
||||||
|
} else {
|
||||||
|
Functions.broadcastMessage(String.format(messagePrefix + "%s%s%s was found by %s%s%s and became a seeker", ChatColor.GOLD, event.getEntity().getName(), ChatColor.WHITE, ChatColor.RED, attacker.getName(), ChatColor.WHITE));
|
||||||
|
}
|
||||||
Hider.remove(player.getName());
|
Hider.remove(player.getName());
|
||||||
|
Seeker.add(player.getName());
|
||||||
SeekerTeam.addEntry(player.getName());
|
SeekerTeam.addEntry(player.getName());
|
||||||
|
}
|
||||||
Functions.resetPlayer(player);
|
Functions.resetPlayer(player);
|
||||||
for(Player temp : playerList.values()) {
|
|
||||||
Packet.setGlow(player, temp, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
|
||||||
if(event.getEntity() instanceof ArmorStand) {
|
|
||||||
if(unbreakableArmorstands) {
|
|
||||||
if(event.getDamager() instanceof Player) {
|
|
||||||
if(!Functions.playerInProtectedWorld((Player) event.getDamager())) return;
|
|
||||||
Player player = (Player) event.getDamager();
|
|
||||||
if(status.equals("Playing") || status.equals("Starting") || !player.hasPermission("hideandseek.blockbypass")) {
|
|
||||||
System.out.println('t');
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
|
||||||
if(!Functions.playerInProtectedWorld((Player) event.getPlayer())) return;
|
|
||||||
if(!interactableArmorstands) {
|
|
||||||
if(event.getRightClicked() instanceof ArmorStand) {
|
|
||||||
if(status.equals("Playing") || status.equals("Starting") || !event.getPlayer().hasPermission("hideandseek.blockbypass")) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!interactableItemframes) {
|
|
||||||
if(!Functions.playerInProtectedWorld((Player) event.getPlayer())) return;
|
|
||||||
if(event.getRightClicked() instanceof ItemFrame) {
|
|
||||||
if(status.equals("Playing") || status.equals("Starting") || !event.getPlayer().hasPermission("hideandseek.blockbypass")) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerInteractBlock(PlayerInteractEvent event) {
|
|
||||||
if(!Functions.playerInProtectedWorld((Player) event.getPlayer())) return;
|
|
||||||
if(!interactableDoors) {
|
|
||||||
if(
|
|
||||||
event.getClickedBlock().getType() == Material.ACACIA_DOOR ||
|
|
||||||
event.getClickedBlock().getType() == Material.BIRCH_DOOR ||
|
|
||||||
event.getClickedBlock().getType() == Material.CRIMSON_DOOR ||
|
|
||||||
event.getClickedBlock().getType() == Material.DARK_OAK_DOOR ||
|
|
||||||
event.getClickedBlock().getType() == Material.IRON_DOOR ||
|
|
||||||
event.getClickedBlock().getType() == Material.JUNGLE_DOOR ||
|
|
||||||
event.getClickedBlock().getType() == Material.OAK_DOOR ||
|
|
||||||
event.getClickedBlock().getType() == Material.SPRUCE_DOOR ||
|
|
||||||
event.getClickedBlock().getType() == Material.WARPED_DOOR
|
|
||||||
) {
|
|
||||||
if(status.equals("Playing") || status.equals("Starting") || !event.getPlayer().hasPermission("hideandseek.blockbypass")) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!interactableTrapdoors) {
|
|
||||||
if(
|
|
||||||
event.getClickedBlock().getType() == Material.ACACIA_TRAPDOOR ||
|
|
||||||
event.getClickedBlock().getType() == Material.BIRCH_TRAPDOOR ||
|
|
||||||
event.getClickedBlock().getType() == Material.CRIMSON_TRAPDOOR ||
|
|
||||||
event.getClickedBlock().getType() == Material.DARK_OAK_TRAPDOOR ||
|
|
||||||
event.getClickedBlock().getType() == Material.IRON_TRAPDOOR ||
|
|
||||||
event.getClickedBlock().getType() == Material.JUNGLE_TRAPDOOR ||
|
|
||||||
event.getClickedBlock().getType() == Material.OAK_TRAPDOOR ||
|
|
||||||
event.getClickedBlock().getType() == Material.SPRUCE_TRAPDOOR ||
|
|
||||||
event.getClickedBlock().getType() == Material.WARPED_TRAPDOOR
|
|
||||||
) {
|
|
||||||
if(status.equals("Playing") || status.equals("Starting") || !event.getPlayer().hasPermission("hideandseek.blockbypass")) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!interactableFencegate) {
|
|
||||||
if(
|
|
||||||
event.getClickedBlock().getType() == Material.ACACIA_FENCE_GATE ||
|
|
||||||
event.getClickedBlock().getType() == Material.BIRCH_FENCE_GATE ||
|
|
||||||
event.getClickedBlock().getType() == Material.CRIMSON_FENCE_GATE ||
|
|
||||||
event.getClickedBlock().getType() == Material.DARK_OAK_FENCE_GATE ||
|
|
||||||
event.getClickedBlock().getType() == Material.JUNGLE_FENCE_GATE ||
|
|
||||||
event.getClickedBlock().getType() == Material.OAK_FENCE_GATE ||
|
|
||||||
event.getClickedBlock().getType() == Material.SPRUCE_FENCE_GATE ||
|
|
||||||
event.getClickedBlock().getType() == Material.WARPED_FENCE_GATE
|
|
||||||
) {
|
|
||||||
if(status.equals("Playing") || status.equals("Starting") || !event.getPlayer().hasPermission("hideandseek.blockbypass")) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onHangingBreakByEntity(HangingBreakByEntityEvent event) {
|
|
||||||
if(event.getEntity() instanceof ItemFrame) {
|
|
||||||
if(unbreakableItemframes) {
|
|
||||||
if(event.getRemover() instanceof Player) {
|
|
||||||
if(!Functions.playerInProtectedWorld((Player) event.getRemover())) return;
|
|
||||||
Player player = (Player) event.getRemover();
|
|
||||||
if(status.equals("Playing") || status.equals("Starting") || !player.hasPermission("hideandseek.blockbypass")) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(event.getEntity() instanceof Painting) {
|
|
||||||
if(unbreakableArmorstands) {
|
|
||||||
if(event.getRemover() instanceof Player) {
|
|
||||||
if(!Functions.playerInProtectedWorld((Player) event.getRemover())) return;
|
|
||||||
Player player = (Player) event.getRemover();
|
|
||||||
if(status.equals("Playing") || status.equals("Starting") || !player.hasPermission("hideandseek.blockbypass")) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -275,34 +150,18 @@ public class EventListener implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||||
if(event.getEntity() instanceof Player) {
|
if(event.getEntity() instanceof Player) {
|
||||||
if(playerList.containsKey(event.getEntity().getName())) {
|
if(!playerList.containsKey(event.getEntity().getName())) return;
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerRegainHealth(EntityRegainHealthEvent event) {
|
public void onPlayerRegainHealth(EntityRegainHealthEvent event) {
|
||||||
if(event.getRegainReason() == RegainReason.SATIATED || event.getRegainReason() == RegainReason.REGEN) {
|
if(event.getRegainReason() == RegainReason.SATIATED || event.getRegainReason() == RegainReason.REGEN) {
|
||||||
if(event.getEntity() instanceof Player) {
|
if(event.getEntity() instanceof Player) {
|
||||||
if(playerList.containsKey(event.getEntity().getName())) {
|
if(!playerList.containsKey(event.getEntity().getName())) return;
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerCommandPreProccess(PlayerCommandPreprocessEvent event) {
|
|
||||||
if(status.equals("Setup") || status.equals("Standby")) return;
|
|
||||||
if(!playerList.containsKey(event.getPlayer().getName())) return;
|
|
||||||
String handle = event.getMessage().split(" ")[0].substring(1);
|
|
||||||
for(String blocked : blockedCommands) {
|
|
||||||
if(handle.equalsIgnoreCase(blocked) || handle.equalsIgnoreCase("minecraft:"+blocked)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
event.getPlayer().sendMessage(errorPrefix + "This command is blocked during gameplay!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,7 @@ package net.tylermurphy.hideAndSeek.bukkit;
|
||||||
|
|
||||||
import static net.tylermurphy.hideAndSeek.Store.*;
|
import static net.tylermurphy.hideAndSeek.Store.*;
|
||||||
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@ -22,34 +20,31 @@ public class Tick {
|
||||||
Functions.loadScoreboard();
|
Functions.loadScoreboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(status.equals("Starting")) {
|
if(status.equals("Standby")) {
|
||||||
onStarting();
|
tick = 0;
|
||||||
} else if(status.equals("Playing")) {
|
}
|
||||||
|
|
||||||
|
if(status.equals("Playing")) {
|
||||||
onPlaying();
|
onPlaying();
|
||||||
}
|
}
|
||||||
|
|
||||||
tick ++;
|
|
||||||
|
|
||||||
if(( status.equals("Starting") || status.equals("Playing") ) && Hider.size() < 1) {
|
if(( status.equals("Starting") || status.equals("Playing") ) && Hider.size() < 1) {
|
||||||
Bukkit.broadcastMessage(gameoverPrefix + "All hiders have been found.");
|
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameoverPrefix + "All hiders have been found.");
|
||||||
|
else Functions.broadcastMessage(gameoverPrefix + "All hiders have been found.");
|
||||||
Stop.onStop();
|
Stop.onStop();
|
||||||
}
|
}
|
||||||
if(( status.equals("Starting") || status.equals("Playing") ) && Seeker.size() < 1) {
|
if(( status.equals("Starting") || status.equals("Playing") ) && Seeker.size() < 1) {
|
||||||
Bukkit.broadcastMessage(abortPrefix + "All seekers have quit.");
|
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + "All seekers have quit.");
|
||||||
|
else Functions.broadcastMessage(abortPrefix + "All seekers have quit.");
|
||||||
Stop.onStop();
|
Stop.onStop();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static void onStarting() {
|
|
||||||
for(String playerName : Seeker) {
|
|
||||||
Player player = playerList.get(playerName);
|
|
||||||
if(player != null) {
|
|
||||||
player.teleport(new Location(Bukkit.getWorld("hideandseek_"+spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void onPlaying() {
|
private static void onPlaying() {
|
||||||
|
|
||||||
|
tick ++;
|
||||||
|
|
||||||
for(String playerName : Hider) {
|
for(String playerName : Hider) {
|
||||||
Player player = playerList.get(playerName);
|
Player player = playerList.get(playerName);
|
||||||
int distance = 100;
|
int distance = 100;
|
||||||
|
@ -76,6 +71,21 @@ public class Tick {
|
||||||
if(distance < 20) Packet.playSound(player, Sound.BLOCK_NOTE_BLOCK_BIT, .3f, 1f);
|
if(distance < 20) Packet.playSound(player, Sound.BLOCK_NOTE_BLOCK_BIT, .3f, 1f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tick%20 == 0) {
|
||||||
|
if(gameLength > 0) {
|
||||||
|
timeLeft--;
|
||||||
|
for(Player player : playerList.values()) {
|
||||||
|
player.setLevel(timeLeft);
|
||||||
|
}
|
||||||
|
if(timeLeft < 1) {
|
||||||
|
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameoverPrefix + "Seekers ran out of time. Hiders win!");
|
||||||
|
else Functions.broadcastMessage(gameoverPrefix + "Seekers ran out of time. Hiders win!");
|
||||||
|
Stop.onStop();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,10 +1,13 @@
|
||||||
package net.tylermurphy.hideAndSeek.command;
|
package net.tylermurphy.hideAndSeek.command;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import net.tylermurphy.hideAndSeek.util.Functions;
|
||||||
import net.tylermurphy.hideAndSeek.util.ICommand;
|
import net.tylermurphy.hideAndSeek.util.ICommand;
|
||||||
|
|
||||||
import static net.tylermurphy.hideAndSeek.Store.*;
|
import static net.tylermurphy.hideAndSeek.Store.*;
|
||||||
|
@ -12,16 +15,8 @@ import static net.tylermurphy.hideAndSeek.Store.*;
|
||||||
public class Join implements ICommand {
|
public class Join implements ICommand {
|
||||||
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
if(!lobbyManualJoin) {
|
if(!Functions.setup()) {
|
||||||
sender.sendMessage(errorPrefix + "Manual join/leave isnt enabled in this server");
|
sender.sendMessage(errorPrefix + "Game is not setup. Run /hs setup to see what you needed to do");
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(!status.equals("Standby")) {
|
|
||||||
sender.sendMessage(errorPrefix + "Game is currently in session");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(!lobbyStarted) {
|
|
||||||
sender.sendMessage(errorPrefix + "There is currently no lobby in session");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player player = Bukkit.getServer().getPlayer(sender.getName());
|
Player player = Bukkit.getServer().getPlayer(sender.getName());
|
||||||
|
@ -30,15 +25,27 @@ public class Join implements ICommand {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(playerList.containsKey(player.getName())){
|
if(playerList.containsKey(player.getName())){
|
||||||
sender.sendMessage(errorPrefix + "You are already in the lobby");
|
sender.sendMessage(errorPrefix + "You are already in the lobby/game");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
playerList.put(player.getName(), player);
|
playerList.put(player.getName(), player);
|
||||||
|
if(status.equals("Standby")) {
|
||||||
Hider.add(player.getName());
|
Hider.add(player.getName());
|
||||||
HiderTeam.addEntry(player.getName());
|
HiderTeam.addEntry(player.getName());
|
||||||
playerLastLocationList.put(player.getName(), player.getLocation());
|
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + sender.getName() + " has joined the HideAndSeek lobby");
|
||||||
player.teleport(new Location(Bukkit.getWorld(spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
|
else Functions.broadcastMessage(messagePrefix + sender.getName() + " has joined the HideAndSeek lobby");
|
||||||
if(lobbyAnnounced) Bukkit.broadcastMessage(messagePrefix + sender.getName() + " has joined the HideAndSeek lobby");
|
player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
|
||||||
|
player.setGameMode(GameMode.ADVENTURE);
|
||||||
|
} else {
|
||||||
|
Spectator.add(player.getName());
|
||||||
|
SpectatorTeam.addEntry(player.getName());
|
||||||
|
player.sendMessage(messagePrefix + "You have joined mid game and became a spectator");
|
||||||
|
player.setGameMode(GameMode.SPECTATOR);
|
||||||
|
player.teleport(new Location(Bukkit.getWorld("hideandseek_"+spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
|
||||||
|
}
|
||||||
|
|
||||||
|
player.setFoodLevel(20);
|
||||||
|
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package net.tylermurphy.hideAndSeek.command;
|
package net.tylermurphy.hideAndSeek.command;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import net.tylermurphy.hideAndSeek.util.Functions;
|
||||||
import net.tylermurphy.hideAndSeek.util.ICommand;
|
import net.tylermurphy.hideAndSeek.util.ICommand;
|
||||||
|
|
||||||
import static net.tylermurphy.hideAndSeek.Store.*;
|
import static net.tylermurphy.hideAndSeek.Store.*;
|
||||||
|
@ -11,16 +13,8 @@ import static net.tylermurphy.hideAndSeek.Store.*;
|
||||||
public class Leave implements ICommand {
|
public class Leave implements ICommand {
|
||||||
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
if(!lobbyManualJoin) {
|
if(!Functions.setup()) {
|
||||||
sender.sendMessage(errorPrefix + "Manual join/leave isnt enabled in this server");
|
sender.sendMessage(errorPrefix + "Game is not setup. Run /hs setup to see what you needed to do");
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(!status.equals("Standby")) {
|
|
||||||
sender.sendMessage(errorPrefix + "Game is currently in session");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(!lobbyStarted) {
|
|
||||||
sender.sendMessage(errorPrefix + "There is currently no lobby in session");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player player = Bukkit.getServer().getPlayer(sender.getName());
|
Player player = Bukkit.getServer().getPlayer(sender.getName());
|
||||||
|
@ -32,13 +26,16 @@ public class Leave implements ICommand {
|
||||||
sender.sendMessage(errorPrefix + "You are currently not in the lobby");
|
sender.sendMessage(errorPrefix + "You are currently not in the lobby");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(!Seeker.contains(player.getName())) {
|
||||||
|
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + sender.getName() + " has left the HideAndSeek lobby");
|
||||||
|
else Functions.broadcastMessage(messagePrefix + sender.getName() + " has left the HideAndSeek lobby");
|
||||||
|
}
|
||||||
playerList.remove(player.getName());
|
playerList.remove(player.getName());
|
||||||
Hider.remove(player.getName());
|
Hider.remove(player.getName());
|
||||||
Seeker.remove(player.getName());
|
Seeker.remove(player.getName());
|
||||||
HiderTeam.removeEntry(player.getName());
|
HiderTeam.removeEntry(player.getName());
|
||||||
SeekerTeam.removeEntry(player.getName());
|
SeekerTeam.removeEntry(player.getName());
|
||||||
player.teleport(playerLastLocationList.get(player.getName()));
|
player.teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ()));
|
||||||
if(lobbyAnnounced) Bukkit.broadcastMessage(messagePrefix + sender.getName() + " has left the HideAndSeek lobby");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package net.tylermurphy.hideAndSeek.command;
|
package net.tylermurphy.hideAndSeek.command;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@ -25,10 +24,6 @@ public class Reload implements ICommand {
|
||||||
} catch(Exception e) {}
|
} catch(Exception e) {}
|
||||||
sender.sendMessage(messagePrefix + "Reloaded the config");
|
sender.sendMessage(messagePrefix + "Reloaded the config");
|
||||||
playerList = new HashMap<String,Player>();
|
playerList = new HashMap<String,Player>();
|
||||||
if(!lobbyManualJoin) {
|
|
||||||
for(Player p : Bukkit.getOnlinePlayers())
|
|
||||||
playerList.put(p.getName(), p);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package net.tylermurphy.hideAndSeek.command;
|
||||||
|
|
||||||
|
import static net.tylermurphy.hideAndSeek.Store.*;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import net.tylermurphy.hideAndSeek.util.ICommand;
|
||||||
|
|
||||||
|
public class SetExitLocation implements ICommand {
|
||||||
|
|
||||||
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
Vector newExitPosition = new Vector();
|
||||||
|
Player player = (Player) sender;
|
||||||
|
newExitPosition.setX(player.getLocation().getBlockX());
|
||||||
|
newExitPosition.setY(player.getLocation().getBlockY());
|
||||||
|
newExitPosition.setZ(player.getLocation().getBlockZ());
|
||||||
|
if(!status.equals("Standby")) {
|
||||||
|
sender.sendMessage(errorPrefix + "Game is currently in session");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
exitPosition = newExitPosition;
|
||||||
|
sender.sendMessage(messagePrefix + "Set exit position to current location");
|
||||||
|
Map<String, Object> temp = new HashMap<String,Object>();
|
||||||
|
temp.put("x", exitPosition.getX());
|
||||||
|
temp.put("y", exitPosition.getY());
|
||||||
|
temp.put("z", exitPosition.getZ());
|
||||||
|
temp.put("world", player.getLocation().getWorld().getName());
|
||||||
|
addToSection("spawns.exit",temp);
|
||||||
|
saveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return "setexit";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return "Sets hide and seeks exit location to current position and world";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -29,7 +29,8 @@ public class SetLobbyLocation implements ICommand {
|
||||||
temp.put("x", lobbyPosition.getX());
|
temp.put("x", lobbyPosition.getX());
|
||||||
temp.put("y", lobbyPosition.getY());
|
temp.put("y", lobbyPosition.getY());
|
||||||
temp.put("z", lobbyPosition.getZ());
|
temp.put("z", lobbyPosition.getZ());
|
||||||
addToSection("lobby.spawn",temp);
|
temp.put("world", player.getLocation().getWorld().getName());
|
||||||
|
addToSection("spawns.lobby",temp);
|
||||||
saveConfig();
|
saveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class SetSpawnLocation implements ICommand {
|
||||||
temp.put("y", spawnPosition.getY());
|
temp.put("y", spawnPosition.getY());
|
||||||
temp.put("z", spawnPosition.getZ());
|
temp.put("z", spawnPosition.getZ());
|
||||||
temp.put("world", player.getLocation().getWorld().getName());
|
temp.put("world", player.getLocation().getWorld().getName());
|
||||||
addToSection("spawn",temp);
|
addToSection("spawns.game",temp);
|
||||||
saveConfig();
|
saveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
57
src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java
Normal file
57
src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
package net.tylermurphy.hideAndSeek.command;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
import net.tylermurphy.hideAndSeek.Main;
|
||||||
|
import net.tylermurphy.hideAndSeek.util.ICommand;
|
||||||
|
|
||||||
|
import static net.tylermurphy.hideAndSeek.Store.*;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class Setup implements ICommand {
|
||||||
|
|
||||||
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
|
||||||
|
String message = String.format("%s%sThe following is needed for setup...", ChatColor.WHITE, ChatColor.BOLD);
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
if(spawnPosition.getBlockX() == 0 && spawnPosition.getBlockY() == 0 && spawnPosition.getBlockZ() == 0) {
|
||||||
|
message = String.format("%s\n%s%s-%s%s", message, ChatColor.RED, ChatColor.BOLD, ChatColor.WHITE, "Game spawn isnt set, /hs setspawn");
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
if(lobbyPosition.getBlockX() == 0 && lobbyPosition.getBlockY() == 0 && lobbyPosition.getBlockZ() == 0) {
|
||||||
|
message = String.format("%s\n%s%s-%s%s", message, ChatColor.RED, ChatColor.BOLD, ChatColor.WHITE, "Lobby spawn isnt set, /hs setlobby");
|
||||||
|
sender.sendMessage(errorPrefix + "Please set lobby location first");
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
if(exitPosition.getBlockX() == 0 && exitPosition.getBlockY() == 0 && exitPosition.getBlockZ() == 0) {
|
||||||
|
message = String.format("%s\n%s%s-%s%s", message, ChatColor.RED, ChatColor.BOLD, ChatColor.WHITE, "Quit/exit teleport location isnt set, /hs setexit");
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
File destenation = new File(Main.root+File.separator+"hideandseek_"+spawnWorld);
|
||||||
|
if(!destenation.exists()) {
|
||||||
|
message = String.format("%s\n%s%s-%s%s", message, ChatColor.RED, ChatColor.BOLD, ChatColor.WHITE, "Hide and seek map isnt saved, /hs savemap (after /hs setspawn)");
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
if(count < 1) {
|
||||||
|
sender.sendMessage(messagePrefix + "Everything is setup and ready to go!");
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return "setup";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return "Shows what needs to be setup";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.tylermurphy.hideAndSeek.Main;
|
import net.tylermurphy.hideAndSeek.Main;
|
||||||
import net.tylermurphy.hideAndSeek.events.Glow;
|
import net.tylermurphy.hideAndSeek.events.Glow;
|
||||||
import net.tylermurphy.hideAndSeek.events.Taunt;
|
import net.tylermurphy.hideAndSeek.events.Taunt;
|
||||||
|
@ -17,40 +18,33 @@ import net.tylermurphy.hideAndSeek.util.ICommand;
|
||||||
|
|
||||||
import static net.tylermurphy.hideAndSeek.Store.*;
|
import static net.tylermurphy.hideAndSeek.Store.*;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class Start implements ICommand {
|
public class Start implements ICommand {
|
||||||
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
if(!Functions.setup()) {
|
||||||
|
sender.sendMessage(errorPrefix + "Game is not setup. Run /hs setup to see what you needed to do");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(!status.equals("Standby")) {
|
if(!status.equals("Standby")) {
|
||||||
sender.sendMessage(errorPrefix + "Game is already in session");
|
sender.sendMessage(errorPrefix + "Game is already in session");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(spawnPosition.getBlockX() == 0 && spawnPosition.getBlockY() == 0 && spawnPosition.getBlockZ() == 0) {
|
if(!playerList.containsKey(sender.getName())) {
|
||||||
sender.sendMessage(errorPrefix + "Please set spawn location first");
|
sender.sendMessage(errorPrefix + "You are not in the lobby");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(lobbyPosition.getBlockX() == 0 && lobbyPosition.getBlockY() == 0 && lobbyPosition.getBlockZ() == 0) {
|
|
||||||
sender.sendMessage(errorPrefix + "Please set lobby location first");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
File destenation = new File(Main.root+File.separator+"hideandseek_"+spawnWorld);
|
|
||||||
if(!destenation.exists()) {
|
|
||||||
sender.sendMessage(errorPrefix + "Please set map save first");
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if(Bukkit.getServer().getWorld("hideandseek_"+spawnWorld) != null) {
|
|
||||||
Functions.rollback("hideandseek_"+spawnWorld);
|
|
||||||
} else {
|
|
||||||
Functions.loadMap("hideandseek_"+spawnWorld);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(playerList.size() < minPlayers) {
|
if(playerList.size() < minPlayers) {
|
||||||
sender.sendMessage(errorPrefix + "You must have at least "+minPlayers+" players to start");
|
sender.sendMessage(errorPrefix + "You must have at least "+minPlayers+" players to start");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(Bukkit.getServer().getWorld("hideandseek_"+spawnWorld) != null) {
|
||||||
|
Functions.rollback("hideandseek_"+spawnWorld);
|
||||||
|
} else {
|
||||||
|
Functions.loadMap("hideandseek_"+spawnWorld);
|
||||||
|
}
|
||||||
String seekerName;
|
String seekerName;
|
||||||
if(args.length < 1) {
|
if(args.length < 1) {
|
||||||
seekerName = playerList.values().stream().skip(new Random().nextInt(playerList.values().size())).findFirst().get().getName();
|
seekerName = playerList.values().stream().skip(new Random().nextInt(playerList.values().size())).findFirst().get().getName();
|
||||||
|
@ -65,6 +59,7 @@ public class Start implements ICommand {
|
||||||
Hider = new ArrayList<String>();
|
Hider = new ArrayList<String>();
|
||||||
Seeker = new ArrayList<String>();
|
Seeker = new ArrayList<String>();
|
||||||
Spectator = new ArrayList<String>();
|
Spectator = new ArrayList<String>();
|
||||||
|
Deaths = new ArrayList<String>();
|
||||||
for(Player temp : playerList.values()) {
|
for(Player temp : playerList.values()) {
|
||||||
if(temp.getName().equals(seeker.getName()))
|
if(temp.getName().equals(seeker.getName()))
|
||||||
continue;
|
continue;
|
||||||
|
@ -87,12 +82,14 @@ public class Start implements ICommand {
|
||||||
if(player != null) {
|
if(player != null) {
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,1000000,127,false,false));
|
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,1000000,127,false,false));
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,1000000,127,false,false));
|
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,1000000,127,false,false));
|
||||||
|
player.sendTitle(ChatColor.RED + "" + ChatColor.BOLD + "SEEKER", ChatColor.WHITE + "Eliminate all hiders", 10, 70, 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(String playerName : Hider) {
|
for(String playerName : Hider) {
|
||||||
Player player = playerList.get(playerName);
|
Player player = playerList.get(playerName);
|
||||||
if(player != null) {
|
if(player != null) {
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,1000000,5,false,false));
|
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,1000000,5,false,false));
|
||||||
|
player.sendTitle(ChatColor.GOLD + "" + ChatColor.BOLD + "HIDER", ChatColor.WHITE + "Hide away from the seekers", 10, 70, 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Functions.resetWorldborder("hideandseek_"+spawnWorld);
|
Functions.resetWorldborder("hideandseek_"+spawnWorld);
|
||||||
|
@ -163,6 +160,13 @@ public class Start implements ICommand {
|
||||||
Main.taunt.schedule();
|
Main.taunt.schedule();
|
||||||
|
|
||||||
Main.glow = new Glow(gameId);
|
Main.glow = new Glow(gameId);
|
||||||
|
|
||||||
|
if(gameLength > 0) {
|
||||||
|
timeLeft = gameLength;
|
||||||
|
for(Player player : playerList.values()) {
|
||||||
|
player.setLevel(timeLeft);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 20 * 30);
|
}, 20 * 30);
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,13 @@ import net.tylermurphy.hideAndSeek.util.Packet;
|
||||||
public class Stop implements ICommand {
|
public class Stop implements ICommand {
|
||||||
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
if(!Functions.setup()) {
|
||||||
|
sender.sendMessage(errorPrefix + "Game is not setup. Run /hs setup to see what you needed to do");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(status.equals("Starting") || status.equals("Playing")) {
|
if(status.equals("Starting") || status.equals("Playing")) {
|
||||||
Bukkit.broadcastMessage(abortPrefix + "Game has been force stopped.");
|
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + "Game has been force stopped.");
|
||||||
|
else Functions.broadcastMessage(abortPrefix + "Game has been force stopped.");
|
||||||
onStop();
|
onStop();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -38,10 +43,11 @@ public class Stop implements ICommand {
|
||||||
Functions.resetWorldborder("hideandseek_"+spawnWorld);
|
Functions.resetWorldborder("hideandseek_"+spawnWorld);
|
||||||
for(Player player : playerList.values()) {
|
for(Player player : playerList.values()) {
|
||||||
player.setGameMode(GameMode.ADVENTURE);
|
player.setGameMode(GameMode.ADVENTURE);
|
||||||
|
player.setLevel(0);
|
||||||
Hider.add(player.getName());
|
Hider.add(player.getName());
|
||||||
HiderTeam.addEntry(player.getName());
|
HiderTeam.addEntry(player.getName());
|
||||||
player.getInventory().clear();
|
player.getInventory().clear();
|
||||||
player.teleport(new Location(Bukkit.getWorld(spawnWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
|
player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
|
||||||
for(PotionEffect effect : player.getActivePotionEffects()){
|
for(PotionEffect effect : player.getActivePotionEffects()){
|
||||||
player.removePotionEffect(effect.getType());
|
player.removePotionEffect(effect.getType());
|
||||||
}
|
}
|
||||||
|
@ -50,6 +56,7 @@ public class Stop implements ICommand {
|
||||||
Packet.setGlow(player, temp, false);
|
Packet.setGlow(player, temp, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Functions.unloadMap("hideandseek_"+spawnWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsage() {
|
public String getUsage() {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.tylermurphy.hideAndSeek.util;
|
||||||
|
|
||||||
import static net.tylermurphy.hideAndSeek.Store.*;
|
import static net.tylermurphy.hideAndSeek.Store.*;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -137,7 +138,6 @@ public class Functions {
|
||||||
SeekerTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.FOR_OTHER_TEAMS);
|
SeekerTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.FOR_OTHER_TEAMS);
|
||||||
else
|
else
|
||||||
SeekerTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
|
SeekerTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
|
||||||
SeekerTeam.setAllowFriendlyFire(false);
|
|
||||||
|
|
||||||
try { mainBoard.registerNewTeam("Hider");} catch(Exception e) {}
|
try { mainBoard.registerNewTeam("Hider");} catch(Exception e) {}
|
||||||
HiderTeam = mainBoard.getTeam("Hider");
|
HiderTeam = mainBoard.getTeam("Hider");
|
||||||
|
@ -146,13 +146,11 @@ public class Functions {
|
||||||
HiderTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.FOR_OWN_TEAM);
|
HiderTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.FOR_OWN_TEAM);
|
||||||
else
|
else
|
||||||
HiderTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
|
HiderTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
|
||||||
HiderTeam.setAllowFriendlyFire(false);
|
|
||||||
|
|
||||||
try { mainBoard.registerNewTeam("Spectator");} catch(Exception e) {}
|
try { mainBoard.registerNewTeam("Spectator");} catch(Exception e) {}
|
||||||
SpectatorTeam = mainBoard.getTeam("Spectator");
|
SpectatorTeam = mainBoard.getTeam("Spectator");
|
||||||
SpectatorTeam.setColor(ChatColor.GRAY);
|
SpectatorTeam.setColor(ChatColor.GRAY);
|
||||||
SpectatorTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
|
SpectatorTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
|
||||||
SpectatorTeam.setAllowFriendlyFire(false);
|
|
||||||
|
|
||||||
board = mainBoard;
|
board = mainBoard;
|
||||||
}
|
}
|
||||||
|
@ -167,4 +165,24 @@ public class Functions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean setup() {
|
||||||
|
|
||||||
|
if(spawnPosition.getBlockX() == 0 && spawnPosition.getBlockY() == 0 && spawnPosition.getBlockZ() == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(lobbyPosition.getBlockX() == 0 && lobbyPosition.getBlockY() == 0 && lobbyPosition.getBlockZ() == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(exitPosition.getBlockX() == 0 && exitPosition.getBlockY() == 0 && exitPosition.getBlockZ() == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
File destenation = new File(Main.root+File.separator+"hideandseek_"+spawnWorld);
|
||||||
|
if(!destenation.exists()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue