1.3.1 build 3

This commit is contained in:
Tyler Murphy 2021-10-29 19:57:40 -04:00
parent 3ebb86268a
commit 4188dadbe3
12 changed files with 345 additions and 172 deletions

View file

@ -27,7 +27,8 @@ import org.bukkit.event.player.PlayerQuitEvent;
import net.tylermurphy.hideAndSeek.util.Packet;
import net.tylermurphy.hideAndSeek.util.Util;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.Start;
import org.bukkit.potion.PotionEffect;
import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
public class EventListener implements Listener {
@ -52,6 +53,9 @@ public class EventListener implements Listener {
} else {
Main.plugin.board.reloadGameBoards();
}
for(PotionEffect effect : event.getPlayer().getActivePotionEffects()){
event.getPlayer().removePotionEffect(effect.getType());
}
}
@EventHandler
@ -62,6 +66,9 @@ public class EventListener implements Listener {
} else {
Main.plugin.board.reloadGameBoards();
}
for(PotionEffect effect : event.getPlayer().getActivePotionEffects()){
event.getPlayer().removePotionEffect(effect.getType());
}
}
@EventHandler(priority = EventPriority.HIGHEST)
@ -100,7 +107,8 @@ public class EventListener implements Listener {
}
Main.plugin.board.addSeeker(player);
}
Start.resetPlayer(player);
Util.resetPlayer(player);
Main.plugin.board.reloadBoardTeams();
}
}
}
@ -109,6 +117,7 @@ public class EventListener implements Listener {
public void onProjectile(ProjectileLaunchEvent event) {
if(!Main.plugin.status.equals("Playing")) return;
if(event.getEntity() instanceof Snowball) {
if(!glowEnabled) return;
Snowball snowball = (Snowball) event.getEntity();
if(snowball.getShooter() instanceof Player) {
Player player = (Player) snowball.getShooter();

View file

@ -29,18 +29,21 @@ public class Join implements ICommand {
sender.sendMessage(errorPrefix + message("GAME_INGAME"));
return;
}
if(Main.plugin.status.equals("Standby")) {
player.getInventory().clear();
Main.plugin.board.addHider(player);
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player));
else Util.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player));
player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
player.setGameMode(GameMode.ADVENTURE);
Main.plugin.board.createLobbyBoard(player);
Main.plugin.board.reloadLobbyBoards();
} else {
Main.plugin.board.addSeeker(player);
Main.plugin.board.addSpectator(player);
player.sendMessage(messagePrefix + message("GAME_JOIN_SPECTATOR"));
player.setGameMode(GameMode.SPECTATOR);
Main.plugin.board.createGameBoard(player);
player.teleport(new Location(Bukkit.getWorld("hideandseek_"+spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
}

View file

@ -36,6 +36,7 @@ public class Leave implements ICommand {
Main.plugin.board.reloadLobbyBoards();
} else {
Main.plugin.board.reloadGameBoards();
Main.plugin.board.reloadBoardTeams();
}
}

View file

@ -90,6 +90,9 @@ public class Start implements ICommand {
player.sendTitle(ChatColor.GOLD + "" + ChatColor.BOLD + "HIDER", ChatColor.WHITE + message("HIDERS_SUBTITLE").toString(), 10, 70, 20);
}
Worldborder.resetWorldborder("hideandseek_"+spawnWorld);
for(Player player : Main.plugin.board.getPlayers()){
Main.plugin.board.createGameBoard(player);
}
Main.plugin.board.reloadGameBoards();
Main.plugin.status = "Starting";
int temp = Main.plugin.gameId;
@ -106,7 +109,7 @@ public class Start implements ICommand {
Util.broadcastMessage(messagePrefix + message("START"));
Main.plugin.status = "Playing";
for(Player player : Main.plugin.board.getPlayers()) {
resetPlayer(player);
Util.resetPlayer(player);
}
Main.plugin.worldborder = null;
Main.plugin.taunt = null;
@ -116,11 +119,15 @@ public class Start implements ICommand {
Main.plugin.worldborder = new Worldborder(Main.plugin.gameId);
Main.plugin.worldborder.schedule();
}
Main.plugin.taunt = new Taunt(Main.plugin.gameId);
Main.plugin.taunt.schedule();
Main.plugin.glow = new Glow(Main.plugin.gameId);
if(tauntEnabled) {
Main.plugin.taunt = new Taunt(Main.plugin.gameId);
Main.plugin.taunt.schedule();
}
if (glowEnabled) {
Main.plugin.glow = new Glow(Main.plugin.gameId);
}
if(gameLength > 0) {
Main.plugin.timeLeft = gameLength;
@ -130,69 +137,6 @@ public class Start implements ICommand {
}
public static void resetPlayer(Player player) {
player.getInventory().clear();
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));
}
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);
ItemStack snowball = new ItemStack(Material.SNOWBALL,1);
ItemMeta snowballMeta = snowball.getItemMeta();
snowballMeta.setDisplayName("Glow Powerup");
List<String> snowballLore = new ArrayList<String>();
snowballLore.add("Throw to make all seekers glow");
snowballLore.add("Last 30s, all hiders can see it");
snowballLore.add("Time stacks on multi use");
snowballMeta.setLore(snowballLore);
snowball.setItemMeta(snowballMeta);
player.getInventory().addItem(snowball);
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 1000000, 1, false, false));
}
}
public String getLabel() {
return "start";
}

