Fixed world restrictions
This commit is contained in:
parent
73e7050762
commit
3d90d9afce
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -12,8 +12,8 @@ config:
|
||||
# If left blank all worlds will be allowed.
|
||||
# ie:
|
||||
# worlds:
|
||||
# - world
|
||||
# - world_nether
|
||||
# - world
|
||||
# - world_nether
|
||||
worlds:
|
||||
|
||||
# Message to display when the games start
|
||||
@ -84,7 +84,7 @@ ChatClose_Radius: 10
|
||||
########################
|
||||
Spawn_coords: 100,100,100,world
|
||||
# If /ha setspawn has been run
|
||||
Spawn_set: 'false'
|
||||
Spawns_set: 'false'
|
||||
Tribute_one_spawn: 100,100,100
|
||||
Tribute_two_spawn: 100,100,100
|
||||
Tribute_three_spawn: 100,100,100
|
||||
|
@ -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.");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user