summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRiaku <riaku56@gmail.com>2013-02-07 16:06:55 -0600
committerRiaku <riaku56@gmail.com>2013-02-07 16:41:26 -0600
commitfbc8167ea9f598900eca33199989de67cdcb9619 (patch)
treeec024fdaec312ccf7e0cebc1effa8837067c2033
parentfa20d2495760610f0181c3ffa065ecbdfa000fdd (diff)
downloadEssentials-fbc8167ea9f598900eca33199989de67cdcb9619.tar
Essentials-fbc8167ea9f598900eca33199989de67cdcb9619.tar.gz
Essentials-fbc8167ea9f598900eca33199989de67cdcb9619.tar.lz
Essentials-fbc8167ea9f598900eca33199989de67cdcb9619.tar.xz
Essentials-fbc8167ea9f598900eca33199989de67cdcb9619.zip
adding per-group teleport permissions
-rw-r--r--Essentials/src/config.yml5
-rw-r--r--Essentials/src/net/ess3/commands/Commandtp.java5
-rw-r--r--Essentials/src/net/ess3/commands/Commandtpa.java7
-rw-r--r--Essentials/src/net/ess3/commands/Commandtpahere.java5
-rw-r--r--Essentials/src/net/ess3/commands/Commandtphere.java8
-rw-r--r--Essentials/src/net/ess3/commands/Commandtpo.java9
-rw-r--r--Essentials/src/net/ess3/permissions/Permissions.java1
-rw-r--r--Essentials/src/net/ess3/settings/General.java2
8 files changed, 40 insertions, 2 deletions
diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml
index 94d83a444..27edc7968 100644
--- a/Essentials/src/config.yml
+++ b/Essentials/src/config.yml
@@ -1,3 +1,5 @@
+per-group-teleport: true
+
############################################################
# +------------------------------------------------------+ #
# | Notes | #
@@ -290,6 +292,9 @@ no-god-in-worlds:
# This does not affect the /home command, there is a separate toggle below for this.
world-teleport-permissions: false
+#Set to true to enable per-group teleporting permissions.
+perGroupTeleport: false
+
# The number of items given if the quantity parameter is left out in /item or /give.
# If this number is below 1, the maximum stack size size is given. If over-sized stacks
# are not enabled, any number higher than the maximum stack size results in more than one stack.
diff --git a/Essentials/src/net/ess3/commands/Commandtp.java b/Essentials/src/net/ess3/commands/Commandtp.java
index 11ab0f56a..5ce46365d 100644
--- a/Essentials/src/net/ess3/commands/Commandtp.java
+++ b/Essentials/src/net/ess3/commands/Commandtp.java
@@ -27,6 +27,11 @@ public class Commandtp extends EssentialsCommand
{
throw new Exception(_("teleportDisabled", player.getPlayer().getDisplayName()));
}
+ if (settings.getData().getGeneral().isPerGroupTeleport() && !Permissions.PERGROUPTELEPORT.isAuthorized(
+ user, ess.getRanks().getMainGroup(user)))
+ {
+ throw new Exception(_("noPerm", "essentials.tp." + player));
+ }
if (user.getPlayer().getWorld() != player.getPlayer().getWorld() && settings.getData().getGeneral().isWorldTeleportPermissions() && !Permissions.WORLD.isAuthorized(
user, player.getPlayer().getWorld().getName()))
{
diff --git a/Essentials/src/net/ess3/commands/Commandtpa.java b/Essentials/src/net/ess3/commands/Commandtpa.java
index ac7d9205b..35b014259 100644
--- a/Essentials/src/net/ess3/commands/Commandtpa.java
+++ b/Essentials/src/net/ess3/commands/Commandtpa.java
@@ -22,8 +22,13 @@ public class Commandtpa extends EssentialsCommand
{
throw new Exception(_("teleportDisabled", player.getPlayer().getDisplayName()));
}
-
ISettings settings = ess.getSettings();
+ if (settings.getData().getGeneral().isPerGroupTeleport() && !Permissions.PERGROUPTELEPORT.isAuthorized(
+ user, ess.getRanks().getMainGroup(user)))
+ {
+ throw new Exception(_("noPerm", "essentials.tp." + player));
+ }
+
if (user.getPlayer().getWorld() != player.getPlayer().getWorld() && ess.getSettings().getData().getGeneral().isWorldTeleportPermissions() && !Permissions.WORLD.isAuthorized(
user, user.getPlayer().getWorld().getName()))
{
diff --git a/Essentials/src/net/ess3/commands/Commandtpahere.java b/Essentials/src/net/ess3/commands/Commandtpahere.java
index 42c6ed041..a7cf1c1e2 100644
--- a/Essentials/src/net/ess3/commands/Commandtpahere.java
+++ b/Essentials/src/net/ess3/commands/Commandtpahere.java
@@ -24,6 +24,11 @@ public class Commandtpahere extends EssentialsCommand
}
ISettings settings = ess.getSettings();
+ if (settings.getData().getGeneral().isPerGroupTeleport() && !Permissions.PERGROUPTELEPORT.isAuthorized(
+ user, ess.getRanks().getMainGroup(user)))
+ {
+ throw new Exception(_("noPerm", "essentials.tp." + player));
+ }
if (user.getPlayer().getWorld() != player.getPlayer().getWorld() && settings.getData().getGeneral().isWorldTeleportPermissions() && !Permissions.WORLD.isAuthorized(
user, user.getPlayer().getWorld().getName()))
{
diff --git a/Essentials/src/net/ess3/commands/Commandtphere.java b/Essentials/src/net/ess3/commands/Commandtphere.java
index 46c9879f9..e9fbd76e2 100644
--- a/Essentials/src/net/ess3/commands/Commandtphere.java
+++ b/Essentials/src/net/ess3/commands/Commandtphere.java
@@ -1,8 +1,10 @@
package net.ess3.commands;
import static net.ess3.I18n._;
+import net.ess3.api.ISettings;
import net.ess3.api.IUser;
import net.ess3.economy.Trade;
+import net.ess3.permissions.Permissions;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
@@ -16,6 +18,12 @@ public class Commandtphere extends EssentialsCommand
{
throw new Exception(_("teleportDisabled", player.getPlayer().getDisplayName()));
}
+ ISettings settings = ess.getSettings();
+ if (settings.getData().getGeneral().isPerGroupTeleport() && !Permissions.PERGROUPTELEPORT.isAuthorized(
+ user, ess.getRanks().getMainGroup(user)))
+ {
+ throw new Exception(_("noPerm", "essentials.tp." + player));
+ }
user.getTeleport().teleportToMe(player, new Trade(commandName, ess), TeleportCause.COMMAND);
user.sendMessage(_("teleporting"));
diff --git a/Essentials/src/net/ess3/commands/Commandtpo.java b/Essentials/src/net/ess3/commands/Commandtpo.java
index 0ca3df387..8f6eb55cf 100644
--- a/Essentials/src/net/ess3/commands/Commandtpo.java
+++ b/Essentials/src/net/ess3/commands/Commandtpo.java
@@ -1,6 +1,7 @@
package net.ess3.commands;
import static net.ess3.I18n._;
+import net.ess3.api.ISettings;
import net.ess3.api.IUser;
import net.ess3.permissions.Permissions;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
@@ -18,7 +19,13 @@ public class Commandtpo extends EssentialsCommand
//Just basically the old tp command
final IUser player = ess.getUserMap().matchUser(args[0], false);
-
+
+ ISettings settings = ess.getSettings();
+ if (settings.getData().getGeneral().isPerGroupTeleport() && !Permissions.PERGROUPTELEPORT.isAuthorized(
+ user, ess.getRanks().getMainGroup(user)))
+ {
+ throw new Exception(_("noPerm", "essentials.tp." + player));
+ }
// Verify permission
if (user.getPlayer().canSee(player.getPlayer()) || Permissions.TELEPORT_HIDDEN.isAuthorized(user))
{
diff --git a/Essentials/src/net/ess3/permissions/Permissions.java b/Essentials/src/net/ess3/permissions/Permissions.java
index 60eb45b6a..2f33f669f 100644
--- a/Essentials/src/net/ess3/permissions/Permissions.java
+++ b/Essentials/src/net/ess3/permissions/Permissions.java
@@ -167,6 +167,7 @@ public enum Permissions implements IPermission
}
public static DotStarPermission ENCHANT = new DotStarPermission("essentials.enchant");
+ public static DotStarPermission PERGROUPTELEPORT = new DotStarPermission("essentials.tp");
public static MaterialDotStarPermission GIVE = new MaterialDotStarPermission("essentials.give", PermissionDefault.TRUE);
public static DotStarPermission RANKS = new DotStarPermission("essentials.ranks");
public static DotStarPermission HELP = new DotStarPermission("essentials.help");
diff --git a/Essentials/src/net/ess3/settings/General.java b/Essentials/src/net/ess3/settings/General.java
index 6fbdb5b8c..ed956c840 100644
--- a/Essentials/src/net/ess3/settings/General.java
+++ b/Essentials/src/net/ess3/settings/General.java
@@ -59,6 +59,8 @@ public class General implements StorageObject
})
private boolean worldTeleportPermissions = false;
private boolean worldHomePermissions = false;
+ @Comment("Set to true to enable per-group teleporting permissions.")
+ private boolean perGroupTeleport = false;
@Comment("Delay to wait before people can cause attack damage after logging in ")
private long loginAttackDelay = 0;