refactoring, command restructure, bug fixes, glow rewrite

This commit is contained in:
Tyler Murphy 2021-08-23 13:57:50 -04:00
parent dc69e0ece9
commit 93dd4cfcc4
19 changed files with 225 additions and 252 deletions

View file

@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion>
<groupId>net.tylermurphy</groupId>
<artifactId>HideAndSeek</artifactId>
<version>1.1.2</version>
<version>1.2.0</version>
<name>Hide and Seek Plugin</name>
<build>
<plugins>

View file

@ -1,20 +1,24 @@
package net.tylermurphy.hideAndSeek.manager;
package net.tylermurphy.hideAndSeek;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import net.tylermurphy.hideAndSeek.ICommand;
import net.tylermurphy.hideAndSeek.commands.*;
import net.tylermurphy.hideAndSeek.commands.About;
import net.tylermurphy.hideAndSeek.commands.Help;
import net.tylermurphy.hideAndSeek.commands.SetBorder;
import net.tylermurphy.hideAndSeek.commands.SetSpawnLocation;
import net.tylermurphy.hideAndSeek.commands.Start;
import net.tylermurphy.hideAndSeek.commands.Stop;
import net.tylermurphy.hideAndSeek.util.ICommand;
import static net.tylermurphy.hideAndSeek.Store.*;
public class CommandManager implements CommandExecutor {
public class CommandHandler {
public static Map<String,ICommand> COMMAND_REGISTER = new LinkedHashMap<String,ICommand>();
@ -29,10 +33,8 @@ public class CommandManager implements CommandExecutor {
registerCommand(new Help());
registerCommand(new Start());
registerCommand(new Stop());
registerCommand(new SetSeeker());
registerCommand(new SetSpawnLocation());
registerCommand(new SetBorder());
registerCommand(new EnableBorder());
}
public static boolean handleCommand(CommandSender sender, Command cmd, String label, String[] args) {
@ -54,7 +56,7 @@ public class CommandManager implements CommandExecutor {
}
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
return CommandManager.handleCommand(sender, command, label, args);
return CommandHandler.handleCommand(sender, command, label, args);
}
}

View file

@ -0,0 +1,36 @@
package net.tylermurphy.hideAndSeek;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
public class CommandTabCompleter{
public static List<String> handleTabComplete(CommandSender sender, Command command, String label, String[] args) {
if(args.length == 1) {
return new ArrayList<String>(CommandHandler.COMMAND_REGISTER.keySet());
} else if(args.length > 1) {
if(!CommandHandler.COMMAND_REGISTER.containsKey(args[0].toLowerCase())) {
return null;
} else {
String[] usage = CommandHandler.COMMAND_REGISTER.get(args[0].toLowerCase()).getUsage().split(" ");
if(args.length - 2 < usage.length) {
String parameter = usage[args.length-2];
if(parameter.equals("<player>")) {
return null;//playerList.values().stream().map(p -> p.getName()).collect(Collectors.toList());
} else {
List<String> temp = new ArrayList<String>();
temp.add(parameter.replace("<", "").replace(">", ""));
return temp;
}
} else {
return null;
}
}
}
return null;
}
}

View file

@ -2,6 +2,8 @@ package net.tylermurphy.hideAndSeek;
import static net.tylermurphy.hideAndSeek.Store.*;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
@ -11,10 +13,8 @@ import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import net.tylermurphy.hideAndSeek.manager.CommandManager;
import net.tylermurphy.hideAndSeek.manager.EventManager;
import net.tylermurphy.hideAndSeek.manager.TickManager;
import net.tylermurphy.hideAndSeek.util.Functions;
import net.tylermurphy.hideAndSeek.events.EventListener;
import net.tylermurphy.hideAndSeek.events.EventTick;
public class Main extends JavaPlugin implements Listener {
@ -25,7 +25,7 @@ public class Main extends JavaPlugin implements Listener {
plugin = this;
// Setup Initial Player Count
getServer().getPluginManager().registerEvents(new EventManager(), this);
getServer().getPluginManager().registerEvents(new EventListener(), this);
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
playerList.put(player.getName(), player);
}
@ -45,13 +45,13 @@ public class Main extends JavaPlugin implements Listener {
worldborderEnabled = getConfig().getBoolean("borderEnabled");
// Register Commands
CommandManager.registerCommands();
CommandHandler.registerCommands();
// Start Tick Timer
Bukkit.getServer().getScheduler().runTaskTimer(this, new Runnable(){
public void run(){
try{
TickManager.onTick();
EventTick.onTick();
} catch (Exception e) {
e.printStackTrace();
}
@ -65,7 +65,11 @@ public class Main extends JavaPlugin implements Listener {
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
return CommandManager.handleCommand(sender, cmd, label, args);
return CommandHandler.handleCommand(sender, cmd, label, args);
}
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
return CommandTabCompleter.handleTabComplete(sender, command, label, args);
}
}

View file

@ -3,13 +3,13 @@ package net.tylermurphy.hideAndSeek.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import net.tylermurphy.hideAndSeek.ICommand;
import net.tylermurphy.hideAndSeek.util.ICommand;
public class About implements ICommand {
public void execute(CommandSender sender, String[] args) {
sender.sendMessage(
String.format("%s%sHide and Seek %s(1.1.2%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) +
String.format("%s%sHide and Seek %s(1.2.0%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) +
String.format("%sAuthor: %s[KenshinEto]\n", ChatColor.GRAY, ChatColor.WHITE) +
String.format("%sHelp Command: %s/hs %shelp", ChatColor.GRAY, ChatColor.AQUA, ChatColor.WHITE)
);

View file

@ -1,49 +0,0 @@
package net.tylermurphy.hideAndSeek.commands;
import org.bukkit.command.CommandSender;
import net.tylermurphy.hideAndSeek.ICommand;
import net.tylermurphy.hideAndSeek.manager.WorldborderManager;
import static net.tylermurphy.hideAndSeek.Store.*;
public class EnableBorder implements ICommand {
public void execute(CommandSender sender, String[] args) {
if(!status.equals("Standby") && !status.equals("Setup")) {
sender.sendMessage(errorPrefix + "Game is currently in session");
return;
}
if(worldborderPosition == null) {
sender.sendMessage(errorPrefix + "Please setup worldborder info before enabling");
return;
}
boolean bool;
try { bool = Boolean.parseBoolean(args[0]); } catch (Exception e) {
sender.sendMessage(errorPrefix + "Please enter true or false");
return;
}
if(spawnPosition != null && worldborderPosition != null && spawnPosition.distance(worldborderPosition) > 100) {
sender.sendMessage(errorPrefix + "Cannot enable worldborder, spawn position is outside 100 blocks from worldborder");
return;
}
sender.sendMessage(messagePrefix + "Set worldborder to "+args[0]);
getConfig().set("borderEnabled", bool);
worldborderEnabled = bool;
saveConfig();
WorldborderManager.reset();
}
public String getLabel() {
return "enableBorder";
}
public String getUsage() {
return "<true/false>";
}
public String getDescription() {
return "Enables or disables worldborder";
}
}

View file

@ -3,14 +3,14 @@ package net.tylermurphy.hideAndSeek.commands;
import org.bukkit.command.CommandSender;
import net.md_5.bungee.api.ChatColor;
import net.tylermurphy.hideAndSeek.ICommand;
import net.tylermurphy.hideAndSeek.manager.CommandManager;
import net.tylermurphy.hideAndSeek.CommandHandler;
import net.tylermurphy.hideAndSeek.util.ICommand;
public class Help implements ICommand {
public void execute(CommandSender sender, String[] args) {
String message = "";
for(ICommand command : CommandManager.COMMAND_REGISTER.values()) {
for(ICommand command : CommandHandler.COMMAND_REGISTER.values()) {
message += String.format("%s/hs %s%s %s%s\n %s%s%s", ChatColor.AQUA, ChatColor.WHITE, command.getLabel().toLowerCase(), ChatColor.BLUE, command.getUsage(), ChatColor.GRAY, ChatColor.ITALIC, command.getDescription()+"\n");
}
message = message.substring(0, message.length()-2);

View file

@ -4,8 +4,8 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import net.tylermurphy.hideAndSeek.ICommand;
import net.tylermurphy.hideAndSeek.manager.WorldborderManager;
import net.tylermurphy.hideAndSeek.util.Functions;
import net.tylermurphy.hideAndSeek.util.ICommand;
import static net.tylermurphy.hideAndSeek.Store.*;
@ -21,7 +21,11 @@ public class SetBorder implements ICommand {
return;
}
if(args.length < 2) {
sender.sendMessage(errorPrefix + "Please enter worldborder size and delay");
getConfig().set("borderEnabled", false);
worldborderEnabled = false;
saveConfig();
sender.sendMessage(messagePrefix + "Disabled worldborder.");
Functions.resetWorldborder();
return;
}
int num,delay;
@ -53,8 +57,10 @@ public class SetBorder implements ICommand {
getConfig().set("borderPosition", newWorldborderPosition);
getConfig().set("borderSize", num);
getConfig().set("borderDelay", delay);
getConfig().set("borderEnabled", false);
worldborderEnabled = true;
saveConfig();
WorldborderManager.reset();
Functions.resetWorldborder();
}
public String getLabel() {
@ -66,7 +72,7 @@ public class SetBorder implements ICommand {
}
public String getDescription() {
return "Sets worldboarder's center location, size in blocks, and delay in minutes";
return "Sets worldboarder's center location, size in blocks, and delay in minutes per shrink. Add no arguments to disable.";
}
}

View file

@ -1,47 +0,0 @@
package net.tylermurphy.hideAndSeek.commands;
import static net.tylermurphy.hideAndSeek.Store.*;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import net.tylermurphy.hideAndSeek.ICommand;
public class SetSeeker implements ICommand {
public void execute(CommandSender sender, String[] args) {
if(!status.equals("Standby") && !status.equals("Setup")) {
sender.sendMessage(errorPrefix + "Game is currently in session");
return;
}
String playerName;
if(args.length < 1) {
playerName = sender.getName();
} else {
playerName = args[0];
}
Player player = playerList.get(playerName);
if(player == null) {
sender.sendMessage(errorPrefix + "Invalid player: " + playerName);
return;
}
for(Player temp : playerList.values()) {
Hider.addEntry(temp.getName());
}
Seeker.addEntry(player.getName());
sender.sendMessage(String.format("%s Set %s as the seaker.", messagePrefix, playerName));
}
public String getLabel() {
return "setSeeker";
}
public String getUsage() {
return "<player>";
}
public String getDescription() {
return "Sets the current or select player as the seeker";
}
}

View file

@ -4,7 +4,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import net.tylermurphy.hideAndSeek.ICommand;
import net.tylermurphy.hideAndSeek.util.ICommand;
import static net.tylermurphy.hideAndSeek.Store.*;

View file

@ -9,14 +9,14 @@ import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
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 net.tylermurphy.hideAndSeek.util.ICommand;
import static net.tylermurphy.hideAndSeek.Store.*;
import java.util.Random;
public class Start implements ICommand {
public void execute(CommandSender sender, String[] args) {
@ -28,14 +28,26 @@ public class Start implements ICommand {
sender.sendMessage(errorPrefix + "Game is already in session");
return;
}
if(Hider.getSize() < 1) {
sender.sendMessage(errorPrefix + "No Hiders were found");
if(playerList.size() < 2) {
sender.sendMessage(errorPrefix + "You must have at least 2 players to start");
return;
}
if(Seeker.getSize() < 1) {
sender.sendMessage(errorPrefix + "No Seekers were found");
String seekerName;
if(args.length < 1) {
seekerName = playerList.values().stream().skip(new Random().nextInt(playerList.values().size())).findFirst().get().getName();
} else {
seekerName = args[0];
}
Player seeker = playerList.get(seekerName);
if(seeker == null) {
sender.sendMessage(errorPrefix + "Invalid player: " + seekerName);
return;
}
for(Player temp : playerList.values()) {
Hider.addEntry(temp.getName());
}
Seeker.addEntry(seeker.getName());
for(Player player : playerList.values()) {
player.getInventory().clear();
@ -59,7 +71,7 @@ public class Start implements ICommand {
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,1000000,5,false,false));
}
}
WorldborderManager.reset();
Functions.resetWorldborder();
status = "Starting";
int temp = gameId;
Bukkit.getServer().broadcastMessage(messagePrefix + "Hiders have 30 seconds to hide!");
@ -118,9 +130,9 @@ public class Start implements ICommand {
}, 20 * 30);
if(worldborderEnabled) {
WorldborderManager.schedule();
Functions.scheduleWorldborder();
}
TauntManager.schedule();
Functions.scheduleTaunt();
}
public String getLabel() {
@ -128,11 +140,11 @@ public class Start implements ICommand {
}
public String getUsage() {
return "";
return "<player>";
}
public String getDescription() {
return "Starts the game";
return "Starts the game either with a random seeker or chosen one";
}
}

View file

@ -10,8 +10,8 @@ import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import net.tylermurphy.hideAndSeek.ICommand;
import net.tylermurphy.hideAndSeek.manager.WorldborderManager;
import net.tylermurphy.hideAndSeek.util.Functions;
import net.tylermurphy.hideAndSeek.util.ICommand;
public class Stop implements ICommand {
@ -43,8 +43,11 @@ public class Stop implements ICommand {
player.removePotionEffect(effect.getType());
}
player.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 100));
for(Player temp : playerList.values()) {
Functions.setGlow(player, temp, false);
}
WorldborderManager.reset();
}
Functions.resetWorldborder();
}
public String getUsage() {

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.manager;
package net.tylermurphy.hideAndSeek.events;
import static net.tylermurphy.hideAndSeek.Store.*;
@ -25,7 +25,7 @@ import net.md_5.bungee.api.ChatColor;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.util.Functions;
public class EventManager implements Listener {
public class EventListener implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek.manager;
package net.tylermurphy.hideAndSeek.events;
import static net.tylermurphy.hideAndSeek.Store.*;
@ -20,7 +20,7 @@ import org.bukkit.potion.PotionEffectType;
import net.tylermurphy.hideAndSeek.commands.Stop;
import net.tylermurphy.hideAndSeek.util.Functions;
public class TickManager {
public class EventTick {
static int tick = 0;
@ -98,11 +98,6 @@ 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);
@ -116,6 +111,11 @@ public class TickManager {
if(distance > temp) {
distance = temp;
}
if(glowTime > 0) {
Functions.setGlow(player, seeker, true);
} else {
Functions.setGlow(player, seeker, false);
}
}
switch(tick%10) {
case 0:

View file

@ -1,52 +0,0 @@
package net.tylermurphy.hideAndSeek.manager;
import static net.tylermurphy.hideAndSeek.Store.*;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import net.tylermurphy.hideAndSeek.Main;
public class TauntManager {
public static void schedule() {
Bukkit.getServer().getScheduler().runTaskAsynchronously(Main.plugin, new Runnable(){
public void run() {
int temp = gameId;
while(true) {
if(tauntPlayer != null && !tauntPlayer.equals("")) {
try { Thread.sleep(1000); } catch (InterruptedException e) {}
if(gameId != temp) break;
continue;
}
try { Thread.sleep(1000*60); } catch (InterruptedException e) {}
if(gameId != temp) break;
if(Math.random() > .9) {
Player taunted = null;
int rand = (int) (Math.random()*Hider.getEntries().size());
for(Player player : playerList.values()) {
if(Hider.hasEntry(player.getName())) {
rand--;
if(rand==0) {
taunted = player;
break;
}
}
}
if(taunted != null) {
taunted.sendMessage(ChatColor.RED + "" + ChatColor.ITALIC + "Oh no! You have been chosed to be taunted.");
Bukkit.getServer().broadcastMessage(ChatColor.YELLOW + "Taunt >" + ChatColor.WHITE + " A random hider will be taunted in the next 30s");
try { Thread.sleep(1000*30); } catch (InterruptedException e) {}
if(gameId != temp) break;
tauntPlayer = taunted.getName();
}
}
}
}
});
}
}

View file

@ -1,50 +0,0 @@
package net.tylermurphy.hideAndSeek.manager;
import static net.tylermurphy.hideAndSeek.Store.*;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.WorldBorder;
import net.md_5.bungee.api.ChatColor;
import net.tylermurphy.hideAndSeek.Main;
public class WorldborderManager {
public static void schedule() {
Bukkit.getServer().getScheduler().runTaskAsynchronously(Main.plugin, new Runnable(){
public void run() {
int temp = gameId;
while(true) {
try { Thread.sleep(1000*60*worldborderDelay); } catch (InterruptedException e) {}
if(gameId != temp) break;
if(currentWorldborderSize-100 > 100) {
Bukkit.getServer().broadcastMessage(ChatColor.RED + "World Border> " + ChatColor.WHITE + "Worldborder decreacing by 100 blocks over the next 30s");
currentWorldborderSize -= 100;
decreaseBorder = true;
} else {
break;
}
}
}
});
}
public static void reset() {
if(worldborderEnabled) {
World world = Bukkit.getWorld("world");
WorldBorder border = world.getWorldBorder();
border.setSize(worldborderSize);
border.setCenter(worldborderPosition.getX(), worldborderPosition.getZ());
currentWorldborderSize = worldborderSize;
} else {
World world = Bukkit.getWorld("world");
WorldBorder border = world.getWorldBorder();
border.setSize(30000000);
border.setCenter(0, 0);
}
}
}

View file

@ -4,7 +4,15 @@ 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.currentWorldborderSize;
import static net.tylermurphy.hideAndSeek.Store.decreaseBorder;
import static net.tylermurphy.hideAndSeek.Store.gameId;
import static net.tylermurphy.hideAndSeek.Store.playerList;
import static net.tylermurphy.hideAndSeek.Store.tauntPlayer;
import static net.tylermurphy.hideAndSeek.Store.worldborderDelay;
import static net.tylermurphy.hideAndSeek.Store.worldborderEnabled;
import static net.tylermurphy.hideAndSeek.Store.worldborderPosition;
import static net.tylermurphy.hideAndSeek.Store.worldborderSize;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
@ -14,6 +22,8 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.WorldBorder;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -32,6 +42,11 @@ import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.EnumWrappers.SoundCategory;
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import com.comphenix.protocol.wrappers.WrappedDataWatcher.Registry;
import com.comphenix.protocol.wrappers.WrappedDataWatcher.Serializer;
import net.tylermurphy.hideAndSeek.Main;
public class Functions {
@ -154,4 +169,97 @@ public class Functions {
}
}
public static void setGlow(Player player, Player target, boolean glowing) {
PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.ENTITY_METADATA);
packet.getIntegers().write(0, target.getEntityId());
WrappedDataWatcher watcher = new WrappedDataWatcher();
Serializer serializer = Registry.get(Byte.class);
watcher.setEntity(target);
if(glowing) {
watcher.setObject(0, serializer, (byte) (0x40));
} else {
watcher.setObject(0, serializer, (byte) (0x0));
}
packet.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects());
try {
protocolManager.sendServerPacket(player, packet);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
public static void scheduleTaunt() {
Bukkit.getServer().getScheduler().runTaskAsynchronously(Main.plugin, new Runnable(){
public void run() {
int temp = gameId;
while(true) {
if(tauntPlayer != null && !tauntPlayer.equals("")) {
try { Thread.sleep(1000); } catch (InterruptedException e) {}
if(gameId != temp) break;
continue;
}
try { Thread.sleep(1000*60); } catch (InterruptedException e) {}
if(gameId != temp) break;
if(Math.random() > .8) {
Player taunted = null;
int rand = (int) (Math.random()*Hider.getEntries().size());
for(Player player : playerList.values()) {
if(Hider.hasEntry(player.getName())) {
rand--;
if(rand==0) {
taunted = player;
break;
}
}
}
if(taunted != null) {
taunted.sendMessage(ChatColor.RED + "" + ChatColor.ITALIC + "Oh no! You have been chosed to be taunted.");
Bukkit.getServer().broadcastMessage(ChatColor.YELLOW + "Taunt >" + ChatColor.WHITE + " A random hider will be taunted in the next 30s");
try { Thread.sleep(1000*30); } catch (InterruptedException e) {}
if(gameId != temp) break;
tauntPlayer = taunted.getName();
}
}
}
}
});
}
public static void scheduleWorldborder() {
Bukkit.getServer().getScheduler().runTaskAsynchronously(Main.plugin, new Runnable(){
public void run() {
int temp = gameId;
while(true) {
try { Thread.sleep(1000*60*worldborderDelay); } catch (InterruptedException e) {}
if(gameId != temp) break;
if(currentWorldborderSize-100 > 100) {
Bukkit.getServer().broadcastMessage(ChatColor.RED + "World Border> " + ChatColor.WHITE + "Worldborder decreacing by 100 blocks over the next 30s");
currentWorldborderSize -= 100;
decreaseBorder = true;
} else {
break;
}
}
}
});
}
public static void resetWorldborder() {
if(worldborderEnabled) {
World world = Bukkit.getWorld("world");
WorldBorder border = world.getWorldBorder();
border.setSize(worldborderSize);
border.setCenter(worldborderPosition.getX(), worldborderPosition.getZ());
currentWorldborderSize = worldborderSize;
} else {
World world = Bukkit.getWorld("world");
WorldBorder border = world.getWorldBorder();
border.setSize(30000000);
border.setCenter(0, 0);
}
}
}

View file

@ -1,4 +1,4 @@
package net.tylermurphy.hideAndSeek;
package net.tylermurphy.hideAndSeek.util;
import org.bukkit.command.CommandSender;

View file

@ -1,6 +1,6 @@
name: HideAndSeek
main: net.tylermurphy.hideAndSeek.Main
version: 1.1.2
version: 1.2.0
author: KenshinEto
load: STARTUP
api-version: 1.17