View file

@ -45,8 +45,8 @@ public class Stop implements ICommand {
Main.plugin.timeLeft = 0;
Worldborder.resetWorldborder("hideandseek_"+spawnWorld);
for(Player player : Main.plugin.board.getPlayers()) {
Main.plugin.board.createLobbyBoard(player);
player.setGameMode(GameMode.ADVENTURE);
player.setLevel(0);
Main.plugin.board.addHider(player);
player.getInventory().clear();
player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));

View file

@ -37,7 +37,12 @@ public class Config {
nametagsVisible,
permissionsRequired,
announceMessagesToNonPlayers,
worldborderEnabled;
worldborderEnabled,
tauntEnabled,
tauntCountdown,
tauntLast,
glowEnabled,
glowStackable;
public static int
minPlayers,
@ -48,11 +53,14 @@ public class Config {
saveMinX,
saveMinZ,
saveMaxX,
saveMaxZ;
saveMaxZ,
tauntDelay,
glowLength;
public static void loadConfig() {
manager = new ConfigManager("config.yml");
manager.saveConfig();
//Spawn
spawnPosition = new Vector(
@ -91,7 +99,7 @@ public class Config {
//Prefix
char SYMBOLE = '\u00A7';
String SYMBOLE_STRING = new String(new char[]{SYMBOLE});
String SYMBOLE_STRING = String.valueOf(SYMBOLE);
messagePrefix = manager.getString("prefix.default").replace("&", SYMBOLE_STRING);
errorPrefix = manager.getString("prefix.error").replace("&", SYMBOLE_STRING);
@ -107,13 +115,22 @@ public class Config {
saveMaxX = manager.getInt("bounds.max.x");
saveMaxZ = manager.getInt("bounds.max.z");
//Taunt
tauntEnabled = manager.getBoolean("taunt.enabled");
tauntCountdown = manager.getBoolean("taunt.showCountdown");
tauntDelay = Math.max(60,manager.getInt("taunt.delay"));
tauntLast = manager.getBoolean("taunt.whenLastPerson");
//Glow
glowLength = Math.max(1,manager.getInt("glow.time"));
glowStackable = manager.getBoolean("glow.stackable");
glowEnabled = manager.getBoolean("glow.enabled");
//Other
nametagsVisible = manager.getBoolean("nametagsVisible");
permissionsRequired = manager.getBoolean("permissionsRequired");
minPlayers = Math.max(2, manager.getInt("minPlayers"));
gameLength = manager.getInt("gameLength");
manager.saveConfig();
}
public static void addToConfig(String path, Object value) {

View file

@ -6,6 +6,8 @@ import org.bukkit.entity.Player;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.util.Packet;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
public class Glow {
private final int temp;
@ -18,7 +20,8 @@ public class Glow {
}
public void onProjectilve() {
glowTime++;
if(glowStackable) glowTime += glowLength;
else glowTime = glowLength;
if(!running)
startGlow();
}
@ -45,15 +48,20 @@ public class Glow {
waitGlow();
}
}
}, 20*30);
}, 20);
}
private void stopGlow() {
running = false;
for(Player hider : Main.plugin.board.getHiders()) {
for(Player seeker : Main.plugin.board.getSeekers()) {
for (Player seeker : Main.plugin.board.getSeekers()) {
Packet.setGlow(hider, seeker, false);
}
}
}
public boolean isRunning() {
return running;
}
}

View file

@ -18,38 +18,31 @@ public class Taunt {
private final int temp;
private String tauntPlayer;
private int delay;
private boolean running;
public Taunt(int temp) {
this.temp = temp;
this.delay = 0;
}
public void schedule() {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.plugin, new Runnable() {
public void run() {
tryTaunt();
}
},20*60*5);
delay = tauntDelay;
waitTaunt();
}
private void waitTaunt() {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.plugin, new Runnable() {
public void run() {
tryTaunt();
}
},20*60);
}
private void tryTaunt() {
if(temp != Main.plugin.gameId) return;
if(Math.random() > .8) {
executeTaunt();
} else {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.plugin, new Runnable() {
public void run() {
tryTaunt();
if(delay == 0) {
if(!tauntLast && Main.plugin.board.size() < 2) return;
else executeTaunt();
} else {
delay--;
waitTaunt();
}
},20*60);
}
}
},20);
}
private void executeTaunt() {
@ -65,6 +58,7 @@ public class Taunt {
}
}
if(taunted != null) {
running = true;
taunted.sendMessage(message("TAUNTED").toString());
Util.broadcastMessage(tauntPrefix + message("TAUNT"));
tauntPlayer = taunted.getName();
@ -90,12 +84,21 @@ public class Taunt {
Util.broadcastMessage(tauntPrefix + message("TAUNT_ACTIVATE"));
}
tauntPlayer = "";
waitTaunt();
running = false;
schedule();
}
},20*30);
} else {
waitTaunt();
schedule();
}
}
public int getDelay(){
return delay;
}
public boolean isRunning() {
return running;
}
}

