Added per-world permissions for /world

This commit is contained in:
Khyperia 2011-12-03 12:13:42 -05:00
parent 85d743dce5
commit 1cb593dba3
4 changed files with 29 additions and 7 deletions

View File

@ -140,4 +140,6 @@ public interface ISettings extends IConf
boolean getUpdateBedAtDaytime(); boolean getUpdateBedAtDaytime();
boolean getRepairEnchanted(); boolean getRepairEnchanted();
boolean getIsWorldTeleportPermissions();
} }

View File

@ -29,7 +29,7 @@ public class Settings implements ISettings
{ {
return config.getBoolean("respawn-at-home", false); return config.getBoolean("respawn-at-home", false);
} }
@Override @Override
public boolean getUpdateBedAtDaytime() public boolean getUpdateBedAtDaytime()
{ {
@ -332,7 +332,7 @@ public class Settings implements ISettings
public void reloadConfig() public void reloadConfig()
{ {
config.load(); config.load();
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds",Collections.<String>emptyList())); noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds", Collections.<String>emptyList()));
} }
@Override @Override
@ -535,13 +535,12 @@ public class Settings implements ISettings
{ {
return config.getBoolean("death-messages", true); return config.getBoolean("death-messages", true);
} }
Set<String> noGodWorlds = new HashSet<String>();
Set <String> noGodWorlds = new HashSet<String>();
@Override @Override
public Set<String> getNoGodWorlds() public Set<String> getNoGodWorlds()
{ {
return noGodWorlds; return noGodWorlds;
} }
@Override @Override
@ -549,8 +548,16 @@ public class Settings implements ISettings
{ {
this.debug = debug; this.debug = debug;
} }
public boolean getRepairEnchanted() { @Override
public boolean getRepairEnchanted()
{
return config.getBoolean("repair-enchanted", true); return config.getBoolean("repair-enchanted", true);
} }
@Override
public boolean getIsWorldTeleportPermissions()
{
return config.getBoolean("world-teleport-permissions", false);
}
} }

View File

@ -53,6 +53,15 @@ public class Commandworld extends EssentialsCommand
} }
} }
if (ess.getSettings().getIsWorldTeleportPermissions())
{
if (!user.isAuthorized("essentials.world." + world.getName()))
{
user.sendMessage(_("invalidWorld")); //TODO: Make a "world teleport denied" translation
throw new NoChargeException();
}
}
double factor; double factor;
if (user.getWorld().getEnvironment() == World.Environment.NETHER && world.getEnvironment() == World.Environment.NORMAL) if (user.getWorld().getEnvironment() == World.Environment.NETHER && world.getEnvironment() == World.Environment.NORMAL)
{ {

View File

@ -220,6 +220,10 @@ death-messages: true
no-god-in-worlds: no-god-in-worlds:
# - world_nether # - world_nether
# Set to true to enable per-world permissions for teleporting with /world
# Give someone permission to teleport to a world with essentials.world.<worldname>
world-teleport-permissions: false
# Oversized stacks are stacks that ignore the normal max stacksize. # Oversized stacks are stacks that ignore the normal max stacksize.
# They can be obtained using /give and /item, if the player has essentials.oversizedstacks permission. # They can be obtained using /give and /item, if the player has essentials.oversizedstacks permission.
# How many items should be in a oversized stack? # How many items should be in a oversized stack?