-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Removed old deprecated StringUtils methods
* Added new methods to FileList * Added new method to Registry * Added new Vault permission wrapper VaultPlayer * Finalized UpdateChecker * Cleaned up code.
- Loading branch information
Showing
12 changed files
with
395 additions
and
98 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/main/java/com/github/sanctum/labyrinth/library/Group.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.github.sanctum.labyrinth.library; | ||
|
||
import java.util.LinkedList; | ||
import java.util.List; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.World; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.permissions.Permission; | ||
|
||
public class Group { | ||
|
||
private final String name; | ||
private final String world; | ||
|
||
protected Group(String name, String world) { | ||
this.name = name; | ||
this.world = world; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public World getWorld() { | ||
return Bukkit.getWorld(world); | ||
} | ||
|
||
public boolean has(Permission permission) { | ||
return VaultPlayer.PERMS.groupHas(getWorld(), getName(), permission.getName()); | ||
} | ||
|
||
public boolean has(String permission) { | ||
return VaultPlayer.PERMS.groupHas(getWorld(), getName(), permission); | ||
} | ||
|
||
public boolean give(String permission) { | ||
return VaultPlayer.PERMS.groupAdd(getWorld(), getName(), permission); | ||
} | ||
|
||
public boolean give(Permission permission) { | ||
return VaultPlayer.PERMS.groupAdd(getWorld(), getName(), permission.getName()); | ||
} | ||
|
||
public boolean take(String permission) { | ||
return VaultPlayer.PERMS.groupRemove(getWorld(), getName(), permission); | ||
} | ||
|
||
public boolean take(Permission permission) { | ||
return VaultPlayer.PERMS.groupRemove(getWorld(), getName(), permission.getName()); | ||
} | ||
|
||
public Permission[] getKnownPermissions() { | ||
List<Permission> perms = new LinkedList<>(); | ||
for (String cmd : CommandUtils.getServerCommandListing()) { | ||
Command command = CommandUtils.getCommandByLabel(cmd); | ||
if (command != null) { | ||
if (command.getPermission() != null) { | ||
if (VaultPlayer.PERMS.groupHas(getWorld(), getName(), command.getPermission())) { | ||
perms.add(new Permission(command.getPermission(), command.getDescription())); | ||
} | ||
} | ||
} | ||
} | ||
return perms.toArray(new Permission[0]); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.