summaryrefslogtreewikicommitdiff
path: root/src/main/java/net/tylermurphy/hideAndSeek/util
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2021-10-31 11:25:27 -0400
committerTyler Murphy <tylermurphy534@gmail.com>2021-10-31 11:25:27 -0400
commit2a526291526811841d02ff813d9b3a7752570b43 (patch)
tree5bbac1fc857d4a87446470f1db5356ec89b64536 /src/main/java/net/tylermurphy/hideAndSeek/util
parent1.3.1 build 3 (diff)
downloadkenshinshideandseek-2a526291526811841d02ff813d9b3a7752570b43.tar.gz
kenshinshideandseek-2a526291526811841d02ff813d9b3a7752570b43.tar.bz2
kenshinshideandseek-2a526291526811841d02ff813d9b3a7752570b43.zip
1.3.1 build 4
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/util')
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/util/Board.java15
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/util/CustomBoard.java8
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/util/Util.java54
3 files changed, 25 insertions, 52 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/Board.java b/src/main/java/net/tylermurphy/hideAndSeek/util/Board.java
index 59b9ac8..80cbdee 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/util/Board.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/util/Board.java
@@ -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);
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/CustomBoard.java b/src/main/java/net/tylermurphy/hideAndSeek/util/CustomBoard.java
index a01d965..69d865a 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/util/CustomBoard.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/util/CustomBoard.java
@@ -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);
}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/Util.java b/src/main/java/net/tylermurphy/hideAndSeek/util/Util.java
index 3ab04a9..c24936b 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/util/Util.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/util/Util.java
@@ -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));
}
}
-
} \ No newline at end of file