protected boolean checkMembership(PermissionGroup group, String worldName) { int groupLifetime = this.getOwnOptionInteger("group-" + group.getName() + "-until", worldName, 0); if (groupLifetime > 0 && groupLifetime < System.currentTimeMillis() / 1000) { // check for expiration this.setOption("group-" + group.getName() + "-until", null, worldName); // remove option this.removeGroup(group, worldName); // remove membership // @TODO Make notification of player about expired memebership return false; } return true; }
/** * Remove user from group * * @param group group as PermissionGroup object */ public void removeGroup(PermissionGroup group, String worldName) { if (group == null) { return; } this.removeGroup(group.getName(), worldName); }
/** * Set parent groups for user * * @param groups array of parent group objects */ public void setGroups(PermissionGroup[] parentGroups, String worldName) { List<String> groups = new LinkedList<String>(); for (PermissionGroup group : parentGroups) { groups.add(group.getName()); } this.setGroups(groups.toArray(new String[0]), worldName); }
/** * Get group names in specified world * * @return String array of user's group names */ public String[] getGroupsNames(String worldName) { List<String> groups = new LinkedList<String>(); for (PermissionGroup group : this.getGroups(worldName)) { if (group != null) { groups.add(group.getName()); } } return groups.toArray(new String[0]); }