1.3.1 build 4
This commit is contained in:
parent
4188dadbe3
commit
2a52629152
20 changed files with 418 additions and 171 deletions
|
@ -22,6 +22,7 @@ import net.tylermurphy.hideAndSeek.bukkit.TabCompleter;
|
|||
import net.tylermurphy.hideAndSeek.bukkit.Tick;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Config;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Localization;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Items;
|
||||
import net.tylermurphy.hideAndSeek.events.Glow;
|
||||
import net.tylermurphy.hideAndSeek.events.Taunt;
|
||||
import net.tylermurphy.hideAndSeek.events.Worldborder;
|
||||
|
@ -63,6 +64,7 @@ public class Main extends JavaPlugin implements Listener {
|
|||
// Init Configuration
|
||||
Config.loadConfig();
|
||||
Localization.loadLocalization();
|
||||
Items.loadItems();
|
||||
|
||||
// Create World Loader
|
||||
worldLoader = new WorldLoader(spawnWorld);
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.tylermurphy.hideAndSeek.bukkit;
|
|||
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.command.Join;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
|
@ -38,10 +39,18 @@ public class EventListener implements Listener {
|
|||
event.getPlayer().setLevel(0);
|
||||
Main.plugin.board.remove(event.getPlayer());
|
||||
if(!Util.isSetup()) return;
|
||||
if(event.getPlayer().getWorld().getName().equals("hideandseek_"+spawnWorld) || event.getPlayer().getWorld().getName().equals(lobbyWorld)){
|
||||
event.getPlayer().teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ()));
|
||||
event.getPlayer().setGameMode(GameMode.ADVENTURE);
|
||||
|
||||
if(autoJoin){
|
||||
Join.join(event.getPlayer());
|
||||
} else if(teleportToExit) {
|
||||
if (event.getPlayer().getWorld().getName().equals("hideandseek_" + spawnWorld) || event.getPlayer().getWorld().getName().equals(lobbyWorld)) {
|
||||
event.getPlayer().teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ()));
|
||||
event.getPlayer().setGameMode(GameMode.ADVENTURE);
|
||||
}
|
||||
} else {
|
||||
if (event.getPlayer().getWorld().getName().equals("hideandseek_" + spawnWorld)) {
|
||||
event.getPlayer().teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ()));
|
||||
event.getPlayer().setGameMode(GameMode.ADVENTURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,7 +99,7 @@ public class EventListener implements Listener {
|
|||
}
|
||||
}
|
||||
Player player = (Player) event.getEntity();
|
||||
if(player.getHealth()-event.getDamage() < 0) {
|
||||
if(player.getHealth()-event.getDamage() < 0 || !pvpEnabled) {
|
||||
if(spawnPosition == null) return;
|
||||
event.setCancelled(true);
|
||||
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
||||
|
|
|
@ -30,6 +30,10 @@ public class Join implements ICommand {
|
|||
return;
|
||||
}
|
||||
|
||||
join(player);
|
||||
}
|
||||
|
||||
public static void join(Player player){
|
||||
if(Main.plugin.status.equals("Standby")) {
|
||||
player.getInventory().clear();
|
||||
Main.plugin.board.addHider(player);
|
||||
|
@ -46,7 +50,7 @@ public class Join implements ICommand {
|
|||
Main.plugin.board.createGameBoard(player);
|
||||
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());
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.tylermurphy.hideAndSeek.command;
|
|||
|
||||
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.configuration.Items;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.Main;
|
||||
|
@ -20,6 +21,7 @@ public class Reload implements ICommand {
|
|||
}
|
||||
Config.loadConfig();
|
||||
Localization.loadLocalization();
|
||||
Items.loadItems();
|
||||
sender.sendMessage(messagePrefix + message("CONFIG_RELOAD"));
|
||||
}
|
||||
|
||||
|
|
|
@ -24,15 +24,25 @@ public class SetBounds implements ICommand {
|
|||
sender.sendMessage(errorPrefix + message("BOUNDS_WRONG_WORLD"));
|
||||
return;
|
||||
}
|
||||
if(player.getLocation().getBlockX() == 0 || player.getLocation().getBlockZ() == 0){
|
||||
sender.sendMessage(errorPrefix + message("NOT_AT_ZERO"));
|
||||
return;
|
||||
}
|
||||
boolean first = true;
|
||||
if(saveMinX != 0 && saveMinZ != 0 && saveMaxX != 0 && saveMaxZ != 0) {
|
||||
saveMinX = 0; saveMinZ= 0; saveMaxX = 0; saveMaxZ = 0;
|
||||
}
|
||||
if(saveMaxX == 0) {
|
||||
addToConfig("bounds.max.x", player.getLocation().getBlockX());
|
||||
saveMaxX = player.getLocation().getBlockX();
|
||||
} else if(saveMaxX < player.getLocation().getBlockX()) {
|
||||
first = false;
|
||||
addToConfig("bounds.max.x", player.getLocation().getBlockX());
|
||||
addToConfig("bounds.min.x", saveMaxX);
|
||||
saveMinX = saveMaxX;
|
||||
saveMaxX = player.getLocation().getBlockX();
|
||||
} else {
|
||||
first = false;
|
||||
addToConfig("bounds.min.x", player.getLocation().getBlockX());
|
||||
saveMinX = player.getLocation().getBlockX();
|
||||
}
|
||||
|
@ -40,15 +50,17 @@ public class SetBounds implements ICommand {
|
|||
addToConfig("bounds.max.z", player.getLocation().getBlockZ());
|
||||
saveMaxZ = player.getLocation().getBlockZ();
|
||||
} else if(saveMaxZ < player.getLocation().getBlockZ()) {
|
||||
first = false;
|
||||
addToConfig("bounds.max.z", player.getLocation().getBlockZ());
|
||||
addToConfig("bounds.min.z", saveMaxZ);
|
||||
saveMinZ = saveMaxZ;
|
||||
saveMaxZ = player.getLocation().getBlockZ();
|
||||
} else {
|
||||
first = false;
|
||||
addToConfig("bounds.min.z", player.getLocation().getBlockZ());
|
||||
saveMinZ = player.getLocation().getBlockZ();
|
||||
}
|
||||
sender.sendMessage(messagePrefix + message("BOUNDS"));
|
||||
sender.sendMessage(messagePrefix + message("BOUNDS").addAmount(first ? 1 : 2));
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,18 +15,21 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
|
|||
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(!Main.plugin.status.equals("Standby")) {
|
||||
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
||||
return;
|
||||
}
|
||||
Vector newExitPosition = new Vector();
|
||||
Player player = (Player) sender;
|
||||
if(player.getLocation().getBlockX() == 0 || player.getLocation().getBlockZ() == 0 || player.getLocation().getBlockY() == 0){
|
||||
sender.sendMessage(errorPrefix + message("NOT_AT_ZERO"));
|
||||
return;
|
||||
}
|
||||
newExitPosition.setX(player.getLocation().getBlockX());
|
||||
newExitPosition.setY(player.getLocation().getBlockY());
|
||||
newExitPosition.setZ(player.getLocation().getBlockZ());
|
||||
exitPosition = newExitPosition;
|
||||
sender.sendMessage(messagePrefix + message("EXIT_SPAWN"));
|
||||
Map<String, Object> temp = new HashMap<String,Object>();
|
||||
addToConfig("spawns.exit.x", exitPosition.getX());
|
||||
addToConfig("spawns.exit.y", exitPosition.getY());
|
||||
addToConfig("spawns.exit.z", exitPosition.getZ());
|
||||
|
|
|
@ -15,15 +15,19 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
|
|||
public class SetLobbyLocation implements ICommand {
|
||||
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
Vector newLobbyPosition = new Vector();
|
||||
Player player = (Player) sender;
|
||||
newLobbyPosition.setX(player.getLocation().getBlockX());
|
||||
newLobbyPosition.setY(player.getLocation().getBlockY());
|
||||
newLobbyPosition.setZ(player.getLocation().getBlockZ());
|
||||
if(!Main.plugin.status.equals("Standby")) {
|
||||
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
||||
return;
|
||||
}
|
||||
Vector newLobbyPosition = new Vector();
|
||||
Player player = (Player) sender;
|
||||
if(player.getLocation().getBlockX() == 0 || player.getLocation().getBlockZ() == 0 || player.getLocation().getBlockY() == 0){
|
||||
sender.sendMessage(errorPrefix + message("NOT_AT_ZERO"));
|
||||
return;
|
||||
}
|
||||
newLobbyPosition.setX(player.getLocation().getBlockX());
|
||||
newLobbyPosition.setY(player.getLocation().getBlockY());
|
||||
newLobbyPosition.setZ(player.getLocation().getBlockZ());
|
||||
lobbyPosition = newLobbyPosition;
|
||||
sender.sendMessage(messagePrefix + message("LOBBY_SPAWN"));
|
||||
addToConfig("spawns.lobby.x", lobbyPosition.getX());
|
||||
|
|
|
@ -17,16 +17,20 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
|
|||
public class SetSpawnLocation implements ICommand {
|
||||
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
Vector newSpawnPosition = new Vector();
|
||||
Player player = (Player) sender;
|
||||
newSpawnPosition.setX(player.getLocation().getBlockX());
|
||||
newSpawnPosition.setY(player.getLocation().getBlockY());
|
||||
newSpawnPosition.setZ(player.getLocation().getBlockZ());
|
||||
if(!Main.plugin.status.equals("Standby")) {
|
||||
sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
|
||||
return;
|
||||
}
|
||||
if(worldborderEnabled && spawnPosition.distance(worldborderPosition) > 100) {
|
||||
Vector newSpawnPosition = new Vector();
|
||||
Player player = (Player) sender;
|
||||
if(player.getLocation().getBlockX() == 0 || player.getLocation().getBlockZ() == 0 || player.getLocation().getBlockY() == 0){
|
||||
sender.sendMessage(errorPrefix + message("NOT_AT_ZERO"));
|
||||
return;
|
||||
}
|
||||
newSpawnPosition.setX(player.getLocation().getBlockX());
|
||||
newSpawnPosition.setY(player.getLocation().getBlockY());
|
||||
newSpawnPosition.setZ(player.getLocation().getBlockZ());
|
||||
if(worldborderEnabled && newSpawnPosition.distance(worldborderPosition) > 100) {
|
||||
sender.sendMessage(errorPrefix + message("WORLDBORDER_POSITION"));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.tylermurphy.hideAndSeek.Main;
|
|||
|
||||
public class Config {
|
||||
|
||||
static ConfigManager manager;
|
||||
private static ConfigManager manager;
|
||||
|
||||
public static String
|
||||
messagePrefix,
|
||||
|
@ -42,7 +42,10 @@ public class Config {
|
|||
tauntCountdown,
|
||||
tauntLast,
|
||||
glowEnabled,
|
||||
glowStackable;
|
||||
glowStackable,
|
||||
pvpEnabled,
|
||||
autoJoin,
|
||||
teleportToExit;
|
||||
|
||||
public static int
|
||||
minPlayers,
|
||||
|
@ -131,6 +134,9 @@ public class Config {
|
|||
permissionsRequired = manager.getBoolean("permissionsRequired");
|
||||
minPlayers = Math.max(2, manager.getInt("minPlayers"));
|
||||
gameLength = manager.getInt("gameLength");
|
||||
pvpEnabled = manager.getBoolean("pvp");
|
||||
autoJoin = manager.getBoolean("autoJoin");
|
||||
teleportToExit = manager.getBoolean("teleportToExit");
|
||||
}
|
||||
|
||||
public static void addToConfig(String path, Object value) {
|
||||
|
|
|
@ -30,7 +30,6 @@ public class ConfigManager {
|
|||
input.close();
|
||||
reader.close();
|
||||
} catch (IOException e){}
|
||||
|
||||
}
|
||||
|
||||
private void saveDefaultConfiguration(){
|
||||
|
@ -43,16 +42,6 @@ public class ConfigManager {
|
|||
}
|
||||
}
|
||||
|
||||
public void addToSection(String sectionName, Map<String,Object> values) {
|
||||
ConfigurationSection section = config.getConfigurationSection(sectionName);
|
||||
if(section == null) section = config.createSection(sectionName);
|
||||
Map<String,Object> sectionValues = section.getValues(true);
|
||||
for(Map.Entry<String, Object> entry : values.entrySet()) {
|
||||
sectionValues.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
config.createSection(sectionName, sectionValues);
|
||||
}
|
||||
|
||||
public void addToConfig(String path, Object value) {
|
||||
config.set(path, value);
|
||||
}
|
||||
|
@ -89,7 +78,7 @@ public class ConfigManager {
|
|||
if(value == false){
|
||||
return defaultConfig.getBoolean(path);
|
||||
} else {
|
||||
return value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
package net.tylermurphy.hideAndSeek.configuration;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Items {
|
||||
|
||||
private static ConfigManager manager;
|
||||
|
||||
public static List<ItemStack> HIDER_ITEMS, SEEKER_ITEMS;
|
||||
public static List<PotionEffect> HIDER_EFFECTS, SEEKER_EFFECTS;
|
||||
|
||||
public static void loadItems() {
|
||||
|
||||
manager = new ConfigManager("items.yml");
|
||||
|
||||
SEEKER_ITEMS = new ArrayList<ItemStack>();
|
||||
ConfigurationSection SeekerItems = manager.getConfigurationSection("items.seeker");
|
||||
int i = 1;
|
||||
while (true) {
|
||||
ConfigurationSection section = SeekerItems.getConfigurationSection(String.valueOf(i));
|
||||
if(section == null) break;
|
||||
ItemStack item = createItem(section);
|
||||
if(item != null) SEEKER_ITEMS.add(item);
|
||||
i++;
|
||||
}
|
||||
|
||||
HIDER_ITEMS = new ArrayList<ItemStack>();
|
||||
ConfigurationSection HiderItems = manager.getConfigurationSection("items.hider");
|
||||
i = 1;
|
||||
while (true) {
|
||||
ConfigurationSection section = HiderItems.getConfigurationSection(String.valueOf(i));
|
||||
if(section == null) break;
|
||||
ItemStack item = createItem(section);
|
||||
if(item != null) HIDER_ITEMS.add(item);
|
||||
i++;
|
||||
}
|
||||
|
||||
SEEKER_EFFECTS = new ArrayList<PotionEffect>();
|
||||
ConfigurationSection SeekerEffects = manager.getConfigurationSection("effects.seeker");
|
||||
i = 1;
|
||||
while (true) {
|
||||
ConfigurationSection section = SeekerEffects.getConfigurationSection(String.valueOf(i));
|
||||
if(section == null) break;
|
||||
PotionEffect effect = getPotionEffect(section);
|
||||
if(effect != null) SEEKER_EFFECTS.add(effect);
|
||||
i++;
|
||||
}
|
||||
|
||||
HIDER_EFFECTS = new ArrayList<PotionEffect>();
|
||||
ConfigurationSection HiderEffects = manager.getConfigurationSection("effects.hider");
|
||||
i = 1;
|
||||
while (true) {
|
||||
ConfigurationSection section = HiderEffects.getConfigurationSection(String.valueOf(i));
|
||||
if(section == null) break;
|
||||
PotionEffect effect = getPotionEffect(section);
|
||||
if(effect != null) HIDER_EFFECTS.add(effect);
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static ItemStack createItem(ConfigurationSection item) {
|
||||
String material_string = item.getString("material");
|
||||
if(material_string == null) return null;
|
||||
Material material = Material.valueOf(material_string.toUpperCase());
|
||||
int amount = item.getInt("amount");
|
||||
ItemStack stack = new ItemStack(material, amount);
|
||||
if(material == Material.POTION || material == Material.SPLASH_POTION || material == Material.LINGERING_POTION){
|
||||
PotionMeta meta = getPotionMeta(stack, item);
|
||||
stack.setItemMeta(meta);
|
||||
} else {
|
||||
ConfigurationSection enchantments = item.getConfigurationSection("enchantments");
|
||||
if (enchantments != null)
|
||||
for (String enchantment_string : enchantments.getKeys(false)) {
|
||||
Enchantment enchantment = Enchantment.getByKey(NamespacedKey.minecraft(enchantment_string));
|
||||
if (enchantment == null) continue;
|
||||
stack.addUnsafeEnchantment(
|
||||
enchantment,
|
||||
enchantments.getInt(enchantment_string)
|
||||
);
|
||||
}
|
||||
ItemMeta meta = getItemMeta(stack,item);
|
||||
stack.setItemMeta(meta);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
private static ItemMeta getItemMeta(ItemStack stack, ConfigurationSection item){
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
assert meta != null;
|
||||
String name = item.getString("name");
|
||||
if(name != null)
|
||||
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
|
||||
meta.setUnbreakable(item.getBoolean("unbreakable"));
|
||||
meta.setLore(item.getStringList("lore"));
|
||||
return meta;
|
||||
}
|
||||
|
||||
private static PotionMeta getPotionMeta(ItemStack stack, ConfigurationSection item){
|
||||
String type = item.getString("type");
|
||||
PotionMeta meta = (PotionMeta) stack.getItemMeta();
|
||||
if(type==null) return meta;
|
||||
assert meta != null;
|
||||
meta.setBasePotionData(new PotionData((PotionType.valueOf(type.toUpperCase()))));
|
||||
return meta;
|
||||
}
|
||||
|
||||
private static PotionEffect getPotionEffect(ConfigurationSection item){
|
||||
String type = item.getString("type");
|
||||
if(type == null) return null;
|
||||
return new PotionEffect(
|
||||
Objects.requireNonNull(PotionEffectType.getByName(type.toUpperCase())),
|
||||
item.getInt("duration"),
|
||||
item.getInt("amplifier"),
|
||||
item.getBoolean("ambient"),
|
||||
item.getBoolean("particles")
|
||||
);
|
||||
}
|
||||
}
|
|
@ -21,7 +21,8 @@ public class Localization {
|
|||
public static boolean loadLocalization() {
|
||||
|
||||
manager = new ConfigManager("localization.yml");
|
||||
|
||||
manager.saveConfig();
|
||||
|
||||
for(String key : manager.getConfigurationSection("Localization").getKeys(false)) {
|
||||
LOCAL.put(
|
||||
key,
|
||||
|
@ -29,8 +30,6 @@ public class Localization {
|
|||
);
|
||||
}
|
||||
|
||||
manager.saveConfig();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -159,9 +159,9 @@ public class Board {
|
|||
}
|
||||
board.setLine("hiders", ChatColor.BOLD + "" + ChatColor.YELLOW + "HIDER%" + ChatColor.WHITE + getHiderPercent());
|
||||
board.setLine("seekers", ChatColor.BOLD + "" + ChatColor.RED + "SEEKER%" + ChatColor.WHITE + getSeekerPercent());
|
||||
board.addBlank(recreate);
|
||||
board.addBlank();
|
||||
board.setLine("players", "Players: " + playerList.values().size());
|
||||
board.addBlank(recreate);
|
||||
board.addBlank();
|
||||
board.setLine("waiting", "Waiting to start...");
|
||||
board.display();
|
||||
customBoards.put(player.getName(), board);
|
||||
|
@ -175,11 +175,10 @@ public class Board {
|
|||
CustomBoard board = customBoards.get(player.getName());
|
||||
if(recreate) {
|
||||
board = new CustomBoard(player, "&l&eHIDE AND SEEK");
|
||||
board.updateTeams();
|
||||
}
|
||||
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.addBlank(recreate);
|
||||
board.addBlank();
|
||||
if(glowEnabled){
|
||||
if(Main.plugin.glow == null || !Main.plugin.glow.isRunning())
|
||||
board.setLine("glow", "Glow: " + ChatColor.RED + "Inactive");
|
||||
|
@ -189,15 +188,17 @@ public class Board {
|
|||
if(tauntEnabled && tauntCountdown){
|
||||
if(Main.plugin.taunt == null)
|
||||
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + "0m0s");
|
||||
else if(!Main.plugin.taunt.isRunning())
|
||||
else if(!tauntLast && Hider.size() == 1){
|
||||
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + "Expired");
|
||||
} else if(!Main.plugin.taunt.isRunning())
|
||||
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + Main.plugin.taunt.getDelay()/60 + "m" + Main.plugin.taunt.getDelay()%60 + "s");
|
||||
else
|
||||
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + "Active");
|
||||
}
|
||||
if(glowEnabled || (tauntEnabled && tauntCountdown))
|
||||
board.addBlank(recreate);
|
||||
board.addBlank();
|
||||
board.setLine("time", "Time Left: " + ChatColor.GREEN + Main.plugin.timeLeft/60 + "m" + Main.plugin.timeLeft%60 + "s");
|
||||
board.addBlank(recreate);
|
||||
board.addBlank();
|
||||
board.setLine("team", "Team: " + getTeam(player));
|
||||
board.display();
|
||||
customBoards.put(player.getName(), board);
|
||||
|
|
|
@ -18,6 +18,7 @@ public class CustomBoard {
|
|||
private final Player player;
|
||||
private final Map<String,Line> LINES;
|
||||
private int blanks;
|
||||
private boolean displayed;
|
||||
|
||||
public CustomBoard(Player player, String title){
|
||||
this.board = Bukkit.getScoreboardManager().getNewScoreboard();
|
||||
|
@ -26,6 +27,8 @@ public class CustomBoard {
|
|||
this.obj = board.registerNewObjective(
|
||||
"Scoreboard", "dummy", ChatColor.translateAlternateColorCodes('&', title));
|
||||
this.blanks = 0;
|
||||
this.displayed = false;
|
||||
this.updateTeams();
|
||||
}
|
||||
|
||||
public void updateTeams() {
|
||||
|
@ -67,8 +70,8 @@ public class CustomBoard {
|
|||
LINES.put(key, line);
|
||||
}
|
||||
|
||||
public void addBlank(boolean value){
|
||||
if(!value) return;
|
||||
public void addBlank(){
|
||||
if(displayed) return;
|
||||
String temp = "";
|
||||
for(int i = 0; i <= blanks; i ++)
|
||||
temp += ChatColor.RESET;
|
||||
|
@ -86,6 +89,7 @@ public class CustomBoard {
|
|||
}
|
||||
|
||||
public void display() {
|
||||
displayed = true;
|
||||
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
player.setScoreboard(board);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.tylermurphy.hideAndSeek.configuration.Items;
|
||||
import net.tylermurphy.hideAndSeek.configuration.LocalizationString;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
|
@ -55,48 +56,18 @@ public class Util {
|
|||
for (PotionEffect effect : player.getActivePotionEffects()) {
|
||||
player.removePotionEffect(effect.getType());
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.DOLPHINS_GRACE, 1000000, 1, false, false));
|
||||
if (Main.plugin.board.isSeeker(player)) {
|
||||
ItemStack diamondSword = new ItemStack(Material.DIAMOND_SWORD, 1);
|
||||
diamondSword.addEnchantment(Enchantment.DAMAGE_ALL, 1);
|
||||
ItemMeta diamondSwordMeta = diamondSword.getItemMeta();
|
||||
diamondSwordMeta.setDisplayName("Seeker Sword");
|
||||
diamondSwordMeta.setUnbreakable(true);
|
||||
diamondSword.setItemMeta(diamondSwordMeta);
|
||||
player.getInventory().addItem(diamondSword);
|
||||
|
||||
ItemStack wackyStick = new ItemStack(Material.STICK, 1);
|
||||
wackyStick.addUnsafeEnchantment(Enchantment.KNOCKBACK, 3);
|
||||
ItemMeta wackyStickMeta = wackyStick.getItemMeta();
|
||||
wackyStickMeta.setDisplayName("Wacky Stick");
|
||||
wackyStick.setItemMeta(wackyStickMeta);
|
||||
player.getInventory().addItem(wackyStick);
|
||||
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1000000, 2, false, false));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1000000, 1, false, false));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 1000000, 1, false, false));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 1000000, 10, false, false));
|
||||
if(pvpEnabled)
|
||||
for(ItemStack item : Items.SEEKER_ITEMS)
|
||||
player.getInventory().addItem(item);
|
||||
for(PotionEffect effect : Items.SEEKER_EFFECTS)
|
||||
player.addPotionEffect(effect);
|
||||
} else if (Main.plugin.board.isHider(player)) {
|
||||
ItemStack stoneSword = new ItemStack(Material.STONE_SWORD, 1);
|
||||
stoneSword.addEnchantment(Enchantment.DAMAGE_ALL, 2);
|
||||
ItemMeta stoneSwordMeta = stoneSword.getItemMeta();
|
||||
stoneSwordMeta.setDisplayName("Hider Sword");
|
||||
stoneSwordMeta.setUnbreakable(true);
|
||||
stoneSword.setItemMeta(stoneSwordMeta);
|
||||
player.getInventory().addItem(stoneSword);
|
||||
|
||||
ItemStack splashPotion = new ItemStack(Material.SPLASH_POTION, 1);
|
||||
PotionMeta splashPotionMeta = (PotionMeta) splashPotion.getItemMeta();
|
||||
splashPotionMeta.setBasePotionData(new PotionData(PotionType.REGEN));
|
||||
splashPotion.setItemMeta(splashPotionMeta);
|
||||
player.getInventory().addItem(splashPotion);
|
||||
|
||||
ItemStack potion = new ItemStack(Material.POTION, 2);
|
||||
PotionMeta potionMeta = (PotionMeta) potion.getItemMeta();
|
||||
potionMeta.setBasePotionData(new PotionData(PotionType.INSTANT_HEAL));
|
||||
potion.setItemMeta(potionMeta);
|
||||
player.getInventory().addItem(potion);
|
||||
|
||||
if(pvpEnabled)
|
||||
for(ItemStack item : Items.HIDER_ITEMS)
|
||||
player.getInventory().addItem(item);
|
||||
for(PotionEffect effect : Items.HIDER_EFFECTS)
|
||||
player.addPotionEffect(effect);
|
||||
if(glowEnabled) {
|
||||
ItemStack snowball = new ItemStack(Material.SNOWBALL, 1);
|
||||
ItemMeta snowballMeta = snowball.getItemMeta();
|
||||
|
@ -109,9 +80,6 @@ public class Util {
|
|||
snowball.setItemMeta(snowballMeta);
|
||||
player.getInventory().addItem(snowball);
|
||||
}
|
||||
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 1000000, 1, false, false));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -35,7 +35,7 @@ public class WorldLoader {
|
|||
|
||||
public void loadMap(){
|
||||
Bukkit.getServer().createWorld(new WorldCreator(savename).generator(new VoidGenerator()));
|
||||
Bukkit.getServer().getWorld(savename).setAutoSave(false);
|
||||
Bukkit.getServer().getWorld(savename).setAutoSave(false);
|
||||
}
|
||||
|
||||
public void rollback(){
|
||||
|
|
|
@ -10,14 +10,90 @@ announceMessagesToNonPlayers: true
|
|||
# default: false
|
||||
nametagsVisible: false
|
||||
|
||||
# Require bukkit permessions though a plugin to run commands, recomended on large servers
|
||||
# Require bukkit permissions though a plugin to run commands, recommended on large servers
|
||||
# default: true
|
||||
permissionsRequired: true
|
||||
|
||||
# Minimum ammount of players to start the game. Cannot go lower than 2.
|
||||
# Minimum amount of players to start the game. Cannot go lower than 2.
|
||||
# default: 2
|
||||
minPlayers: 2
|
||||
|
||||
# This plugin by default functions as not tag to catch Hiders, but to pvp. All players are given weapons,
|
||||
# and seekers slightly better weapons (this can be changed in items.yml). If you want, you can disable this
|
||||
# entire pvp functionality, and make Hiders get found on a single hit. Hiders would also not be able to fight
|
||||
# back against Seekers if disabled.
|
||||
# default: true
|
||||
pvp: true
|
||||
|
||||
# Players that join the server will automatically be placed into the lobby.
|
||||
# default: false
|
||||
autoJoin: false
|
||||
|
||||
# (When autoJoin is false), when players join the world containing the lobby, they are automatically teleported
|
||||
# to the designated exit position so that they possibly don't spawn in the lobby while not in the queue. Anyone
|
||||
# who ever joins in the game world (the duplicated world where the game is played) will always be teleported
|
||||
# out regardless.
|
||||
# default: false
|
||||
teleportToExit: false
|
||||
|
||||
# The worldborder closes every interval, which is evey [delay] in minutes.
|
||||
# Thw worldborder starts at [size], and decreases 100 blocks every interval.
|
||||
# x & z are the center location. [enabled] is whenever the border is enabled.
|
||||
# You can choose if Hiders are warned 30 seconds before the border moves.
|
||||
worldBorder:
|
||||
x: 0
|
||||
z: 0
|
||||
delay: 10
|
||||
size: 500
|
||||
warn: true
|
||||
enabled: false
|
||||
|
||||
# The taunt will activate every delay set in seconds. It will spawn a firework
|
||||
# on a random Hider to alert a Seeker where someone may be. You can choose
|
||||
# to publicly show the taunt countdown, and have the taunt run with only
|
||||
# one Hider left. Taunt delay must at least be 60s.
|
||||
taunt:
|
||||
delay: 360
|
||||
whenLastPerson: false
|
||||
showCountdown: true
|
||||
enabled: true
|
||||
|
||||
# The glow powerup allows all Hiders to see where every Seeker is. It last for
|
||||
# the amount of time set in seconds. You can allow it to be stackable, meaning
|
||||
# when multiple Hiders use the powerup at the same time, it stacks the times, or
|
||||
# just overwrites. Only Hiders can see that the Seekers are glowing. Delay must
|
||||
# be longer than 1s.
|
||||
glow:
|
||||
time: 30
|
||||
stackable: true
|
||||
enabled: true
|
||||
|
||||
# The message prefixes displayed before messages. The message contents themselves
|
||||
# can be changed in localization.yml.
|
||||
prefix:
|
||||
default: '&9Hide and Seek > &f'
|
||||
error: '&cError > &f'
|
||||
taunt: '&eTaunt > &f'
|
||||
border: '&cWorld Border > &f'
|
||||
abort: '&cAbort > &f'
|
||||
gameover: '&aGame Over > &f'
|
||||
warning: '&cWarning > &f'
|
||||
|
||||
# ---------------------------------------------------------- #
|
||||
# ONLY EDIT BEYOND THIS POINT IF YOU KNOW WHAT YOU ARE DOING #
|
||||
# ---------------------------------------------------------- #
|
||||
|
||||
# The 2 coordinate bounds that will contain your hideAndSeek map. Its recommended
|
||||
# that you use /hs setbounds for this, and not edit this directly, as breaking
|
||||
# this section will completely break the entire plugin when you run /hs mapsave.
|
||||
bounds:
|
||||
min:
|
||||
x: 0
|
||||
z: 0
|
||||
max:
|
||||
x: 0
|
||||
z: 0
|
||||
|
||||
# Spawn locations where players are teleported
|
||||
spawns:
|
||||
# Location where players are teleported into the game (/hs start)
|
||||
|
@ -37,63 +113,4 @@ spawns:
|
|||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
world: world
|
||||
|
||||
# The worldborder closes every interval, whish is evey [delay] in minutes.
|
||||
# Thw worldborder stharts at [size], and decreaces 100 blocks every interval.
|
||||
# x & z are the center location. [enabled] is whenever the border is enabled.
|
||||
# You can choose if Hiders are warned 30 seconds before the border moves.
|
||||
worldBorder:
|
||||
x: 0
|
||||
z: 0
|
||||
delay: 10
|
||||
size: 500
|
||||
warn: true
|
||||
enabled: false
|
||||
|
||||
# The taunt will activate every delay set in seconds. It will spawn a firework
|
||||
# on a random Hider to alert a Seeker where someone may be. You can choose
|
||||
# to publially show the taunt countdown, and have the taunt run with only
|
||||
# one Hider left. Taunt delay must at least be 60s.
|
||||
taunt:
|
||||
delay: 360
|
||||
whenLastPerson: false
|
||||
showCountdown: true
|
||||
enabled: true
|
||||
|
||||
# The glow powerup allows all Hiders to see where every Seeker is. It last for
|
||||
# the amount of time set in seconds. You can allow it to be stackable, meaning
|
||||
# when multiple Hiders use the powerup at the same time, it stacks the times, or
|
||||
# just overwrites. Only Hiders can see that the Seekers are glowing. Delay must
|
||||
# be longer than 1s.
|
||||
glow:
|
||||
time: 30
|
||||
stackable: true
|
||||
enabled: true
|
||||
|
||||
# The message prefixes displayed before messages. The message contents themselvs
|
||||
# can be changed in localization.yml.
|
||||
prefix:
|
||||
default: '&9Hide and Seek > &f'
|
||||
error: '&cError > &f'
|
||||
taunt: '&eTaunt > &f'
|
||||
border: '&cWorld Border > &f'
|
||||
abort: '&cAbort > &f'
|
||||
gameover: '&aGame Over > &f'
|
||||
warning: '&cWarning > &f'
|
||||
|
||||
# ---------------------------------------------------------- #
|
||||
# ONLY EDIT BEYOND THIS POINT IF YOU KNOW WHAT YOU ARE DOING #
|
||||
# ---------------------------------------------------------- #
|
||||
|
||||
# The 2 coordinate bounds that will contain your hideAndSeek map. Its reccomended
|
||||
# that you use /hs setbounds for this, and not edit this directly, as breaking
|
||||
# this section will completly break the entire plugin when you run /hs mapsave.
|
||||
bounds:
|
||||
min:
|
||||
x: 0
|
||||
z: 0
|
||||
max:
|
||||
x: 0
|
||||
z: 0
|
||||
|
||||
world: world
|
87
src/main/resources/items.yml
Normal file
87
src/main/resources/items.yml
Normal file
|
@ -0,0 +1,87 @@
|
|||
# For materials, look at https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html
|
||||
# For potion types, look at https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/potion/PotionType.html
|
||||
# For effects, look at https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/potion/PotionEffectType.html
|
||||
# If pvp is disabled in config.yml, only effects will be given to players.
|
||||
items:
|
||||
seeker:
|
||||
'1':
|
||||
material: DIAMOND_SWORD
|
||||
amount: 1
|
||||
enchantments:
|
||||
sharpness: 1
|
||||
name: 'Seeker Sword'
|
||||
unbreakable: true
|
||||
lore:
|
||||
- 'This is the seeker sword'
|
||||
'2':
|
||||
material: STICK
|
||||
amount: 1
|
||||
enchantments:
|
||||
knockback: 3
|
||||
name: 'Wacky Stick'
|
||||
lore:
|
||||
- 'It will launch people very far'
|
||||
- 'Use wisely!'
|
||||
hider:
|
||||
'1':
|
||||
material: STONE_SWORD
|
||||
amount: 1
|
||||
enchantments:
|
||||
sharpness: 2
|
||||
name: 'Hider Sword'
|
||||
unbreakable: true
|
||||
lore:
|
||||
- 'This is the hider sword'
|
||||
'2':
|
||||
material: SPLASH_POTION
|
||||
amount: 1
|
||||
type: REGEN
|
||||
'3':
|
||||
material: POTION
|
||||
amount: 2
|
||||
type: INSTANT_HEAL
|
||||
'4':
|
||||
type: DOLPHINS_GRACE
|
||||
duration: 1000000
|
||||
amplifier: 1
|
||||
ambient: false
|
||||
particles: false
|
||||
effects:
|
||||
seeker:
|
||||
'1':
|
||||
type: SPEED
|
||||
duration: 1000000
|
||||
amplifier: 2
|
||||
ambient: false
|
||||
particles: false
|
||||
'2':
|
||||
type: JUMP
|
||||
duration: 1000000
|
||||
amplifier: 1
|
||||
ambient: false
|
||||
particles: false
|
||||
'3':
|
||||
type: SLOW_FALLING
|
||||
duration: 1000000
|
||||
amplifier: 1
|
||||
ambient: false
|
||||
particles: false
|
||||
'4':
|
||||
type: WATER_BREATHING
|
||||
duration: 1000000
|
||||
amplifier: 10
|
||||
ambient: false
|
||||
particles: false
|
||||
hider:
|
||||
'1':
|
||||
type: WATER_BREATHING
|
||||
duration: 1000000
|
||||
amplifier: 1
|
||||
ambient: false
|
||||
particles: false
|
||||
'2':
|
||||
type: DOLPHINS_GRACE
|
||||
duration: 1000000
|
||||
amplifier: 1
|
||||
ambient: false
|
||||
particles: false
|
|
@ -1,7 +1,7 @@
|
|||
Localization:
|
||||
COMMAND_PLAYER_ONLY: "This command can only be run as a player."
|
||||
COMMAND_NOT_ALLOWED: "You are not allowed to run this command."
|
||||
COMMAND_ERROR: "An internal error has occoured."
|
||||
COMMAND_ERROR: "An internal error has occurred."
|
||||
GAME_PLAYER_DEATH: "&c{PLAYER}&f was killed."
|
||||
GAME_PLAYER_FOUND: "&e{PLAYER}&f was found and became a seeker."
|
||||
GAME_PLAYER_FOUND_BY: "&e{PLAYER}&f was found by &c{PLAYER}&f and became a seeker."
|
||||
|
@ -11,32 +11,32 @@ Localization:
|
|||
GAME_SETUP: "Game is not setup. Run /hs setup to see what you need to do."
|
||||
GAME_INGAME: "You are already in the lobby/game."
|
||||
GAME_NOT_INGAME: "You are not in a lobby/game."
|
||||
GAME_INPROGRESS: "There is currently a game inprogress."
|
||||
GAME_NOT_INPROGRESS: "There is no game inprogress."
|
||||
GAME_INPROGRESS: "There is currently a game in progress."
|
||||
GAME_NOT_INPROGRESS: "There is no game in progress."
|
||||
GAME_JOIN: "{PLAYER} has joined the HideAndSeek lobby."
|
||||
GAME_JOIN_SPECTATOR: "You have joined midgame and are now a spectator."
|
||||
GAME_JOIN_SPECTATOR: "You have joined mid game and are now a spectator."
|
||||
GAME_LEAVE: "{PLAYER} has left the HideAndSeek lobby."
|
||||
CONFIG_RELOAD: "Reloaded the config."
|
||||
MAPSAVE_INPROGRESS: "Map save is currently in progress. Try again later."
|
||||
MAPSAVE_START: "Starting map save."
|
||||
MAPSAVE_WARNING: "All commands will be disabled when the save is in progress. Do not turn off the server."
|
||||
MAPSAVE_END: "Map save complete."
|
||||
MAPSAVE_ERROR: "Coudnt find current map."
|
||||
WORLDBORDER_DISABLE: "Disabled worldborder."
|
||||
MAPSAVE_ERROR: "Couldn't find current map."
|
||||
WORLDBORDER_DISABLE: "Disabled world border."
|
||||
WORLDBORDER_INVALID_INPUT: "Invalid integer {AMOUNT}."
|
||||
WORLDBORDER_MIN_SIZE: "Worldborder cannot be smaller than 100 blocks."
|
||||
WORLDBORDER_POSITION: "Spawn position must be 100 from worldborder center."
|
||||
WORLDBORDER_MIN_SIZE: "World border cannot be smaller than 100 blocks."
|
||||
WORLDBORDER_POSITION: "Spawn position must be 100 from world border center."
|
||||
WORLDBORDER_ENABLE: "Set border center to current location, size to {AMOUNT}, and delay to {AMOUNT}."
|
||||
WORLDBORDER_DECREASING: "Worlderborder decreasing by 100 blocks over the next 30s."
|
||||
WORLDBORDER_DECREASING: "Would border decreasing by 100 blocks over the next 30s."
|
||||
TAUNTED: "$c$oOh no! You have been chosen to be taunted."
|
||||
TAUNT: "A random hider will be taunted in the next 30s."
|
||||
TAUNT_ACTIVATE: "Taunt has been activated."
|
||||
ERROR_GAME_SPAWN: "Please set game spawn location first"
|
||||
SETUP: "&f&lThe following is needed for setup..."
|
||||
SETUP_GAME: "&c&l- &fGame spawn isnt set, /hs setspawn"
|
||||
SETUP_LOBBY: "&c&l- &fLobby spawn isnt set, /hs setlobby"
|
||||
SETUP_EXIT: "&c&l- &fQuit/exit teleport location isnt set, /hs setexit"
|
||||
SETUP_SAVEMAP: "&c&l- &fHide and seek map isnt saved, /hs savemap (after /hs setspawn)"
|
||||
SETUP_GAME: "&c&l- &fGame spawn isn't set, /hs setspawn"
|
||||
SETUP_LOBBY: "&c&l- &fLobby spawn isn't set, /hs setlobby"
|
||||
SETUP_EXIT: "&c&l- &fQuit/exit teleport location isn't set, /hs setexit"
|
||||
SETUP_SAVEMAP: "&c&l- &fHide and seek map isn't saved, /hs savemap (after /hs setspawn)"
|
||||
SETUP_BOUNDS: "&c&l- &fPlease set game bounds in 2 opposite corners of the game map, /hs setbounds"
|
||||
SETUP_COMPLETE: "Everything is setup and ready to go!"
|
||||
GAME_SPAWN: "Set game spawn position to current location"
|
||||
|
@ -45,9 +45,10 @@ Localization:
|
|||
START_MIN_PLAYERS: "You must have at least {AMOUNT} players to start."
|
||||
START_INVALID_NAME: "Invalid player: {PLAYER}."
|
||||
START_COUNTDOWN: "Hiders have {AMOUNT} seconds to hide!"
|
||||
START: "Attetion SEEKERS, its time to fin the hiders!"
|
||||
START: "Attention SEEKERS, its time to fin the hiders!"
|
||||
STOP: "Game has been force stopped."
|
||||
HIDERS_SUBTITLE: "Hide away from the seekers"
|
||||
SEEKERS_SUBTITLE: "Eliminate all hiders"
|
||||
BOUNDS_WRONG_WORLD: "Please run this command in the game world."
|
||||
BOUNDS: "Sucessfully set bounds at this position."
|
||||
BOUNDS: "Successfully set bounds at this position ({AMOUNT}/2)."
|
||||
NOT_AT_ZERO: "Please do not set at a location containing a coordinate at 0."
|
||||
|
|
|
@ -21,6 +21,7 @@ permissions:
|
|||
hideandseek.setspawn: true
|
||||
hideandseek.setlobby: true
|
||||
hideandseek.setexit: true
|
||||
hideadnseek.setbounds: true
|
||||
hideandseek.setup: true
|
||||
hideandseek.start: true
|
||||
hideandseek.stop: true
|
||||
|
@ -48,6 +49,9 @@ permissions:
|
|||
hideandseek.setexit:
|
||||
description: Allows you to set the game exit point
|
||||
default: op
|
||||
hideandseek.setbounds:
|
||||
description: Allows you to set bounds for the game map
|
||||
default: op
|
||||
hideandseek.setup:
|
||||
description: Allows you to see what needs to be setup for the plugin to function
|
||||
default: op
|
||||
|
|
Loading…
Reference in a new issue