Add setPlayerGroup in API

This commit is contained in:
Michel Roux 2012-05-15 00:35:39 +02:00
parent 9d8879f0b2
commit 8b8a304476
4 changed files with 20 additions and 0 deletions

View File

@ -31,6 +31,12 @@ public class SimplyAPI implements PermsConfig {
refreshPermissions(); refreshPermissions();
} }
@Override
public void setPlayerGroup(String player, String group) {
plugin.config.setPlayerGroup(player, group);
refreshPermissions();
}
@Override @Override
public void addPlayerGroup(String player, String group) { public void addPlayerGroup(String player, String group) {
plugin.config.addPlayerGroup(player, group); plugin.config.addPlayerGroup(player, group);

View File

@ -36,6 +36,12 @@ public class ConfigFile implements PermsConfig {
plugin.getConfig().set("users/" + player + "/groups", (groups.isEmpty()) ? null : groups); plugin.getConfig().set("users/" + player + "/groups", (groups.isEmpty()) ? null : groups);
} }
@Override
public void setPlayerGroup(String player, String group) {
removePlayerGroups(player);
addPlayerGroup(player, group);
}
@Override @Override
public void addPlayerGroup(String player, String group) { public void addPlayerGroup(String player, String group) {
player = player.toLowerCase(); player = player.toLowerCase();

View File

@ -113,6 +113,12 @@ public class ConfigSQL implements PermsConfig {
} }
} }
@Override
public void setPlayerGroup(String player, String group) {
removePlayerGroups(player);
addPlayerGroup(player, group);
}
private void addPlayerGroup(String player, String group, boolean first) { private void addPlayerGroup(String player, String group, boolean first) {
if (init()) { if (init()) {
try { try {

View File

@ -11,6 +11,8 @@ public interface PermsConfig {
public void removePlayerGroup(String player, String group); public void removePlayerGroup(String player, String group);
public void setPlayerGroup(String player, String group);
public void addPlayerGroup(String player, String group); public void addPlayerGroup(String player, String group);
public void addPlayerPermission(String player, String permission, boolean value); public void addPlayerPermission(String player, String permission, boolean value);