summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2011-10-11 13:10:29 +0100
committerElgarL <ElgarL@palmergames.com>2011-10-11 13:10:29 +0100
commit1bb3eb0d07cd4d39044b3c9b3f8f7fae96d88720 (patch)
tree343eaf3dfab69e39ebae5a3c9ed7be235bc93d97 /EssentialsGroupManager/src
parent5395b6f73a36e1e20b459e6a9c39ab6499f9d350 (diff)
downloadEssentials-1bb3eb0d07cd4d39044b3c9b3f8f7fae96d88720.tar
Essentials-1bb3eb0d07cd4d39044b3c9b3f8f7fae96d88720.tar.gz
Essentials-1bb3eb0d07cd4d39044b3c9b3f8f7fae96d88720.tar.lz
Essentials-1bb3eb0d07cd4d39044b3c9b3f8f7fae96d88720.tar.xz
Essentials-1bb3eb0d07cd4d39044b3c9b3f8f7fae96d88720.zip
Added two new permission nodes - groupmanager.notify.self &
groupmanager.notify.other These allow players/admins to be notified when players are moved between groups.
Diffstat (limited to 'EssentialsGroupManager/src')
-rw-r--r--EssentialsGroupManager/src/Changelog.txt2
-rw-r--r--EssentialsGroupManager/src/groups.yml2
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java26
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java5
4 files changed, 34 insertions, 1 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt
index e8eebbdc7..fe33a9f15 100644
--- a/EssentialsGroupManager/src/Changelog.txt
+++ b/EssentialsGroupManager/src/Changelog.txt
@@ -38,3 +38,5 @@ v 1.3:
(GM will create the data files for any worlds it finds which are not in the config.yml)
- Fix for Bukkit passing a null To location on a player Portaling
- Fixed manudelsub not correctly selecting the group to remove.
+ - Added two new permission nodes - groupmanager.notify.self & groupmanager.notify.other
+ These allow players/admins to be notified when players are moved between groups. \ No newline at end of file
diff --git a/EssentialsGroupManager/src/groups.yml b/EssentialsGroupManager/src/groups.yml
index 371c169dd..32954d22f 100644
--- a/EssentialsGroupManager/src/groups.yml
+++ b/EssentialsGroupManager/src/groups.yml
@@ -8,6 +8,7 @@ groups:
- essentials.motd
- essentials.rules
- essentials.spawn
+ - groupmanager.notify.self
inheritance: []
info:
prefix: '&e'
@@ -119,6 +120,7 @@ groups:
- groupmanager.manuadd
- groupmanager.manudel
- groupmanager.manwhois
+ - groupmanager.notify.other
inheritance:
- builder
info:
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
index cf8075377..ac822908f 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -28,6 +28,7 @@ import org.anjocaido.groupmanager.events.GMWorldListener;
import org.anjocaido.groupmanager.utils.GMLoggerHandler;
import org.anjocaido.groupmanager.utils.PermissionCheckResult;
import org.anjocaido.groupmanager.utils.Tasks;
+import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -1751,6 +1752,31 @@ public class GroupManager extends JavaPlugin {
return false;
}
+
+ /**
+ * Send confirmation of a group change.
+ * using permission nodes...
+ *
+ * groupmanager.notify.self
+ * groupmanager.notify.other
+ *
+ * @param name
+ * @param msg
+ */
+ public static void notify(String name, String msg) {
+
+ Player player = Bukkit.getServer().getPlayerExact(name);
+
+ for(Player test: Bukkit.getServer().getOnlinePlayers()) {
+ if (!test.equals(player)){
+ if (test.hasPermission("groupmanager.notify.other"))
+ test.sendMessage(ChatColor.YELLOW + name +" was " + msg);
+ } else
+ if ((player != null) && ((player.hasPermission("groupmanager.notify.self")) || (player.hasPermission("groupmanager.notify.other"))))
+ player.sendMessage(ChatColor.YELLOW + "You we're " + msg);
+ }
+
+ }
/**
* @return the config
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
index 46dbb3ddc..a95018fa9 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
@@ -119,9 +119,12 @@ public class User extends DataUnit implements Cloneable {
group = getDataSource().getGroup(group.getName());
this.group = group.getName();
flagAsChanged();
- if (GroupManager.isLoaded())
+ if (GroupManager.isLoaded()) {
if (GroupManager.BukkitPermissions.player_join = false)
GroupManager.BukkitPermissions.updateAllPlayers();
+
+ GroupManager.notify(this.getName(), String.format(" moved to the group %s.", group.getName()));
+ }
}
public void addSubGroup(Group subGroup) {