use of de.dytanic.cloudnet.lib.player.permission.PermissionGroup in project CloudNet by Dytanic.
the class VaultPermissionImpl method groupAdd.
@Override
public boolean groupAdd(String s, String s1, String s2) {
PermissionGroup permissionGroup = CloudAPI.getInstance().getPermissionGroup(s1);
permissionGroup.getPermissions().put(s2, true);
CloudAPI.getInstance().updatePermissionGroup(permissionGroup);
return true;
}
use of de.dytanic.cloudnet.lib.player.permission.PermissionGroup in project CloudNet by Dytanic.
the class VaultPermissionImpl method groupRemove.
@Override
public boolean groupRemove(String s, String s1, String s2) {
PermissionGroup permissionGroup = CloudAPI.getInstance().getPermissionGroup(s1);
permissionGroup.getPermissions().remove(s2);
CloudAPI.getInstance().updatePermissionGroup(permissionGroup);
return true;
}
use of de.dytanic.cloudnet.lib.player.permission.PermissionGroup in project CloudNet by Dytanic.
the class ChatListener method handle.
@EventHandler
public void handle(AsyncPlayerChatEvent e) {
PermissionGroup permissionGroup = permissionService ? CloudServer.getInstance().getCachedPlayer(e.getPlayer().getUniqueId()).getPermissionEntity().getHighestPermissionGroup(CloudAPI.getInstance().getPermissionPool()) : null;
e.setFormat(ChatColor.translateAlternateColorCodes('&', ChatPlugin.getPlugin(ChatPlugin.class).getConfig().getString("format").replace("%display%", ChatColor.translateAlternateColorCodes('&', (permissionService ? permissionGroup.getDisplay() : ""))).replace("%prefix%", ChatColor.translateAlternateColorCodes('&', (permissionService ? permissionGroup.getPrefix() : ""))).replace("%suffix%", ChatColor.translateAlternateColorCodes('&', (permissionService ? permissionGroup.getSuffix() : ""))).replace("%group%", (permissionService ? permissionGroup.getName() : "")).replace("%player%", e.getPlayer().getName()).replace("%message%", e.getPlayer().hasPermission("cloudnet.chat.color") ? ChatColor.translateAlternateColorCodes('&', e.getMessage().replace("%", "%%")) : ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', e.getMessage().replace("%", "%%"))))));
}
use of de.dytanic.cloudnet.lib.player.permission.PermissionGroup in project CloudNet by Dytanic.
the class ConfigPermissions method read.
public Map<String, PermissionGroup> read(Configuration configuration) {
Map<String, PermissionGroup> maps = new LinkedHashMap<>();
Configuration section = configuration.getSection("groups");
for (String key : section.getKeys()) {
Configuration group = section.getSection(key);
HashMap<String, Boolean> permissions = new HashMap<>();
List<String> permissionSection = group.getStringList("permissions");
for (String entry : permissionSection) {
permissions.put(entry.replaceFirst("-", ""), (!entry.startsWith("-")));
}
HashMap<String, List<String>> permissionsGroups = new HashMap<>();
Configuration permissionSectionGroups = group.getSection("serverGroupPermissions");
for (String entry : permissionSectionGroups.getKeys()) {
permissionsGroups.put(entry, permissionSectionGroups.getStringList(entry));
}
PermissionGroup permissionGroup = new PermissionGroup(key, group.getString("prefix"), group.getString("suffix"), group.getString("display"), group.getInt("tagId"), group.getInt("joinPower"), group.getBoolean("defaultGroup"), permissions, permissionsGroups, group.getSection("options").self, group.getStringList("implements"));
maps.put(permissionGroup.getName(), permissionGroup);
}
return maps;
}
use of de.dytanic.cloudnet.lib.player.permission.PermissionGroup in project CloudNet by Dytanic.
the class PacketInUpdatePermissionGroup method handleInput.
@Override
public void handleInput(Document data, PacketSender packetSender) {
PermissionGroup permissionGroup = data.getObject("permissionGroup", new TypeToken<PermissionGroup>() {
}.getType());
PermissionModule.getInstance().getConfigPermission().updatePermissionGroup(permissionGroup);
CloudNet.getInstance().getNetworkManager().reload();
CloudNet.getInstance().getNetworkManager().updateAll0();
}
Aggregations