Fixed world restrictions
This commit is contained in:
		@@ -25,7 +25,7 @@ public class Chests implements Listener {
 | 
			
		||||
		Block block = event.getClickedBlock();
 | 
			
		||||
		Player p = event.getPlayer();
 | 
			
		||||
		if(p.getItemInHand().getType()== Material.BLAZE_ROD && event.getAction() == Action.LEFT_CLICK_BLOCK){
 | 
			
		||||
			if(!plugin.restricted || (plugin.restricted && plugin.config.getStringList("worlds").contains(p.getWorld().toString()))){
 | 
			
		||||
			if(!plugin.restricted || (plugin.restricted && plugin.worlds.contains(p.getWorld().getName()))){
 | 
			
		||||
				if(block.getState() instanceof Chest){
 | 
			
		||||
					if(p.hasPermission("HungerArena.Chest.Store")){
 | 
			
		||||
						ItemStack[] itemsinchest = ((Chest) block.getState()).getInventory().getContents();
 | 
			
		||||
 
 | 
			
		||||
@@ -35,9 +35,9 @@ public class HaCommands implements CommandExecutor {
 | 
			
		||||
			final String pname = p.getName();
 | 
			
		||||
			ChatColor c = ChatColor.AQUA;
 | 
			
		||||
			if(cmd.getName().equalsIgnoreCase("Ha")){
 | 
			
		||||
				if(plugin.restricted && !plugin.config.getStringList("worlds").contains(p.getWorld().toString())){
 | 
			
		||||
				if(plugin.restricted && !plugin.worlds.contains(p.getWorld().getName())){
 | 
			
		||||
					p.sendMessage(ChatColor.RED + "That can't be run in this world!");
 | 
			
		||||
				}else if((plugin.restricted && plugin.config.getStringList("worlds").contains(p.getWorld().toString())) || !plugin.restricted){
 | 
			
		||||
				}else if((plugin.restricted && plugin.worlds.contains(p.getWorld().getName())) || !plugin.restricted){
 | 
			
		||||
					if(args.length== 0){
 | 
			
		||||
						p.sendMessage(ChatColor.GREEN + "[HungerArena] by " + ChatColor.AQUA + "travja!");
 | 
			
		||||
						return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ package me.Travja.HungerArena;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.logging.Logger;
 | 
			
		||||
import net.milkbowl.vault.economy.Economy;
 | 
			
		||||
import org.bukkit.ChatColor;
 | 
			
		||||
@@ -22,6 +23,7 @@ public class Main extends JavaPlugin{
 | 
			
		||||
	public ArrayList<String> Watching = new ArrayList<String>();
 | 
			
		||||
	public ArrayList<String> NeedConfirm = new ArrayList<String>();
 | 
			
		||||
	public HashSet<String> Frozen = new HashSet<String>();
 | 
			
		||||
	public List<String> worlds;
 | 
			
		||||
	public Listener DeathListener = new DeathListener(this);
 | 
			
		||||
	public Listener SpectatorListener = new SpectatorListener(this);
 | 
			
		||||
	public Listener FreezeListener = new FreezeListener(this);
 | 
			
		||||
@@ -90,9 +92,10 @@ public class Main extends JavaPlugin{
 | 
			
		||||
		}
 | 
			
		||||
		Reward = new ItemStack(config.getInt("Reward.ID"), config.getInt("Reward.Amount"));
 | 
			
		||||
		Cost = new ItemStack(config.getInt("Sponsor_Cost.ID"), config.getInt("Sponsor_Cost.Amount"));
 | 
			
		||||
		if(config.getStringList("worlds").isEmpty()){
 | 
			
		||||
		worlds = config.getStringList("worlds");
 | 
			
		||||
		if(worlds.isEmpty()){
 | 
			
		||||
			restricted = false;
 | 
			
		||||
		}else if(!config.getStringList("worlds").isEmpty()){
 | 
			
		||||
		}else if(!worlds.isEmpty()){
 | 
			
		||||
			restricted = true;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -18,8 +18,8 @@ public class SpawnsCommand implements CommandExecutor {
 | 
			
		||||
		Player p = (Player) sender;
 | 
			
		||||
		if(cmd.getName().equalsIgnoreCase("StartPoint")){
 | 
			
		||||
			if(p.hasPermission("HungerArena.StartPoint")){
 | 
			
		||||
				if(!plugin.restricted || (plugin.restricted && plugin.config.getStringList("worlds").contains(p.getWorld().toString()))){
 | 
			
		||||
					if(plugin.restricted && !plugin.config.getStringList("worlds").contains(p.getWorld().toString())){
 | 
			
		||||
				if(!plugin.restricted || (plugin.restricted && plugin.worlds.contains(p.getWorld().getName()))){
 | 
			
		||||
					if(plugin.restricted && !plugin.worlds.contains(p.getWorld().toString())){
 | 
			
		||||
						p.sendMessage(ChatColor.GOLD + "We ran the command, however, this isn't a world you defined in the config...");
 | 
			
		||||
						p.sendMessage(ChatColor.GOLD + "If this is the right world, please disregard this message.");
 | 
			
		||||
					}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user