Some stuff updated still bugs..
This commit is contained in:
parent
fbbafc76f2
commit
7fa3e510be
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.
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.
@ -14,7 +14,8 @@ public class Blocks implements Listener {
|
||||
@EventHandler
|
||||
public void BreakBlock(BlockBreakEvent event){
|
||||
Player p = event.getPlayer();
|
||||
if(plugin.Playing.contains(p)){
|
||||
String pname = p.getDisplayName();
|
||||
if(plugin.Playing.contains(pname)){
|
||||
if(plugin.config.getString("Protected_Arena").equalsIgnoreCase("True")){
|
||||
event.setCancelled(true);
|
||||
p.sendMessage(ChatColor.RED + "You can't break blocks when you're playing!");
|
||||
|
@ -17,7 +17,8 @@ public class ChatListener implements Listener {
|
||||
@EventHandler
|
||||
public void TributeChat(PlayerChatEvent event){
|
||||
Player p = event.getPlayer();
|
||||
if(plugin.Playing.contains(p)){
|
||||
String pname = p.getDisplayName();
|
||||
if(plugin.Playing.contains(pname)){
|
||||
String msg = "<" + ChatColor.RED + "[Tribute] " + ChatColor.WHITE + p.getName() + ">" + " " + event.getMessage();
|
||||
if(plugin.config.getString("ChatClose").equalsIgnoreCase("True")){
|
||||
double radius = plugin.config.getDouble("ChatClose_Radius");
|
||||
|
@ -62,7 +62,7 @@ public class Chests implements Listener {
|
||||
Player p = event.getPlayer();
|
||||
Block block = event.getBlock();
|
||||
Location blocklocation = event.getBlock().getLocation();
|
||||
if (block.getState() instanceof Chest) {
|
||||
if (block.getState() instanceof Chest && !plugin.Playing.contains(p.getDisplayName())) {
|
||||
int blockx = blocklocation.getBlockX();
|
||||
int blocky = blocklocation.getBlockY();
|
||||
int blockz = blocklocation.getBlockZ();
|
||||
|
@ -16,7 +16,8 @@ public class CommandBlock implements Listener {
|
||||
public void CatchCommand(PlayerCommandPreprocessEvent event){
|
||||
String cmd = event.getMessage();
|
||||
Player p = event.getPlayer();
|
||||
if(!cmd.contains("/ha") && plugin.Playing.contains(p) && plugin.canjoin== true){
|
||||
String pname = p.getDisplayName();
|
||||
if(!cmd.contains("/ha") && plugin.Playing.contains(pname) && plugin.canjoin== true){
|
||||
if(!p.hasPermission("HungerArena.UseCommands")){
|
||||
event.setCancelled(true);
|
||||
p.sendMessage(ChatColor.RED + "You are only allowed to use /ha commands!");
|
||||
|
@ -13,7 +13,8 @@ public class FreezeListener implements Listener {
|
||||
@EventHandler
|
||||
public void onPlayerMove(PlayerMoveEvent event){
|
||||
Player p = event.getPlayer();
|
||||
if(plugin.Frozen.contains(p) && plugin.config.getString("Frozen_Teleport").equalsIgnoreCase("True")){
|
||||
String pname = p.getDisplayName();
|
||||
if(plugin.Frozen.contains(pname) && plugin.config.getString("Frozen_Teleport").equalsIgnoreCase("True")){
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ public class HaCommands implements CommandExecutor {
|
||||
p.sendMessage(c + "/ha - Displays author message!");
|
||||
sender.sendMessage(c + "/ha help - Displays this screen!");
|
||||
sender.sendMessage(c + "/ha join - Makes you join the game!");
|
||||
sender.sendMessage(c + "/ha ready - Votes for the game to start!");
|
||||
sender.sendMessage(c + "/ha leave - Makes you leave the game!");
|
||||
sender.sendMessage(c + "/ha watch - Lets you watch the tributes!");
|
||||
sender.sendMessage(c + "/sponsor [Player] [ItemID] [Amount] - Lets you sponsor someone!");
|
||||
@ -61,32 +62,34 @@ public class HaCommands implements CommandExecutor {
|
||||
sender.sendMessage(ChatColor.GREEN + "----------------------");
|
||||
return false;
|
||||
}else if(args[0].equalsIgnoreCase("List")){
|
||||
if(p.hasPermission("HungerArena.GameMaker") || sender instanceof ConsoleCommandSender){
|
||||
if(p.hasPermission("HungerArena.GameMaker")){
|
||||
sender.sendMessage(ChatColor.AQUA + "-----People Playing-----");
|
||||
if(!(plugin.Playing.size()== 0)){
|
||||
String playernames = plugin.Playing.get(i++);
|
||||
Player players = plugin.getServer().getPlayerExact(playernames);
|
||||
sender.sendMessage(ChatColor.GREEN + players.getDisplayName() + " Life: " + players.getHealth() + "/20");
|
||||
}else if(plugin.Playing.size()== 0){
|
||||
sender.sendMessage(ChatColor.GRAY + "No one is playing!");
|
||||
if(!plugin.Playing.isEmpty()){
|
||||
for(String playernames: plugin.Playing){
|
||||
Player players = plugin.getServer().getPlayerExact(playernames);
|
||||
p.sendMessage(ChatColor.GREEN + playernames + " Life: " + players.getHealth() + "/20");
|
||||
}
|
||||
}else if(plugin.Playing.isEmpty()){
|
||||
p.sendMessage(ChatColor.GRAY + "No one is playing!");
|
||||
}
|
||||
sender.sendMessage(ChatColor.AQUA + "----------------------");
|
||||
p.sendMessage(ChatColor.AQUA + "----------------------");
|
||||
}else{
|
||||
sender.sendMessage(ChatColor.RED + "You don't have permission!");
|
||||
p.sendMessage(ChatColor.RED + "You don't have permission!");
|
||||
}
|
||||
}else if(args[0].equalsIgnoreCase("rList")){
|
||||
if(p.hasPermission("HungerArena.GameMaker") || sender instanceof ConsoleCommandSender){
|
||||
sender.sendMessage(ChatColor.AQUA + "-----People Ready-----");
|
||||
if(!(plugin.Ready.size()== 0)){
|
||||
String readyname = plugin.Ready.get(i++);
|
||||
Player ready = plugin.getServer().getPlayerExact(readyname);
|
||||
sender.sendMessage(ChatColor.GREEN + ready.getDisplayName() + " Life: " + ready.getHealth() + "/20");
|
||||
}else if(plugin.Playing.size()== 0){
|
||||
sender.sendMessage(ChatColor.GRAY + "No one is ready!");
|
||||
if(p.hasPermission("HungerArena.GameMaker")){
|
||||
p.sendMessage(ChatColor.AQUA + "-----People Ready-----");
|
||||
if(!plugin.Ready.isEmpty()){
|
||||
for(String readyname: plugin.Ready){
|
||||
Player ready = plugin.getServer().getPlayerExact(readyname);
|
||||
p.sendMessage(ChatColor.GREEN + readyname + " Life: " + ready.getHealth() + "/20");
|
||||
}
|
||||
}else if(plugin.Ready.isEmpty()){
|
||||
p.sendMessage(ChatColor.GRAY + "No one is ready!");
|
||||
}
|
||||
sender.sendMessage(ChatColor.AQUA + "---------------------");
|
||||
p.sendMessage(ChatColor.AQUA + "---------------------");
|
||||
}else{
|
||||
sender.sendMessage(ChatColor.RED + "You don't have permission!");
|
||||
p.sendMessage(ChatColor.RED + "You don't have permission!");
|
||||
}
|
||||
}else if(args[0].equalsIgnoreCase("SetSpawn")){
|
||||
if(p.hasPermission("HungerArena.SetSpawn")){
|
||||
@ -797,6 +800,7 @@ public class HaCommands implements CommandExecutor {
|
||||
sender.sendMessage(c + "/ha - Displays author message!");
|
||||
sender.sendMessage(c + "/ha help - Displays this screen!");
|
||||
sender.sendMessage(c + "/ha join - Makes you join the game!");
|
||||
sender.sendMessage(c + "/ha ready - Votes for the game to start!");
|
||||
sender.sendMessage(c + "/ha leave - Makes you leave the game!");
|
||||
sender.sendMessage(c + "/ha watch - Lets you watch the tributes!");
|
||||
sender.sendMessage(c + "/sponsor [Player] [ItemID] [Amount] - Lets you sponsor someone!");
|
||||
@ -814,14 +818,26 @@ public class HaCommands implements CommandExecutor {
|
||||
return false;
|
||||
}else if(args[0].equalsIgnoreCase("List")){
|
||||
sender.sendMessage(ChatColor.AQUA + "-----People Playing-----");
|
||||
if(!(plugin.Playing.size()== 0)){
|
||||
String playernames = plugin.Playing.get(i++);
|
||||
Player players = plugin.getServer().getPlayerExact(playernames);
|
||||
sender.sendMessage(ChatColor.GREEN + players.getDisplayName() + " Life: " + players.getHealth() + "/20");
|
||||
}else if(plugin.Playing.size()== 0){
|
||||
if(!plugin.Playing.isEmpty()){
|
||||
for(String playernames: plugin.Playing){
|
||||
Player players = plugin.getServer().getPlayerExact(playernames);
|
||||
sender.sendMessage(ChatColor.GREEN + players.getDisplayName() + " Life: " + players.getHealth() + "/20");
|
||||
}
|
||||
}else if(plugin.Playing.isEmpty()){
|
||||
sender.sendMessage(ChatColor.GRAY + "No one is playing!");
|
||||
}
|
||||
sender.sendMessage(ChatColor.AQUA + "----------------------");
|
||||
}else if(args[0].equalsIgnoreCase("rList")){
|
||||
sender.sendMessage(ChatColor.AQUA + "-----People Ready-----");
|
||||
if(!plugin.Ready.isEmpty()){
|
||||
for(String readyname: plugin.Ready){
|
||||
Player ready = plugin.getServer().getPlayerExact(readyname);
|
||||
sender.sendMessage(ChatColor.GREEN + readyname + " Life: " + ready.getHealth() + "/20");
|
||||
}
|
||||
}else if(plugin.Ready.isEmpty()){
|
||||
sender.sendMessage(ChatColor.GRAY + "No one is ready!");
|
||||
}
|
||||
sender.sendMessage(ChatColor.AQUA + "---------------------");
|
||||
}else if(args[0].equalsIgnoreCase("SetSpawn") || args[0].equalsIgnoreCase("Join") || args[0].equalsIgnoreCase("Confirm") || args[0].equalsIgnoreCase("Ready") || args[0].equalsIgnoreCase("Leave") || args[0].equalsIgnoreCase("Watch")){
|
||||
sender.sendMessage(ChatColor.RED + "That can only be run by a player!");
|
||||
}else if(args[0].equalsIgnoreCase("Kick")){
|
||||
|
@ -32,7 +32,7 @@ public class JoinAndQuitListener implements Listener {
|
||||
p.sendMessage(ChatColor.AQUA + "You have saved yourself from being ejected from the arena!");
|
||||
}
|
||||
}, 40L);
|
||||
plugin.Out.remove(p);
|
||||
plugin.Out.remove(pname);
|
||||
}
|
||||
if(plugin.Quit.contains(pname) || plugin.Dead.contains(pname)){
|
||||
String[] Spawncoords = plugin.config.getString("Spawn_coords").split(",");
|
||||
|
@ -15,7 +15,8 @@ public class PvP implements Listener {
|
||||
public void PlayerPvP(EntityDamageByEntityEvent event){
|
||||
Entity p = event.getEntity();
|
||||
if(p instanceof Player){
|
||||
if(plugin.Playing.contains(p) && plugin.canjoin== false){
|
||||
String pname = ((Player) p).getDisplayName();
|
||||
if(plugin.Playing.contains(pname) && plugin.canjoin== false){
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,8 @@ public class SpectatorListener implements Listener {
|
||||
@EventHandler
|
||||
public void SpectatorDrops(PlayerDropItemEvent event){
|
||||
Player p = event.getPlayer();
|
||||
if(plugin.Watching.contains(p)){
|
||||
String pname = p.getDisplayName();
|
||||
if(plugin.Watching.contains(pname)){
|
||||
event.setCancelled(true);
|
||||
p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!");
|
||||
}
|
||||
@ -32,7 +33,8 @@ public class SpectatorListener implements Listener {
|
||||
@EventHandler
|
||||
public void SpectatorInteractions(PlayerInteractEvent event){
|
||||
Player p = event.getPlayer();
|
||||
if(plugin.Watching.contains(p)){
|
||||
String pname = p.getDisplayName();
|
||||
if(plugin.Watching.contains(pname)){
|
||||
event.setCancelled(true);
|
||||
p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!");
|
||||
}
|
||||
@ -40,7 +42,8 @@ public class SpectatorListener implements Listener {
|
||||
@EventHandler
|
||||
public void SpectatorItems(PlayerPickupItemEvent event){
|
||||
Player p = event.getPlayer();
|
||||
if(plugin.Watching.contains(p)){
|
||||
String pname = p.getDisplayName();
|
||||
if(plugin.Watching.contains(pname)){
|
||||
event.setCancelled(true);
|
||||
p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!");
|
||||
}
|
||||
@ -50,7 +53,8 @@ public class SpectatorListener implements Listener {
|
||||
Entity offense = event.getDamager();
|
||||
if(offense instanceof Player){
|
||||
Player Attacker = (Player) event.getDamager();
|
||||
if(plugin.Watching.contains(Attacker)){
|
||||
String attackerName = Attacker.getDisplayName();
|
||||
if(plugin.Watching.contains(attackerName)){
|
||||
event.setCancelled(true);
|
||||
Attacker.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!");
|
||||
}
|
||||
@ -58,7 +62,8 @@ public class SpectatorListener implements Listener {
|
||||
Projectile arrow = (Projectile) offense;
|
||||
if(arrow.getShooter() instanceof Player){
|
||||
Player BowMan = (Player) arrow.getShooter();
|
||||
if(plugin.Watching.contains(BowMan)){
|
||||
String bowManName = BowMan.getDisplayName();
|
||||
if(plugin.Watching.contains(bowManName)){
|
||||
event.setCancelled(true);
|
||||
BowMan.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!");
|
||||
}
|
||||
@ -68,7 +73,8 @@ public class SpectatorListener implements Listener {
|
||||
@EventHandler
|
||||
public void SpectatorBlocks(BlockBreakEvent event){
|
||||
Player p = event.getPlayer();
|
||||
if(plugin.Watching.contains(p)){
|
||||
String pname = p.getDisplayName();
|
||||
if(plugin.Watching.contains(pname)){
|
||||
event.setCancelled(true);
|
||||
p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!");
|
||||
}
|
||||
@ -76,8 +82,9 @@ public class SpectatorListener implements Listener {
|
||||
@EventHandler
|
||||
public void SpectatorJoin(PlayerJoinEvent event){
|
||||
Player p = event.getPlayer();
|
||||
String pname = p.getDisplayName();
|
||||
final Player player = event.getPlayer();
|
||||
if(plugin.Watching.contains(p)){
|
||||
if(plugin.Watching.contains(pname)){
|
||||
if(plugin.canjoin== false){
|
||||
String[] Spawncoords = plugin.config.getString("Spawn_coords").split(",");
|
||||
String w = Spawncoords[3];
|
||||
@ -95,7 +102,7 @@ public class SpectatorListener implements Listener {
|
||||
player.sendMessage(ChatColor.RED + "You have been teleported to spawn because the game is over!");
|
||||
}
|
||||
}, 40L);
|
||||
plugin.Watching.remove(p);
|
||||
plugin.Watching.remove(pname);
|
||||
}else{
|
||||
p.setAllowFlight(true);
|
||||
p.setFlying(true);
|
||||
@ -109,7 +116,8 @@ public class SpectatorListener implements Listener {
|
||||
public void MobNerf(EntityTargetEvent event){
|
||||
Entity target = event.getTarget();
|
||||
if(target instanceof Player){
|
||||
if(plugin.Watching.contains(target)){
|
||||
String targetName = ((Player) target).getDisplayName();
|
||||
if(plugin.Watching.contains(targetName)){
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@ -16,55 +17,86 @@ public class SponsorCommands implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
|
||||
Player p = (Player) sender;
|
||||
String pname = p.getName();
|
||||
if(cmd.getName().equalsIgnoreCase("Sponsor")){
|
||||
if(p.hasPermission("HungerArena.Sponsor")){
|
||||
if(!plugin.Playing.contains(p)){
|
||||
if(args.length== 0){
|
||||
p.sendMessage(ChatColor.RED + "You didn't specify a tribute!");
|
||||
return false;
|
||||
}
|
||||
if(args.length== 1){
|
||||
p.sendMessage(ChatColor.RED + "You didn't specify an item!");
|
||||
}
|
||||
if(args.length== 2){
|
||||
p.sendMessage(ChatColor.RED + "You didn't specify an amount!");
|
||||
}
|
||||
if(args.length== 3){
|
||||
Player target = Bukkit.getPlayer(args[0]);
|
||||
if(args[1].equalsIgnoreCase("57") || args[1].equalsIgnoreCase("7")){
|
||||
p.sendMessage(ChatColor.RED + "You can't sponsor that item!");
|
||||
}else{
|
||||
int ID = Integer.parseInt(args[1]);
|
||||
int Amount = Integer.parseInt(args[2]);
|
||||
ItemStack sponsoritem = new ItemStack(ID, Amount);
|
||||
if(p.getInventory().contains(plugin.config.getInt("Sponsor_Cost.ID"), plugin.config.getInt("Sponsor_Cost.Amount")*Amount)){
|
||||
if(!plugin.Playing.contains(target)){
|
||||
p.sendMessage(ChatColor.RED + "That person isn't playing!");
|
||||
}else{
|
||||
if(args[0].equalsIgnoreCase(pname)){
|
||||
p.sendMessage(ChatColor.RED + "You can't sponsor yourself!");
|
||||
}else{
|
||||
target.sendMessage(ChatColor.AQUA + "You have been Sponsored!");
|
||||
target.getInventory().addItem(sponsoritem);
|
||||
p.sendMessage("You have sponsored " + target.getName() + "!");
|
||||
p.getInventory().removeItem(plugin.Cost);
|
||||
}
|
||||
}
|
||||
if(sender instanceof Player){
|
||||
Player p = (Player) sender;
|
||||
String pname = p.getName();
|
||||
String epname = p.getDisplayName();
|
||||
if(p.hasPermission("HungerArena.Sponsor")){
|
||||
if(!plugin.Playing.contains(epname)){
|
||||
if(args.length== 0){
|
||||
p.sendMessage(ChatColor.RED + "You didn't specify a tribute!");
|
||||
return false;
|
||||
}
|
||||
if(args.length== 1){
|
||||
p.sendMessage(ChatColor.RED + "You didn't specify an item!");
|
||||
}
|
||||
if(args.length== 2){
|
||||
p.sendMessage(ChatColor.RED + "You didn't specify an amount!");
|
||||
}
|
||||
if(args.length== 3){
|
||||
Player target = Bukkit.getPlayer(args[0]);
|
||||
if(args[1].equalsIgnoreCase("57") || args[1].equalsIgnoreCase("7")){
|
||||
p.sendMessage(ChatColor.RED + "You can't sponsor that item!");
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You don't have the necessary items to sponsor!");
|
||||
int ID = Integer.parseInt(args[1]);
|
||||
int Amount = Integer.parseInt(args[2]);
|
||||
ItemStack sponsoritem = new ItemStack(ID, Amount);
|
||||
if(p.getInventory().contains(plugin.config.getInt("Sponsor_Cost.ID"), plugin.config.getInt("Sponsor_Cost.Amount")*Amount)){
|
||||
if(!plugin.Playing.contains(target.getDisplayName())){
|
||||
p.sendMessage(ChatColor.RED + "That person isn't playing!");
|
||||
}else{
|
||||
if(args[0].equalsIgnoreCase(pname)){
|
||||
p.sendMessage(ChatColor.RED + "You can't sponsor yourself!");
|
||||
}else{
|
||||
target.sendMessage(ChatColor.AQUA + "You have been Sponsored!");
|
||||
target.getInventory().addItem(sponsoritem);
|
||||
p.sendMessage("You have sponsored " + target.getName() + "!");
|
||||
p.getInventory().removeItem(plugin.Cost);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You don't have the necessary items to sponsor!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You are playing, you can't sponsor yourself!");
|
||||
}
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You are playing, you can't sponsor yourself!");
|
||||
p.sendMessage(ChatColor.RED + "You don't have permission!");
|
||||
}
|
||||
}else if(sender instanceof ConsoleCommandSender){
|
||||
if(args.length== 0){
|
||||
sender.sendMessage(ChatColor.RED + "You didn't specify a tribute!");
|
||||
return false;
|
||||
}
|
||||
if(args.length== 1){
|
||||
sender.sendMessage(ChatColor.RED + "You didn't specify an item!");
|
||||
}
|
||||
if(args.length== 2){
|
||||
sender.sendMessage(ChatColor.RED + "You didn't specify an amount!");
|
||||
}
|
||||
if(args.length== 3){
|
||||
Player target = Bukkit.getPlayer(args[0]);
|
||||
if(args[1].equalsIgnoreCase("57") || args[1].equalsIgnoreCase("7")){
|
||||
sender.sendMessage(ChatColor.RED + "You can't sponsor that item!");
|
||||
}else{
|
||||
int ID = Integer.parseInt(args[1]);
|
||||
int Amount = Integer.parseInt(args[2]);
|
||||
ItemStack sponsoritem = new ItemStack(ID, Amount);
|
||||
if(!plugin.Playing.contains(target.getDisplayName())){
|
||||
sender.sendMessage(ChatColor.RED + "That person isn't playing!");
|
||||
}else{
|
||||
sender.sendMessage(ChatColor.RED + "You can't sponsor yourself!");
|
||||
target.sendMessage(ChatColor.AQUA + "You have been Sponsored!");
|
||||
target.getInventory().addItem(sponsoritem);
|
||||
sender.sendMessage("You have sponsored " + target.getName() + "!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You don't have permission!");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user