summaryrefslogtreewikicommitdiff
path: root/src/main/java/net/tylermurphy/hideAndSeek/util/Util.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/util/Util.java')
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/util/Util.java86
1 files changed, 69 insertions, 17 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/Util.java b/src/main/java/net/tylermurphy/hideAndSeek/util/Util.java
index 9c6c1eb..3ab04a9 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/util/Util.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/util/Util.java
@@ -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) {
+ 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);
- YamlConfiguration defaultConfig = null;
+ 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);
- 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();
+ 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;
}
} \ No newline at end of file