forked from clone/WorldGuardWrapper
Implement PlayerDomain (add/remove player/groups from member/owners)
This commit is contained in:
parent
19ef34bd0f
commit
ee8a7c806a
|
@ -0,0 +1,20 @@
|
|||
package org.codemc.worldguardwrapper.region;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface PlayerDomain {
|
||||
|
||||
Set<UUID> getPlayers();
|
||||
|
||||
void addPlayer(UUID uuid);
|
||||
|
||||
void removePlayer(UUID uuid);
|
||||
|
||||
Set<String> getGroups();
|
||||
|
||||
void addGroup(String name);
|
||||
|
||||
void removeGroup(String name);
|
||||
|
||||
}
|
|
@ -5,8 +5,6 @@ import org.codemc.worldguardwrapper.selection.Selection;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface WrappedRegion {
|
||||
|
||||
|
@ -20,9 +18,9 @@ public interface WrappedRegion {
|
|||
|
||||
int getPriority();
|
||||
|
||||
Set<UUID> getOwners();
|
||||
PlayerDomain getOwners();
|
||||
|
||||
Set<UUID> getMembers();
|
||||
PlayerDomain getMembers();
|
||||
|
||||
boolean contains(Location location);
|
||||
|
||||
|
|
|
@ -23,10 +23,11 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.codemc.worldguardwrapper.flags.AbstractWrappedFlag;
|
||||
import org.codemc.worldguardwrapper.implementation.IWorldGuardImplementation;
|
||||
import org.codemc.worldguardwrapper.region.PlayerDomain;
|
||||
import org.codemc.worldguardwrapper.region.WrappedRegion;
|
||||
import org.codemc.worldguardwrapper.selection.CuboidSelection;
|
||||
import org.codemc.worldguardwrapper.selection.PolygonalSelection;
|
||||
import org.codemc.worldguardwrapper.selection.Selection;
|
||||
import org.codemc.worldguardwrapper.region.WrappedRegion;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -141,13 +142,73 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> getOwners() {
|
||||
return region.getOwners().getUniqueIds();
|
||||
public PlayerDomain getOwners() {
|
||||
return new PlayerDomain() {
|
||||
@Override
|
||||
public Set<UUID> getPlayers() {
|
||||
return region.getOwners().getUniqueIds();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPlayer(UUID uuid) {
|
||||
region.getOwners().addPlayer(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePlayer(UUID uuid) {
|
||||
region.getOwners().removePlayer(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getGroups() {
|
||||
return region.getOwners().getGroups();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGroup(String name) {
|
||||
region.getOwners().addGroup(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeGroup(String name) {
|
||||
region.getOwners().removeGroup(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> getMembers() {
|
||||
return region.getMembers().getUniqueIds();
|
||||
public PlayerDomain getMembers() {
|
||||
return new PlayerDomain() {
|
||||
@Override
|
||||
public Set<UUID> getPlayers() {
|
||||
return region.getMembers().getUniqueIds();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPlayer(UUID uuid) {
|
||||
region.getMembers().addPlayer(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePlayer(UUID uuid) {
|
||||
region.getMembers().removePlayer(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getGroups() {
|
||||
return region.getMembers().getGroups();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGroup(String name) {
|
||||
region.getMembers().addGroup(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeGroup(String name) {
|
||||
region.getMembers().removeGroup(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user