mirror of
https://github.com/SimplexDevelopment/Traverse.git
synced 2025-07-12 04:18:34 +00:00
Fishnets and Baubles
This commit is contained in:
@ -1,16 +1,15 @@
|
||||
package mc.unraveled.reforged.permission;
|
||||
|
||||
import lombok.Data;
|
||||
import mc.unraveled.reforged.api.Baker;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
public class Group implements Baker {
|
||||
|
||||
public static final String BAKED_GROUP = "Cannot modify a baked group.";
|
||||
private final Rank rank;
|
||||
private Set<String> permissions = new HashSet<>();
|
||||
private Set<OfflinePlayer> players = new HashSet<>();
|
||||
@ -20,23 +19,43 @@ public class Group implements Baker {
|
||||
this.rank = rank;
|
||||
}
|
||||
|
||||
public Rank getRank() {
|
||||
return rank;
|
||||
}
|
||||
|
||||
public Set<String> getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public Set<OfflinePlayer> getPlayers() {
|
||||
return players;
|
||||
}
|
||||
|
||||
public boolean isBaked() {
|
||||
return baked;
|
||||
}
|
||||
|
||||
public void setBaked(boolean baked) {
|
||||
this.baked = baked;
|
||||
}
|
||||
|
||||
public void insert(String permission) {
|
||||
if (baked) throw new IllegalStateException("Cannot modify a baked group.");
|
||||
if (baked) throw new IllegalStateException(BAKED_GROUP);
|
||||
permissions.add(permission);
|
||||
}
|
||||
|
||||
public void insert(OfflinePlayer player) {
|
||||
if (baked) throw new IllegalStateException("Cannot modify a baked group.");
|
||||
if (baked) throw new IllegalStateException(BAKED_GROUP);
|
||||
players.add(player);
|
||||
}
|
||||
|
||||
public void eject(String permission) {
|
||||
if (baked) throw new IllegalStateException("Cannot modify a baked group.");
|
||||
if (baked) throw new IllegalStateException(BAKED_GROUP);
|
||||
permissions.remove(permission);
|
||||
}
|
||||
|
||||
public void eject(OfflinePlayer player) {
|
||||
if (baked) throw new IllegalStateException("Cannot modify a baked group.");
|
||||
if (baked) throw new IllegalStateException(BAKED_GROUP);
|
||||
players.remove(player);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user