glow powerup
This commit is contained in:
parent
f551daa9ca
commit
8f0a3ef68c
7 changed files with 207 additions and 170 deletions
|
@ -11,7 +11,6 @@ import org.bukkit.event.Listener;
|
|||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.manager.BoardManager;
|
||||
import net.tylermurphy.hideAndSeek.manager.CommandManager;
|
||||
import net.tylermurphy.hideAndSeek.manager.EventManager;
|
||||
import net.tylermurphy.hideAndSeek.manager.TickManager;
|
||||
|
@ -19,7 +18,6 @@ import net.tylermurphy.hideAndSeek.manager.TickManager;
|
|||
public class Main extends JavaPlugin implements Listener {
|
||||
|
||||
public static Main plugin;
|
||||
private int tickTaskId;
|
||||
|
||||
public void onEnable() {
|
||||
|
||||
|
@ -56,22 +54,20 @@ public class Main extends JavaPlugin implements Listener {
|
|||
// Register Commands
|
||||
CommandManager.registerCommands();
|
||||
|
||||
// Init Scoreboard
|
||||
if(Bukkit.getScoreboardManager() != null) {
|
||||
BoardManager.loadScoreboard();
|
||||
}
|
||||
|
||||
// Start Tick Timer
|
||||
tickTaskId = Bukkit.getServer().getScheduler().runTaskTimer(this, new Runnable(){
|
||||
Bukkit.getServer().getScheduler().runTaskTimer(this, new Runnable(){
|
||||
public void run(){
|
||||
try{
|
||||
TickManager.onTick();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
},0,1).getTaskId();
|
||||
}
|
||||
},0,1);
|
||||
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
Bukkit.getServer().getScheduler().cancelTask(tickTaskId);
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,33 +1,37 @@
|
|||
package net.tylermurphy.hideAndSeek;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public class Store {
|
||||
|
||||
public static Map<String,Player> playerList = new HashMap<String,Player>();
|
||||
public static List<String> loadedPlayers = new ArrayList<String>();
|
||||
|
||||
public static Scoreboard board;
|
||||
public static Team Hider,Seeker,Spectator;
|
||||
|
||||
public static String status = "Setup";
|
||||
|
||||
public static String messagePrefix = String.format("%sHide and Seek > %s", ChatColor.BLUE, ChatColor.WHITE);
|
||||
public static String errorPrefix = String.format("%sError > %s", ChatColor.RED, ChatColor.WHITE);
|
||||
public static Vector spawnPosition,worldborderPosition;
|
||||
|
||||
public static Vector spawnPosition;
|
||||
|
||||
public static Vector worldborderPosition;
|
||||
public static int worldborderSize,worldborderDelay,currentWorldborderSize;
|
||||
public static boolean worldborderEnabled = false, decreaseBorder = false;
|
||||
|
||||
public static String tauntPlayer = "";
|
||||
public static HashMap<String,Integer> playerData = new HashMap<String,Integer>();
|
||||
public static int startTaskId;
|
||||
|
||||
public static int glowTime = 0;
|
||||
|
||||
public static int gameId = 0;
|
||||
|
||||
public static FileConfiguration getConfig() {
|
||||
|
@ -38,20 +42,4 @@ public class Store {
|
|||
Main.plugin.saveConfig();
|
||||
}
|
||||
|
||||
public static int getPlayerData(String playerName, String key) {
|
||||
if(playerData.get(playerName + " " + key) == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return playerData.get(playerName + " " + key);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setPlayerData(String playerName, String key, int value) {
|
||||
playerData.put(playerName + " " + key, value);
|
||||
}
|
||||
|
||||
public static void resetPlayerData(String playerName, boolean giveItems) {
|
||||
playerData.put(playerName+" Death", 0);
|
||||
playerData.put(playerName+" GiveStatus", (giveItems) ? 1 : 0);
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ import net.tylermurphy.hideAndSeek.ICommand;
|
|||
import net.tylermurphy.hideAndSeek.Main;
|
||||
import net.tylermurphy.hideAndSeek.manager.TauntManager;
|
||||
import net.tylermurphy.hideAndSeek.manager.WorldborderManager;
|
||||
import net.tylermurphy.hideAndSeek.util.Functions;
|
||||
|
||||
import static net.tylermurphy.hideAndSeek.Store.*;
|
||||
|
||||
|
@ -37,16 +38,10 @@ public class Start implements ICommand {
|
|||
sender.sendMessage(errorPrefix + "No Seekers were found");
|
||||
return;
|
||||
}
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule sendCommandFeedback false");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule doImmediateRespawn true");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule logAdminCommands false");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule naturalRegeneration false");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule keepInventory true");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule showDeathMessages false");
|
||||
|
||||
playerData = new HashMap<String,Integer>();
|
||||
Functions.setGamerules();
|
||||
|
||||
for(Player player : playerList.values()) {
|
||||
resetPlayerData(player.getName(),true);
|
||||
player.getInventory().clear();
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
player.teleport(new Location(player.getWorld(), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
|
||||
|
@ -70,7 +65,7 @@ public class Start implements ICommand {
|
|||
}
|
||||
WorldborderManager.reset();
|
||||
status = "Starting";
|
||||
startTaskId = Bukkit.getServer().getScheduler().runTaskAsynchronously(Main.plugin, new Runnable(){
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(Main.plugin, new Runnable(){
|
||||
public void run() {
|
||||
int temp = gameId;
|
||||
Bukkit.getServer().broadcastMessage(messagePrefix + "Hiders have 30 seconds to hide!");
|
||||
|
@ -97,7 +92,7 @@ public class Start implements ICommand {
|
|||
Bukkit.getServer().broadcastMessage(messagePrefix + "Attetion SEEKERS, its time to find the hiders!");
|
||||
status = "Playing";
|
||||
}
|
||||
}).getTaskId();
|
||||
});
|
||||
if(worldborderEnabled) {
|
||||
WorldborderManager.schedule();
|
||||
}
|
||||
|
|
|
@ -17,7 +17,8 @@ public class Stop implements ICommand {
|
|||
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if(status.equals("Starting") || status.equals("Playing")) {
|
||||
onStop(true);
|
||||
Bukkit.broadcastMessage(messagePrefix + "Game has been force stopped.");
|
||||
onStop();
|
||||
|
||||
} else {
|
||||
sender.sendMessage(errorPrefix + "There is no game in progress");
|
||||
|
@ -29,15 +30,9 @@ public class Stop implements ICommand {
|
|||
return "stop";
|
||||
}
|
||||
|
||||
public static void onStop(boolean forced) {
|
||||
public static void onStop() {
|
||||
if(status.equals("Standby") || status.equals("Setup")) return;
|
||||
if(forced) {
|
||||
Bukkit.broadcastMessage(messagePrefix + "Game has been force stopped.");
|
||||
} else {
|
||||
Bukkit.broadcastMessage(messagePrefix + "Game over! All hiders have been found.");
|
||||
}
|
||||
status = "Standby";
|
||||
Bukkit.getServer().getScheduler().cancelTask(startTaskId);
|
||||
for(Player player : playerList.values()) {
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
Hider.addEntry(player.getName());
|
||||
|
|
|
@ -5,22 +5,28 @@ import static net.tylermurphy.hideAndSeek.Store.*;
|
|||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.tylermurphy.hideAndSeek.util.Functions;
|
||||
|
||||
public class EventManager implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if(Bukkit.getScoreboardManager() != null && board == null) {
|
||||
BoardManager.loadScoreboard();
|
||||
}
|
||||
if(status.equals("Playing") || status.equals("Starting")) {
|
||||
Spectator.addEntry(event.getPlayer().getName());
|
||||
resetPlayerData(event.getPlayer().getName(), false);
|
||||
event.getPlayer().sendMessage(messagePrefix + "You have joined mid game, and thus have been placed on the spectator team.");
|
||||
event.getPlayer().setGameMode(GameMode.SPECTATOR);
|
||||
event.getPlayer().getInventory().clear();
|
||||
|
@ -32,7 +38,6 @@ public class EventManager implements Listener {
|
|||
Hider.addEntry(event.getPlayer().getName());
|
||||
}
|
||||
playerList.put(event.getPlayer().getName(), event.getPlayer());
|
||||
if(board == null) BoardManager.loadScoreboard();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -53,8 +58,23 @@ public class EventManager implements Listener {
|
|||
Bukkit.getServer().broadcastMessage(String.format(messagePrefix + "%s%s%s has been beat by a hider", ChatColor.RED, event.getEntity().getName(), ChatColor.WHITE));
|
||||
}
|
||||
|
||||
setPlayerData(event.getEntity().getName(), "Death", 1);
|
||||
setPlayerData(event.getEntity().getName(), "GiveStatus", 1);
|
||||
Functions.giveItems(event.getEntity());
|
||||
Seeker.addEntry(event.getEntity().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onProjectile(ProjectileLaunchEvent event) {
|
||||
if(!status.equals("Playing")) return;
|
||||
if(event.getEntity() instanceof Snowball) {
|
||||
Snowball snowball = (Snowball) event.getEntity();
|
||||
if(snowball.getShooter() instanceof Player) {
|
||||
Player player = (Player) snowball.getShooter();
|
||||
if(Hider.hasEntry(player.getName())) {
|
||||
glowTime++;
|
||||
snowball.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,23 +7,15 @@ import org.bukkit.ChatColor;
|
|||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Firework;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.FireworkMeta;
|
||||
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;
|
||||
import org.bukkit.scoreboard.Team.Option;
|
||||
import org.bukkit.scoreboard.Team.OptionStatus;
|
||||
|
||||
import net.tylermurphy.hideAndSeek.commands.Stop;
|
||||
import net.tylermurphy.hideAndSeek.util.Functions;
|
||||
|
||||
public class TickManager {
|
||||
|
||||
|
@ -33,7 +25,7 @@ public class TickManager {
|
|||
|
||||
if(board == null) return;
|
||||
|
||||
checkTeams();
|
||||
Functions.checkTeams();
|
||||
|
||||
for(Player player : playerList.values()) {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 1000000, 127, false, false));
|
||||
|
@ -48,61 +40,14 @@ public class TickManager {
|
|||
}
|
||||
|
||||
tick ++;
|
||||
tick %= 10;
|
||||
|
||||
if(Hider.getSize() < 1) {
|
||||
Stop.onStop(false);
|
||||
Bukkit.broadcastMessage(messagePrefix + "Game over! All hiders have been found.");
|
||||
Stop.onStop();
|
||||
}
|
||||
if(Seeker.getSize() < 1) {
|
||||
Stop.onStop(false);
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkTeams() {
|
||||
|
||||
try { Hider.getSize(); }
|
||||
catch (Exception e) {
|
||||
board.registerNewTeam("Hider");
|
||||
Hider = board.getTeam("Hider");
|
||||
Hider.setColor(ChatColor.GOLD);
|
||||
Hider.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
|
||||
Hider.setAllowFriendlyFire(false);
|
||||
}
|
||||
|
||||
try { Seeker.getSize(); }
|
||||
catch (Exception e) {
|
||||
board.registerNewTeam("Seeker");
|
||||
Seeker = board.getTeam("Seeker");
|
||||
Seeker.setColor(ChatColor.RED);
|
||||
Seeker.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
|
||||
Seeker.setAllowFriendlyFire(false);
|
||||
}
|
||||
|
||||
try { Spectator.getSize(); }
|
||||
catch (Exception e) {
|
||||
board.registerNewTeam("Spectator");
|
||||
Spectator = board.getTeam("Spectator");
|
||||
Spectator.setColor(ChatColor.GRAY);
|
||||
Spectator.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
|
||||
Spectator.setAllowFriendlyFire(false);
|
||||
}
|
||||
|
||||
for(String entry : Hider.getEntries()) {
|
||||
if(!playerList.containsKey(entry)) {
|
||||
Hider.removeEntry(entry);
|
||||
}
|
||||
}
|
||||
|
||||
for(String entry : Seeker.getEntries()) {
|
||||
if(!playerList.containsKey(entry)) {
|
||||
Seeker.removeEntry(entry);
|
||||
}
|
||||
}
|
||||
|
||||
for(String entry : Spectator.getEntries()) {
|
||||
if(!playerList.containsKey(entry)) {
|
||||
Spectator.removeEntry(entry);
|
||||
}
|
||||
Bukkit.broadcastMessage(messagePrefix + "Game has ended as all seekers have quit.");
|
||||
Stop.onStop();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,7 +76,7 @@ public class TickManager {
|
|||
if(taunted != null) {
|
||||
Firework fw = (Firework) taunted.getLocation().getWorld().spawnEntity(taunted.getLocation(), EntityType.FIREWORK);
|
||||
FireworkMeta fwm = fw.getFireworkMeta();
|
||||
fwm.setPower(2);
|
||||
fwm.setPower(4);
|
||||
fwm.addEffect(FireworkEffect.builder()
|
||||
.withColor(Color.BLUE)
|
||||
.withColor(Color.RED)
|
||||
|
@ -149,54 +94,6 @@ public class TickManager {
|
|||
}
|
||||
for(Player player : playerList.values()) {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.DOLPHINS_GRACE, 1000000, 1, false, false));
|
||||
if(getPlayerData(player.getName(),"Death") > 0) {
|
||||
setPlayerData(player.getName(),"Death",0);
|
||||
Seeker.addEntry(player.getName());
|
||||
}
|
||||
if(getPlayerData(player.getName(),"GiveStatus") > 0) {
|
||||
setPlayerData(player.getName(),"GiveStatus",0);
|
||||
player.getInventory().clear();
|
||||
for(PotionEffect effect : player.getActivePotionEffects()){
|
||||
player.removePotionEffect(effect.getType());
|
||||
}
|
||||
if(Seeker.getEntries().contains(player.getName())){
|
||||
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);
|
||||
}
|
||||
else if(Hider.getEntries().contains(player.getName())){
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(String playerName : Seeker.getEntries()) {
|
||||
Player player = playerList.get(playerName);
|
||||
|
@ -206,6 +103,11 @@ public class TickManager {
|
|||
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 1000000, 1, false, false));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 1000000, 10, false, false));
|
||||
}
|
||||
if(glowTime > 0) {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 1000000, 1, false, false));
|
||||
} else {
|
||||
player.removePotionEffect(PotionEffectType.GLOWING);
|
||||
}
|
||||
}
|
||||
for(String playerName : Hider.getEntries()) {
|
||||
Player player = playerList.get(playerName);
|
||||
|
@ -223,7 +125,7 @@ public class TickManager {
|
|||
int x = player.getLocation().getBlockX();
|
||||
int y = player.getLocation().getBlockY();
|
||||
int z = player.getLocation().getBlockZ();
|
||||
switch(tick) {
|
||||
switch(tick%10) {
|
||||
case 0:
|
||||
if(distance < 30) Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), String.format("playsound minecraft:block.note_block.basedrum master %s %s %s %s .5 1",player.getName(),x,y,z));
|
||||
if(distance < 10) Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), String.format("playsound minecraft:block.note_block.bit master %s %s %s %s .3 1",player.getName(),x,y,z));
|
||||
|
@ -240,6 +142,9 @@ public class TickManager {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if(tick%(20*30) == 0) {
|
||||
glowTime = Math.max(0, glowTime--);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
138
src/main/java/net/tylermurphy/hideAndSeek/util/Functions.java
Normal file
138
src/main/java/net/tylermurphy/hideAndSeek/util/Functions.java
Normal file
|
@ -0,0 +1,138 @@
|
|||
package net.tylermurphy.hideAndSeek.util;
|
||||
|
||||
import static net.tylermurphy.hideAndSeek.Store.Hider;
|
||||
import static net.tylermurphy.hideAndSeek.Store.Seeker;
|
||||
import static net.tylermurphy.hideAndSeek.Store.Spectator;
|
||||
import static net.tylermurphy.hideAndSeek.Store.board;
|
||||
import static net.tylermurphy.hideAndSeek.Store.playerList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
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.PotionType;
|
||||
import org.bukkit.scoreboard.Team.Option;
|
||||
import org.bukkit.scoreboard.Team.OptionStatus;
|
||||
|
||||
public class Functions {
|
||||
|
||||
public static void setGamerules() {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule sendCommandFeedback false");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule doImmediateRespawn true");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule logAdminCommands false");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule naturalRegeneration false");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule keepInventory true");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule showDeathMessages false");
|
||||
}
|
||||
|
||||
public static void giveItems(Player player) {
|
||||
player.getInventory().clear();
|
||||
for(PotionEffect effect : player.getActivePotionEffects()){
|
||||
player.removePotionEffect(effect.getType());
|
||||
}
|
||||
if(Seeker.getEntries().contains(player.getName())){
|
||||
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);
|
||||
}
|
||||
else if(Hider.getEntries().contains(player.getName())){
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkTeams() {
|
||||
|
||||
try { Hider.getSize(); }
|
||||
catch (Exception e) {
|
||||
board.registerNewTeam("Hider");
|
||||
Hider = board.getTeam("Hider");
|
||||
Hider.setColor(ChatColor.GOLD);
|
||||
Hider.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
|
||||
Hider.setAllowFriendlyFire(false);
|
||||
}
|
||||
|
||||
try { Seeker.getSize(); }
|
||||
catch (Exception e) {
|
||||
board.registerNewTeam("Seeker");
|
||||
Seeker = board.getTeam("Seeker");
|
||||
Seeker.setColor(ChatColor.RED);
|
||||
Seeker.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
|
||||
Seeker.setAllowFriendlyFire(false);
|
||||
}
|
||||
|
||||
try { Spectator.getSize(); }
|
||||
catch (Exception e) {
|
||||
board.registerNewTeam("Spectator");
|
||||
Spectator = board.getTeam("Spectator");
|
||||
Spectator.setColor(ChatColor.GRAY);
|
||||
Spectator.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
|
||||
Spectator.setAllowFriendlyFire(false);
|
||||
}
|
||||
|
||||
for(String entry : Hider.getEntries()) {
|
||||
if(!playerList.containsKey(entry)) {
|
||||
Hider.removeEntry(entry);
|
||||
}
|
||||
}
|
||||
|
||||
for(String entry : Seeker.getEntries()) {
|
||||
if(!playerList.containsKey(entry)) {
|
||||
Seeker.removeEntry(entry);
|
||||
}
|
||||
}
|
||||
|
||||
for(String entry : Spectator.getEntries()) {
|
||||
if(!playerList.containsKey(entry)) {
|
||||
Spectator.removeEntry(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue