Added console support and fixed more bugs
This commit is contained in:
parent
872448d92a
commit
e844f612a8
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,5 +1,6 @@
|
||||
package me.Travja.HungerArena;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -61,10 +62,10 @@ public class DeathListener implements Listener{
|
||||
event.setDeathMessage("");
|
||||
s.broadcastMessage(ChatColor.LIGHT_PURPLE + "**BOOM** Tribute " + pname + " was killed by tribute " + killername + " with their FIST!");
|
||||
s.broadcastMessage(leftmsg);
|
||||
if(plugin.Playing.size()== 1){
|
||||
if(plugin.Playing.size()== 1 && plugin.canjoin== true){
|
||||
for(Player winner:plugin.Playing){
|
||||
String winnername = winner.getName();
|
||||
s.broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
|
||||
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
|
||||
winner.getInventory().clear();
|
||||
winner.teleport(Spawn);
|
||||
winner.getInventory().setBoots(null);
|
||||
@ -82,11 +83,7 @@ public class DeathListener implements Listener{
|
||||
}
|
||||
}
|
||||
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
||||
plugin.Dead.clear();
|
||||
plugin.Quit.clear();
|
||||
plugin.Watching.clear();
|
||||
plugin.Frozen.clear();
|
||||
plugin.canjoin = false;
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
@ -97,10 +94,10 @@ public class DeathListener implements Listener{
|
||||
event.setDeathMessage("");
|
||||
s.broadcastMessage(msg);
|
||||
s.broadcastMessage(leftmsg);
|
||||
if(plugin.Playing.size()== 1){
|
||||
if(plugin.Playing.size()== 1 && plugin.canjoin== true){
|
||||
for(Player winner:plugin.Playing){
|
||||
String winnername = winner.getName();
|
||||
s.broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
|
||||
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
|
||||
winner.getInventory().clear();
|
||||
winner.teleport(Spawn);
|
||||
winner.getInventory().setBoots(null);
|
||||
@ -118,11 +115,7 @@ public class DeathListener implements Listener{
|
||||
}
|
||||
}
|
||||
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
||||
plugin.Dead.clear();
|
||||
plugin.Quit.clear();
|
||||
plugin.Watching.clear();
|
||||
plugin.Frozen.clear();
|
||||
plugin.canjoin = false;
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -130,10 +123,10 @@ public class DeathListener implements Listener{
|
||||
event.setDeathMessage("");
|
||||
s.broadcastMessage(ChatColor.LIGHT_PURPLE + pname + " died of natural causes!");
|
||||
s.broadcastMessage(leftmsg);
|
||||
if(plugin.Playing.size()== 1){
|
||||
if(plugin.Playing.size()== 1 && plugin.canjoin== true){
|
||||
for(Player winner:plugin.Playing){
|
||||
String winnername = winner.getName();
|
||||
s.broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
|
||||
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
|
||||
winner.getInventory().clear();
|
||||
winner.teleport(Spawn);
|
||||
winner.getInventory().setBoots(null);
|
||||
@ -151,11 +144,7 @@ public class DeathListener implements Listener{
|
||||
}
|
||||
}
|
||||
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
||||
plugin.Dead.clear();
|
||||
plugin.Quit.clear();
|
||||
plugin.Watching.clear();
|
||||
plugin.Frozen.clear();
|
||||
plugin.canjoin = false;
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,20 @@ public class HaCommands implements CommandExecutor {
|
||||
sender.sendMessage(ChatColor.RED + "You don't have permission!");
|
||||
}
|
||||
}
|
||||
if(args[0].equalsIgnoreCase("rList")){
|
||||
if(p.hasPermission("HungerArena.GameMaker") || sender instanceof ConsoleCommandSender){
|
||||
sender.sendMessage(ChatColor.AQUA + "-----People Ready-----");
|
||||
for(Player ready:plugin.Ready){
|
||||
sender.sendMessage(ChatColor.GREEN + ready.getDisplayName() + " Life: " + ready.getHealth() + "/20");
|
||||
}
|
||||
if(plugin.Playing.size()== 0){
|
||||
sender.sendMessage(ChatColor.GRAY + "No one is ready!");
|
||||
}
|
||||
sender.sendMessage(ChatColor.AQUA + "---------------------");
|
||||
}else{
|
||||
sender.sendMessage(ChatColor.RED + "You don't have permission!");
|
||||
}
|
||||
}
|
||||
if(args[0].equalsIgnoreCase("SetSpawn")){
|
||||
if(sender instanceof ConsoleCommandSender){
|
||||
sender.sendMessage(ChatColor.RED + "That can only be run by a player!");
|
||||
@ -129,6 +143,7 @@ public class HaCommands implements CommandExecutor {
|
||||
}else if(plugin.NeedConfirm.contains(p)){
|
||||
plugin.Playing.add(p);
|
||||
plugin.NeedConfirm.remove(p);
|
||||
p.sendMessage(ChatColor.GREEN + "Do /ha ready to vote to start the games!");
|
||||
p.getInventory().clear();
|
||||
p.getInventory().setBoots(null);
|
||||
p.getInventory().setChestplate(null);
|
||||
@ -144,11 +159,17 @@ public class HaCommands implements CommandExecutor {
|
||||
if(sender instanceof ConsoleCommandSender){
|
||||
sender.sendMessage(ChatColor.RED + "That can only be run by a player!");
|
||||
}else if(plugin.Playing.contains(p)){
|
||||
if(plugin.Ready.contains(p)){
|
||||
p.sendMessage(ChatColor.RED + "You're already ready!");
|
||||
}else if(plugin.Playing.size()== 1){
|
||||
p.sendMessage(ChatColor.RED + "You can't be ready when no one else is playing!");
|
||||
}else{
|
||||
plugin.Ready.add(p);
|
||||
p.sendMessage(ChatColor.AQUA + "You have marked yourself as READY!");
|
||||
if(plugin.Playing.size()== plugin.Ready.size()){
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha warpall");
|
||||
}
|
||||
}
|
||||
}else if(!plugin.Playing.contains(p)){
|
||||
p.sendMessage(ChatColor.RED + "You aren't playing!");
|
||||
}
|
||||
@ -172,18 +193,29 @@ public class HaCommands implements CommandExecutor {
|
||||
if(plugin.Frozen.contains(p)){
|
||||
plugin.Frozen.remove(p);
|
||||
}
|
||||
if(plugin.Playing.size()== 1 && plugin.canjoin== true){
|
||||
if(plugin.Playing.size()== 1){
|
||||
for(Player winner:plugin.Playing){
|
||||
String winnername = winner.getName();
|
||||
p.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
|
||||
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
|
||||
winner.getInventory().clear();
|
||||
winner.teleport(Spawn);
|
||||
winner.getInventory().setBoots(null);
|
||||
winner.getInventory().setChestplate(null);
|
||||
winner.getInventory().setHelmet(null);
|
||||
winner.getInventory().setLeggings(null);
|
||||
winner.getInventory().addItem(plugin.Reward);
|
||||
}
|
||||
plugin.Playing.clear();
|
||||
for(Player spectator:plugin.Watching){
|
||||
spectator.setAllowFlight(false);
|
||||
spectator.teleport(Spawn);
|
||||
for(Player online:plugin.getServer().getOnlinePlayers()){
|
||||
online.showPlayer(spectator);
|
||||
}
|
||||
}
|
||||
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart");
|
||||
}
|
||||
plugin.canjoin= false;
|
||||
plugin.Watching.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -232,15 +264,26 @@ public class HaCommands implements CommandExecutor {
|
||||
if(plugin.Playing.size()== 1 && plugin.canjoin== true){
|
||||
for(Player winner:plugin.Playing){
|
||||
String winnername = winner.getName();
|
||||
sender.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
|
||||
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
|
||||
winner.getInventory().clear();
|
||||
winner.teleport(Spawn);
|
||||
winner.getInventory().setBoots(null);
|
||||
winner.getInventory().setChestplate(null);
|
||||
winner.getInventory().setHelmet(null);
|
||||
winner.getInventory().setLeggings(null);
|
||||
winner.getInventory().addItem(plugin.Reward);
|
||||
}
|
||||
plugin.Playing.clear();
|
||||
for(Player spectator:plugin.Watching){
|
||||
spectator.setAllowFlight(false);
|
||||
spectator.teleport(Spawn);
|
||||
for(Player online:plugin.getServer().getOnlinePlayers()){
|
||||
online.showPlayer(spectator);
|
||||
}
|
||||
}
|
||||
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart");
|
||||
}
|
||||
plugin.canjoin= false;
|
||||
plugin.Watching.clear();
|
||||
}else{
|
||||
plugin.Playing.remove(target);
|
||||
plugin.Quit.add(target);
|
||||
@ -288,16 +331,21 @@ public class HaCommands implements CommandExecutor {
|
||||
if(sender.hasPermission("HungerArena.Restart") || sender instanceof ConsoleCommandSender){
|
||||
for(Player spectator:plugin.Watching){
|
||||
spectator.setAllowFlight(false);
|
||||
spectator.teleport(Spawn);
|
||||
for(Player online:plugin.getServer().getOnlinePlayers()){
|
||||
online.showPlayer(spectator);
|
||||
}
|
||||
}
|
||||
plugin.Dead.clear();
|
||||
plugin.Playing.clear();
|
||||
plugin.Quit.clear();
|
||||
plugin.Watching.clear();
|
||||
plugin.Frozen.clear();
|
||||
plugin.Ready.clear();
|
||||
plugin.NeedConfirm.clear();
|
||||
plugin.Out.clear();
|
||||
plugin.Playing.clear();
|
||||
plugin.canjoin = false;
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha refill");
|
||||
sender.sendMessage(ChatColor.AQUA + "The games have been reset!");
|
||||
}else{
|
||||
sender.sendMessage(ChatColor.RED + "You don't have permission!");
|
||||
@ -341,6 +389,13 @@ public class HaCommands implements CommandExecutor {
|
||||
plugin.Frozen.add(Tribute_two);
|
||||
Tribute_two.setFoodLevel(20);
|
||||
p.getWorld().setTime(0);
|
||||
if(plugin.config.getString("Auto_Start").equalsIgnoreCase("true")){
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
|
||||
public void run(){
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha start");
|
||||
}
|
||||
}, 20L);
|
||||
}
|
||||
}
|
||||
if(plugin.Playing.size()>= 3){
|
||||
plugin.config.getString("Tribute_three_spawn");
|
||||
@ -650,16 +705,6 @@ public class HaCommands implements CommandExecutor {
|
||||
plugin.Frozen.add(Tribute_twentyfour);
|
||||
Tribute_twentyfour.setFoodLevel(20);
|
||||
}
|
||||
if(plugin.Playing.size()>= 2){
|
||||
if(plugin.config.getString("Auto_Start").equalsIgnoreCase("true")){
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
|
||||
public void run(){
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha start");
|
||||
}
|
||||
}, 20L);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -728,13 +773,14 @@ public class HaCommands implements CommandExecutor {
|
||||
}, 220L);
|
||||
}else{
|
||||
plugin.Frozen.clear();
|
||||
p.getServer().broadcastMessage(ChatColor.AQUA + "Let the Games Begin!!");
|
||||
p.getServer().broadcastMessage(msg);
|
||||
plugin.canjoin = true;
|
||||
}
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You don't have permission!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(sender instanceof ConsoleCommandSender){
|
||||
if(cmd.getName().equalsIgnoreCase("Ha")){
|
||||
if(args.length== 0){
|
||||
@ -771,7 +817,6 @@ public class HaCommands implements CommandExecutor {
|
||||
}
|
||||
sender.sendMessage(ChatColor.AQUA + "----------------------");
|
||||
}
|
||||
}
|
||||
if(args[0].equalsIgnoreCase("SetSpawn")){
|
||||
if(sender instanceof ConsoleCommandSender){
|
||||
sender.sendMessage(ChatColor.RED + "That can only be run by a player!");
|
||||
@ -825,15 +870,26 @@ public class HaCommands implements CommandExecutor {
|
||||
if(plugin.Playing.size()== 1 && plugin.canjoin== true){
|
||||
for(Player winner:plugin.Playing){
|
||||
String winnername = winner.getName();
|
||||
sender.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
|
||||
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
|
||||
winner.getInventory().clear();
|
||||
winner.teleport(Spawn);
|
||||
winner.getInventory().setBoots(null);
|
||||
winner.getInventory().setChestplate(null);
|
||||
winner.getInventory().setHelmet(null);
|
||||
winner.getInventory().setLeggings(null);
|
||||
winner.getInventory().addItem(plugin.Reward);
|
||||
}
|
||||
plugin.Playing.clear();
|
||||
for(Player spectator:plugin.Watching){
|
||||
spectator.setAllowFlight(false);
|
||||
spectator.teleport(Spawn);
|
||||
for(Player online:plugin.getServer().getOnlinePlayers()){
|
||||
online.showPlayer(spectator);
|
||||
}
|
||||
}
|
||||
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart");
|
||||
}
|
||||
plugin.canjoin= false;
|
||||
plugin.Watching.clear();
|
||||
}else{
|
||||
plugin.Playing.remove(target);
|
||||
plugin.Quit.add(target);
|
||||
@ -881,15 +937,25 @@ public class HaCommands implements CommandExecutor {
|
||||
online.showPlayer(spectator);
|
||||
}
|
||||
}
|
||||
for(Player spectator:plugin.Watching){
|
||||
spectator.setAllowFlight(false);
|
||||
spectator.teleport(Spawn);
|
||||
for(Player online:plugin.getServer().getOnlinePlayers()){
|
||||
online.showPlayer(spectator);
|
||||
}
|
||||
}
|
||||
plugin.Dead.clear();
|
||||
plugin.Playing.clear();
|
||||
plugin.Quit.clear();
|
||||
plugin.Watching.clear();
|
||||
plugin.Frozen.clear();
|
||||
plugin.Ready.clear();
|
||||
plugin.NeedConfirm.clear();
|
||||
plugin.Out.clear();
|
||||
plugin.Playing.clear();
|
||||
plugin.canjoin = false;
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha refill");
|
||||
sender.sendMessage(ChatColor.AQUA + "The games have been reset!");
|
||||
}
|
||||
}
|
||||
if(args[0].equalsIgnoreCase("Reload")){
|
||||
plugin.reloadConfig();
|
||||
sender.sendMessage(ChatColor.AQUA + "HungerArena Reloaded!");
|
||||
@ -927,6 +993,13 @@ public class HaCommands implements CommandExecutor {
|
||||
plugin.Frozen.add(Tribute_two);
|
||||
Tribute_two.setFoodLevel(20);
|
||||
Tribute_one.getWorld().setTime(0);
|
||||
if(plugin.config.getString("Auto_Start").equalsIgnoreCase("true")){
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
|
||||
public void run(){
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha start");
|
||||
}
|
||||
}, 20L);
|
||||
}
|
||||
}
|
||||
if(plugin.Playing.size()>= 3){
|
||||
plugin.config.getString("Tribute_three_spawn");
|
||||
@ -1236,15 +1309,6 @@ public class HaCommands implements CommandExecutor {
|
||||
plugin.Frozen.add(Tribute_twentyfour);
|
||||
Tribute_twentyfour.setFoodLevel(20);
|
||||
}
|
||||
if(plugin.Playing.size()>= 2){
|
||||
if(plugin.config.getString("Auto_Start").equalsIgnoreCase("true")){
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
|
||||
public void run(){
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha start");
|
||||
}
|
||||
}, 20L);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(args[0].equalsIgnoreCase("Start")){
|
||||
@ -1311,10 +1375,12 @@ public class HaCommands implements CommandExecutor {
|
||||
}, 220L);
|
||||
}else{
|
||||
plugin.Frozen.clear();
|
||||
plugin.getServer().broadcastMessage(ChatColor.AQUA + "Let the Games Begin!!");
|
||||
plugin.getServer().broadcastMessage(msg);
|
||||
plugin.canjoin = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user