View file

@ -26,7 +26,8 @@ public class Board {
private List<String> Hider, Seeker, Spectator;
private Map<String, Player> playerList = new HashMap<String,Player>();
private Map<String, CustomBoard> customBoards = new HashMap<String, CustomBoard>();
public boolean isPlayer(Player player) {
return playerList.containsKey(player.getName());
}
@ -145,64 +146,81 @@ public class Board {
seekerTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
}
}
private void createLobbyBoard(Player player) {
Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
Objective obj = board.registerNewObjective("LobbyScoreboard", "dummy",
ChatColor.translateAlternateColorCodes('&', "&l&eHIDE AND SEEK"));
createTeamsForBoard(board);
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
Score waiting = obj.getScore("Waiting to start...");
waiting.setScore(6);
Score blank1 = obj.getScore(ChatColor.RESET.toString());
blank1.setScore(5);
Score players = obj.getScore("Players: "+playerList.values().size());
players.setScore(4);
Score blank2 = obj.getScore(ChatColor.RESET.toString() + ChatColor.RESET.toString());
blank2.setScore(3);
Score seeker = obj.getScore(ChatColor.BOLD + "" + ChatColor.RED + "SEEKER%" + ChatColor.WHITE + getSeekerPercent());
seeker.setScore(2);
Score hider = obj.getScore(ChatColor.BOLD + "" + ChatColor.GOLD + "HIDER%" + ChatColor.WHITE + getHiderPercent());
hider.setScore(1);
player.setScoreboard(board);
public void createLobbyBoard(Player player) {
createLobbyBoard(player, true);
}
private void createGameBoard(Player player) {
Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
Objective obj = board.registerNewObjective("GameScoreboard", "dummy",
ChatColor.translateAlternateColorCodes('&', "&l&eHIDE AND SEEK"));
createTeamsForBoard(board);
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
Score team = obj.getScore("Team: " + getTeam(player));
team.setScore(6);
Score blank1 = obj.getScore(ChatColor.RESET.toString());
blank1.setScore(5);
if(gameLength > 0) {
Score waiting = obj.getScore(ChatColor.GREEN + "Time Left: " + ChatColor.WHITE + Main.plugin.timeLeft/60 + "m" + Main.plugin.timeLeft%60 + "s");
waiting.setScore(4);
Score blank2 = obj.getScore(ChatColor.RESET.toString() + ChatColor.RESET.toString());
blank2.setScore(3);
private void createLobbyBoard(Player player, boolean recreate) {
CustomBoard board = customBoards.get(player.getName());
if(recreate) {
board = new CustomBoard(player, "&l&eHIDE AND SEEK");
board.updateTeams();
}
Score seeker = obj.getScore(ChatColor.BOLD + "" + ChatColor.RED + "SEEKERS:" + ChatColor.WHITE + " " + Seeker.size());
seeker.setScore(2);
Score hider = obj.getScore(ChatColor.BOLD + "" + ChatColor.GOLD + "HIDERS:" + ChatColor.WHITE + " " + Hider.size());
hider.setScore(1);
player.setScoreboard(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.setLine("players", "Players: " + playerList.values().size());
board.addBlank(recreate);
board.setLine("waiting", "Waiting to start...");
board.display();
customBoards.put(player.getName(), board);
}
public void createGameBoard(Player player){
createGameBoard(player, true);
}
private void createGameBoard(Player player, boolean recreate){
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);
if(glowEnabled){
if(Main.plugin.glow == null || !Main.plugin.glow.isRunning())
board.setLine("glow", "Glow: " + ChatColor.RED + "Inactive");
else
board.setLine("glow", "Glow: " + ChatColor.GREEN + "Active");
}
if(tauntEnabled && tauntCountdown){
if(Main.plugin.taunt == null)
board.setLine("taunt", "Taunt: " + ChatColor.YELLOW + "0m0s");
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.setLine("time", "Time Left: " + ChatColor.GREEN + Main.plugin.timeLeft/60 + "m" + Main.plugin.timeLeft%60 + "s");
board.addBlank(recreate);
board.setLine("team", "Team: " + getTeam(player));
board.display();
customBoards.put(player.getName(), board);
}
public void removeBoard(Player player) {
player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
customBoards.remove(player.getName());
}
public void reloadLobbyBoards() {
for(Player player : playerList.values())
createLobbyBoard(player);
createLobbyBoard(player, false);
}
public void reloadGameBoards() {
for(Player player : playerList.values())
createGameBoard(player);
createGameBoard(player, false);
}
public void reloadBoardTeams() {
for(CustomBoard board : customBoards.values())
board.updateTeams();
}
private String getSeekerPercent() {

View file

@ -0,0 +1,117 @@
package net.tylermurphy.hideAndSeek.util;
import net.tylermurphy.hideAndSeek.Main;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.*;
import java.util.HashMap;
import java.util.Map;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
public class CustomBoard {
private final Scoreboard board;
private final Objective obj;
private final Player player;
private final Map<String,Line> LINES;
private int blanks;
public CustomBoard(Player player, String title){
this.board = Bukkit.getScoreboardManager().getNewScoreboard();
this.LINES = new HashMap<String,Line>();
this.player = player;
this.obj = board.registerNewObjective(
"Scoreboard", "dummy", ChatColor.translateAlternateColorCodes('&', title));
this.blanks = 0;
}
public void updateTeams() {
try{ board.registerNewTeam("Hider"); } catch (Exception e){}
try{ board.registerNewTeam("Seeker"); } catch (Exception e){}
Team hiderTeam = board.getTeam("Hider");
for(String entry : hiderTeam.getEntries())
hiderTeam.removeEntry(entry);
for(Player player : Main.plugin.board.getHiders())
hiderTeam.addEntry(player.getName());
Team seekerTeam = board.getTeam("Seeker");
for(String entry : seekerTeam.getEntries())
seekerTeam.removeEntry(entry);
for(Player player : Main.plugin.board.getSeekers())
seekerTeam.addEntry(player.getName());
if(nametagsVisible) {
hiderTeam.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
seekerTeam.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OTHER_TEAMS);
} else {
hiderTeam.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER);
seekerTeam.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER);
}
hiderTeam.setColor(ChatColor.GOLD);
seekerTeam.setColor(ChatColor.RED);
}
public void setLine(String key, String message){
Line line = LINES.get(key);
if(line == null)
addLine(key, message);
else
updateLine(key, message);
}
private void addLine(String key, String message){
Score score = obj.getScore(message);
score.setScore(LINES.values().size()+1);
Line line = new Line(LINES.values().size()+1, message);
LINES.put(key, line);
}
public void addBlank(boolean value){
if(!value) return;
String temp = "";
for(int i = 0; i <= blanks; i ++)
temp += ChatColor.RESET;
blanks++;
addLine("blank"+blanks, temp);
}
private void updateLine(String key, String message){
Line line = LINES.get(key);
board.resetScores(line.getMessage());
line.setMessage(message);
Score newScore = obj.getScore(message);
newScore.setScore(line.getScore());
}
public void display() {
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
player.setScoreboard(board);
}
}
class Line {
private int score;
private String message;
public Line(int score, String message){
this.score = score;
this.message = message;
}
public int getScore() {
return score;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}

View file

@ -3,14 +3,25 @@ package net.tylermurphy.hideAndSeek.util;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import net.md_5.bungee.api.ChatColor;
import net.tylermurphy.hideAndSeek.configuration.LocalizationString;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import net.tylermurphy.hideAndSeek.Main;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
public class Util {
@ -39,27 +50,68 @@ public class Util {
}, delay);
}
public YamlConfiguration loadDefaultConfig(String name) {
YamlConfiguration defaultConfig = null;
InputStream deafult_stream = null;
InputStreamReader default_stream_reader = null;
try {
deafult_stream = Class.class.getResourceAsStream(name + ".yml");
default_stream_reader = new InputStreamReader(deafult_stream);
defaultConfig = YamlConfiguration.loadConfiguration(default_stream_reader);
} catch (Exception e) {
// No Issue Here
} finally {
try {
deafult_stream.close();
default_stream_reader.close();
} catch (IOException e) {
e.printStackTrace();
}
public static void resetPlayer(Player player) {
player.getInventory().clear();
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));
} 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(glowEnabled) {
ItemStack snowball = new ItemStack(Material.SNOWBALL, 1);
ItemMeta snowballMeta = snowball.getItemMeta();
snowballMeta.setDisplayName("Glow Powerup");
List<String> snowballLore = new ArrayList<String>();
snowballLore.add("Throw to make all seekers glow");
snowballLore.add("Last 30s, all hiders can see it");
snowballLore.add("Time stacks on multi use");
snowballMeta.setLore(snowballLore);
snowball.setItemMeta(snowballMeta);
player.getInventory().addItem(snowball);
}
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 1000000, 1, false, false));
}
return defaultConfig;
}
}

View file

@ -54,7 +54,7 @@ worldBorder:
# 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.
# one Hider left. Taunt delay must at least be 60s.
taunt:
delay: 360
whenLastPerson: false
@ -64,7 +64,8 @@ taunt:
# 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.
# just overwrites. Only Hiders can see that the Seekers are glowing. Delay must
# be longer than 1s.
glow:
time: 30
stackable: true