diff --git a/API/pom.xml b/API/pom.xml
new file mode 100644
index 00000000..b0825c1f
--- /dev/null
+++ b/API/pom.xml
@@ -0,0 +1,80 @@
+
+ 4.0.0
+ nl.svenar
+ powerranks.api
+ ${revision}
+ PowerRanks API
+ Rank-based permission manager
+
+
+ 1.8
+ UTF-8
+ src/main/java
+ src/main/resources
+ false
+
+
+
+ nl.svenar
+ powerranks
+ ${revision}
+
+
+
+ clean compile package
+ ${project.name}
+ ${src.dir}
+
+
+ ${rsc.dir}
+ true
+
+
+
+
+ maven-compiler-plugin
+ 3.8.0
+
+
+ ${java.version}
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.3.1
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.2.1
+
+ ${skipAPITests}
+
+
+
+
+
+
+
+ jitpack.io
+ https://jitpack.io
+
+
+ svenar
+ https://svenar.nl/repo/
+
+
+
+
+
+ nl.svenar
+ powerranks.core
+ ${revision}
+
+
+
\ No newline at end of file
diff --git a/API/src/main/java/nl/svenar/powerranks/api/PlayersAPI.java b/API/src/main/java/nl/svenar/powerranks/api/PlayersAPI.java
new file mode 100644
index 00000000..535fe60e
--- /dev/null
+++ b/API/src/main/java/nl/svenar/powerranks/api/PlayersAPI.java
@@ -0,0 +1,1113 @@
+package nl.svenar.powerranks.api;
+
+import java.util.Set;
+import java.util.UUID;
+
+import nl.svenar.powerranks.common.structure.PRPermission;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRCache;
+
+public class PlayersAPI {
+
+ // ================================================================================
+ // || ||
+ // || GET PRPLAYER ||
+ // || ||
+ // ================================================================================
+
+ /**
+ * Get a PRPlayer object by UUID
+ *
+ * @param UUID
+ * @return PRPlayer
+ */
+ public PRPlayer get(UUID uuid) {
+ return get(uuid.toString());
+ }
+
+ /**
+ * Get a PRPlayer object by identiefier
+ *
+ * @param identifier
+ * @return PRPlayer
+ */
+ public PRPlayer get(String identifier) {
+ return PRCache.getPlayer(identifier);
+ }
+
+ // ================================================================================
+ // || ||
+ // || NAME ||
+ // || ||
+ // ================================================================================
+
+ /**
+ * Change the name of a PRPlayer
+ *
+ * @param UUID
+ * @param name
+ * @return true if player is not null
+ */
+ public boolean setName(UUID uuid, String name) {
+ return setName(uuid.toString(), name);
+ }
+
+ /**
+ * Change the name of a PRPlayer
+ *
+ * @param identifier
+ * @param name
+ * @return true if player is not null
+ */
+ public boolean setName(String identifier, String name) {
+ return setName(get(identifier), name);
+ }
+
+ /**
+ * Change the name of a PRPlayer
+ *
+ * @param PRPlayer
+ * @param name
+ * @return true if player is not null
+ */
+ public boolean setName(PRPlayer player, String name) {
+ if (player == null) {
+ return false;
+ }
+
+ player.setName(name);
+ return true;
+ }
+
+ /**
+ * Get the name of a PRPlayer
+ *
+ * @param UUID
+ * @return String or null if player is null
+ */
+ public String getName(UUID uuid) {
+ return getName(uuid.toString());
+ }
+
+ /**
+ * Get the name of a PRPlayer
+ *
+ * @param identifier
+ * @return String or null if player is null
+ */
+ public String getName(String identifier) {
+ return getName(get(identifier));
+ }
+
+ /**
+ * Get the name of a PRPlayer
+ *
+ * @param PRPlayer
+ * @return String or null if player is null
+ */
+ public String getName(PRPlayer player) {
+ if (player == null) {
+ return null;
+ }
+
+ return player.getName();
+ }
+
+ // ================================================================================
+ // || ||
+ // || NICKNAME ||
+ // || ||
+ // ================================================================================
+
+ /**
+ * Change the nickname of a PRPlayer
+ *
+ * @param UUID
+ * @param nickname
+ * @return true if player is not null
+ */
+ public boolean setNickName(UUID uuid, String nickname) {
+ return setNickName(uuid.toString(), nickname);
+ }
+
+ /**
+ * Change the nickname of a PRPlayer
+ *
+ * @param identifier
+ * @param nickname
+ * @return true if player is not null
+ */
+ public boolean setNickName(String identifier, String nickname) {
+ return setNickName(get(identifier), nickname);
+ }
+
+ /**
+ * Change the nickname of a PRPlayer
+ *
+ * @param PRPlayer
+ * @param nickname
+ * @return true if player is not null
+ */
+ public boolean setNickName(PRPlayer player, String nickname) {
+ if (player == null) {
+ return false;
+ }
+
+ player.setNickname(nickname);
+ return true;
+ }
+
+ /**
+ * Get the nickname of a PRPlayer
+ *
+ * @param UUID
+ * @return String or null if player is null
+ */
+ public String getNickName(UUID uuid) {
+ return getNickName(uuid.toString());
+ }
+
+ /**
+ * Get the nickname of a PRPlayer
+ *
+ * @param identifier
+ * @return String or null if player is null
+ */
+ public String getNickName(String identifier) {
+ return getNickName(get(identifier));
+ }
+
+ /**
+ * Get the nickname of a PRPlayer
+ *
+ * @param PRPlayer
+ * @return String or null if player is null
+ */
+ public String getNickName(PRPlayer player) {
+ if (player == null) {
+ return null;
+ }
+
+ return player.getNickname();
+ }
+
+ // ================================================================================
+ // || ||
+ // || PLAYTIME ||
+ // || ||
+ // ================================================================================
+
+ /**
+ * Change the playtime of a PRPlayer
+ *
+ * @param UUID
+ * @param playtime
+ * @return true if player is not null
+ */
+ public boolean setPlaytime(UUID uuid, long playtime) {
+ return setPlaytime(uuid.toString(), playtime);
+ }
+
+ /**
+ * Change the playtime of a PRPlayer
+ *
+ * @param identifier
+ * @param playtime
+ * @return true if player is not null
+ */
+ public boolean setPlaytime(String identifier, long playtime) {
+ return setPlaytime(get(identifier), playtime);
+ }
+
+ /**
+ * Change the playtime of a PRPlayer
+ *
+ * @param PRPlayer
+ * @param playtime
+ * @return true if player is not null
+ */
+ public boolean setPlaytime(PRPlayer player, long playtime) {
+ if (player == null) {
+ return false;
+ }
+
+ player.setPlaytime(playtime);
+ return true;
+ }
+
+ /**
+ * Get the playtime of a PRPlayer
+ *
+ * @param UUID
+ * @return long or -1 if player is null
+ */
+ public long getPlaytime(UUID uuid) {
+ return getPlaytime(uuid.toString());
+ }
+
+ /**
+ * Get the playtime of a PRPlayer
+ *
+ * @param identifier
+ * @return long or -1 if player is null
+ */
+ public long getPlaytime(String identifier) {
+ return getPlaytime(get(identifier));
+ }
+
+ /**
+ * Get the playtime of a PRPlayer
+ *
+ * @param PRPlayer
+ * @return long or -1 if player is null
+ */
+ public long getPlaytime(PRPlayer player) {
+ if (player == null) {
+ return -1;
+ }
+
+ return player.getPlaytime();
+ }
+
+ // ================================================================================
+ // || ||
+ // || RANKS ||
+ // || ||
+ // ================================================================================
+
+ /**
+ * Set the rank of a PRPlayer and remove all previous ranks
+ *
+ * @param UUID
+ * @param rankname
+ * @return true if player is not null
+ */
+ public boolean setRank(UUID uuid, String rankname) {
+ return setRank(uuid.toString(), PRCache.getRank(rankname));
+ }
+
+ /**
+ * Set the rank of a PRPlayer and remove all previous ranks
+ *
+ * @param identifier
+ * @param rankname
+ * @return true if player is not null
+ */
+ public boolean setRank(String identifier, String rankname) {
+ return setRank(get(identifier), PRCache.getRank(rankname));
+ }
+
+ /**
+ * Set the rank of a PRPlayer and remove all previous ranks
+ *
+ * @param UUID
+ * @param PRRank
+ * @return true if player is not null
+ */
+ public boolean setRank(UUID uuid, PRRank rank) {
+ return setRank(uuid.toString(), rank);
+ }
+
+ /**
+ * Set the rank of a PRPlayer and remove all previous ranks
+ *
+ * @param identifier
+ * @param PRRank
+ * @return true if player is not null
+ */
+ public boolean setRank(String identifier, PRRank rank) {
+ return setRank(get(identifier), rank);
+ }
+
+ /**
+ * Set the rank of a PRPlayer and remove all previous ranks
+ *
+ * @param PRPlayer
+ * @param PRRank
+ * @return true if player is not null
+ */
+ public boolean setRank(PRPlayer player, PRRank rank) {
+ if (player == null) {
+ return false;
+ }
+
+ player.getRanks().clear();
+ player.getRanks().add(new PRPlayerRank(rank));
+ return true;
+ }
+
+ /**
+ * Add a rank to a PRPlayer
+ *
+ * @param UUID
+ * @param rankname
+ * @return true if the rank was added to the player, false if the rank already exists or player is null
+ */
+ public boolean addRank(UUID uuid, String rankname) {
+ return addRank(uuid.toString(), PRCache.getRank(rankname));
+ }
+
+ /**
+ * Add a rank to a PRPlayer
+ *
+ * @param identifier
+ * @param rankname
+ * @return true if the rank was added to the player, false if the rank already exists or player is null
+ */
+ public boolean addRank(String identifier, String rankname) {
+ return addRank(get(identifier), PRCache.getRank(rankname));
+ }
+
+ /**
+ * Add a rank to a PRPlayer
+ *
+ * @param UUID
+ * @param PRRank
+ * @return true if the rank was added to the player, false if the rank already exists or player is null
+ */
+ public boolean addRank(UUID uuid, PRRank rank) {
+ return addRank(uuid.toString(), rank);
+ }
+
+ /**
+ * Add a rank to a PRPlayer
+ *
+ * @param identifier
+ * @param PRRank
+ * @return true if the rank was added to the player, false if the rank already exists or player is null
+ */
+ public boolean addRank(String identifier, PRRank rank) {
+ return addRank(get(identifier), rank);
+ }
+
+ /**
+ * Add a rank to a PRPlayer
+ *
+ * @param PRPlayer
+ * @param PRRank
+ * @return true if the rank was added to the player, false if the rank already exists or player is null
+ */
+ public boolean addRank(PRPlayer player, PRRank rank) {
+ if (player == null) {
+ return false;
+ }
+
+ for (PRPlayerRank prPlayerRank : player.getRanks()) {
+ if (prPlayerRank.getName().equalsIgnoreCase(rank.getName())) {
+ return false;
+ }
+ }
+
+ player.getRanks().add(new PRPlayerRank(rank));
+ return true;
+ }
+
+ /**
+ * Get all ranks of a PRPlayer
+ *
+ * @param UUID
+ * @return Set or null if player is null
+ */
+ public Set getRanks(UUID uuid) {
+ return getRanks(uuid.toString());
+ }
+
+ /**
+ * Get all ranks of a PRPlayer
+ *
+ * @param identifier
+ * @return Set or null if player is null
+ */
+ public Set getRanks(String identifier) {
+ return getRanks(get(identifier));
+ }
+
+ /**
+ * Get all ranks of a PRPlayer
+ *
+ * @param PRPlayer
+ * @return Set or null if player is null
+ */
+ public Set getRanks(PRPlayer player) {
+ if (player == null) {
+ return null;
+ }
+
+ return player.getRanks();
+ }
+
+ /**
+ * Remove a rank from a PRPlayer
+ *
+ * @param UUID
+ * @param rankname
+ * @return true if the rank was removed from the player, false if the rank was not found or player is null
+ */
+ public boolean removeRank(UUID uuid, String rankname) {
+ return removeRank(uuid.toString(), PRCache.getRank(rankname));
+ }
+
+ /**
+ * Remove a rank from a PRPlayer
+ *
+ * @param identifier
+ * @param rankname
+ * @return true if the rank was removed from the player, false if the rank was not found or player is null
+ */
+ public boolean removeRank(String identifier, String rankname) {
+ return removeRank(get(identifier), PRCache.getRank(rankname));
+ }
+
+ /**
+ * Remove a rank from a PRPlayer
+ *
+ * @param UUID
+ * @param PRRank
+ * @return true if the rank was removed from the player, false if the rank was not found or player is null
+ */
+ public boolean removeRank(UUID uuid, PRRank rank) {
+ return removeRank(uuid.toString(), rank);
+ }
+
+ /**
+ * Remove a rank from a PRPlayer
+ *
+ * @param identifier
+ * @param PRRank
+ * @return true if the rank was removed from the player, false if the rank was not found or player is null
+ */
+ public boolean removeRank(String identifier, PRRank rank) {
+ return removeRank(get(identifier), rank);
+ }
+
+ /**
+ * Remove a rank from a PRPlayer
+ *
+ * @param PRPlayer
+ * @param PRRank
+ * @return true if the rank was removed from the player, false if the rank was not found or player is null
+ */
+ public boolean removeRank(PRPlayer player, PRRank rank) {
+ if (player == null) {
+ return false;
+ }
+
+ for (PRPlayerRank prPlayerRank : player.getRanks()) {
+ if (prPlayerRank.getName().equalsIgnoreCase(rank.getName())) {
+ player.getRanks().remove(prPlayerRank);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Check if a PRPlayer has a rank
+ *
+ * @param UUID
+ * @param rankname
+ * @return true if the player has the rank, false if the player does not have the rank or player is null
+ */
+ public boolean hasRank(UUID uuid, String rankname) {
+ return hasRank(uuid.toString(), PRCache.getRank(rankname));
+ }
+
+ /**
+ * Check if a PRPlayer has a rank
+ *
+ * @param identifier
+ * @param rankname
+ * @return true if the player has the rank, false if the player does not have the rank or player is null
+ */
+ public boolean hasRank(String identifier, String rankname) {
+ return hasRank(get(identifier), PRCache.getRank(rankname));
+ }
+
+ /**
+ * Check if a PRPlayer has a rank
+ *
+ * @param UUID
+ * @param PRRank
+ * @return true if the player has the rank, false if the player does not have the rank or player is null
+ */
+ public boolean hasRank(UUID uuid, PRRank rank) {
+ return hasRank(uuid.toString(), rank);
+ }
+
+ /**
+ * Check if a PRPlayer has a rank
+ *
+ * @param identifier
+ * @param PRRank
+ * @return true if the player has the rank, false if the player does not have the rank or player is null
+ */
+ public boolean hasRank(String identifier, PRRank rank) {
+ return hasRank(get(identifier), rank);
+ }
+
+ /**
+ * Check if a PRPlayer has a rank
+ *
+ * @param PRPlayer
+ * @param PRRank
+ * @return true if the player has the rank, false if the player does not have the rank or player is null
+ */
+ public boolean hasRank(PRPlayer player, PRRank rank) {
+ if (player == null) {
+ return false;
+ }
+
+ for (PRPlayerRank prPlayerRank : player.getRanks()) {
+ if (prPlayerRank.getName().equalsIgnoreCase(rank.getName())) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ // ================================================================================
+ // || ||
+ // || PERMISSIONS ||
+ // || ||
+ // ================================================================================
+
+ /**
+ * Add a permission to a PRPlayer
+ *
+ * @param UUID
+ * @param permissionNode
+ * @param isAllowed
+ * @return true if the permission was added, false if the permission already exists or player is null
+ */
+ public boolean addPermission(UUID uuid, String permissionNode, boolean isAllowed) {
+ return addPermission(uuid.toString(), permissionNode, isAllowed);
+ }
+
+ /**
+ * Add a permission to a PRPlayer
+ *
+ * @param identifier
+ * @param permissionNode
+ * @param isAllowed
+ * @return true if the permission was added, false if the permission already exists or player is null
+ */
+ public boolean addPermission(String identifier, String permissionNode, boolean isAllowed) {
+ return addPermission(get(identifier), permissionNode, isAllowed);
+ }
+
+ /**
+ * Add a permission to a PRPlayer
+ *
+ * @param PRPlayer
+ * @param permissionNode
+ * @param isAllowed
+ * @return true if the permission was added, false if the permission already exists or player is null
+ */
+ public boolean addPermission(PRPlayer player, String permissionNode, boolean isAllowed) {
+ return addPermission(player, new PRPermission(permissionNode, isAllowed));
+ }
+
+ /**
+ * Add a permission to a PRPlayer
+ *
+ * @param UUID
+ * @param PRPermission
+ * @return true if the permission was added, false if the permission already exists or player is null
+ */
+ public boolean addPermission(UUID uuid, PRPermission permission) {
+ return addPermission(uuid.toString(), permission);
+ }
+
+ /**
+ * Add a permission to a PRPlayer
+ *
+ * @param identifier
+ * @param PRPermission
+ * @return true if the permission was added, false if the permission already exists or player is null
+ */
+ public boolean addPermission(String identifier, PRPermission permission) {
+ return addPermission(get(identifier), permission);
+ }
+
+ /**
+ * Add a permission to a PRPlayer
+ *
+ * @param PRPlayer
+ * @param PRPermission
+ * @return true if the permission was added, false if the permission already exists or player is null
+ */
+ public boolean addPermission(PRPlayer player, PRPermission permission) {
+ if (player == null) {
+ return false;
+ }
+
+ for (PRPermission prPermission : player.getPermissions()) {
+ if (prPermission.getName().equalsIgnoreCase(permission.getName())) {
+ return false;
+ }
+ }
+
+ player.getPermissions().add(permission);
+ return true;
+ }
+
+ /**
+ * Remove a permission from a PRPlayer
+ *
+ * @param UUID
+ * @param permissionNode
+ * @return true if the permission was removed from the player, false if the permission was not found or player is null
+ */
+ public boolean removePermission(UUID uuid, String permissionNode) {
+ return removePermission(uuid.toString(), permissionNode);
+ }
+
+ /**
+ * Remove a permission from a PRPlayer
+ *
+ * @param identifier
+ * @param permissionNode
+ * @return true if the permission was removed from the player, false if the permission was not found or player is null
+ */
+ public boolean removePermission(String identifier, String permissionNode) {
+ return removePermission(get(identifier), permissionNode);
+ }
+
+ /**
+ * Remove a permission from a PRPlayer
+ *
+ * @param PRPlayer
+ * @param permissionNode
+ * @return true if the permission was removed from the player, false if the permission was not found or player is null
+ */
+ public boolean removePermission(PRPlayer player, String permissionNode) {
+ return removePermission(player, new PRPermission(permissionNode, false));
+ }
+
+ /**
+ * Remove a permission from a PRPlayer
+ *
+ * @param UUID
+ * @param PRPermission
+ * @return true if the permission was removed from the player, false if the permission was not found or player is null
+ */
+ public boolean removePermission(UUID uuid, PRPermission permission) {
+ return removePermission(uuid.toString(), permission);
+ }
+
+ /**
+ * Remove a permission from a PRPlayer
+ *
+ * @param identifier
+ * @param PRPermission
+ * @return true if the permission was removed from the player, false if the permission was not found or player is null
+ */
+ public boolean removePermission(String identifier, PRPermission permission) {
+ return removePermission(get(identifier), permission);
+ }
+
+ /**
+ * Remove a permission from a PRPlayer
+ *
+ * @param PRPlayer
+ * @param PRPermission
+ * @return true if the permission was removed from the player, false if the permission was not found or player is null
+ */
+ public boolean removePermission(PRPlayer player, PRPermission permission) {
+ if (player == null) {
+ return false;
+ }
+
+ for (PRPermission prPermission : player.getPermissions()) {
+ if (prPermission.getName().equalsIgnoreCase(permission.getName())) {
+ player.getPermissions().remove(prPermission);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Check if a PRPlayer has a permission
+ *
+ * @param UUID
+ * @param permissionNode
+ * @return true if player has the permission, false if player does not have the permission or player is null
+ */
+ public boolean hasPermission(UUID uuid, String permissionNode) {
+ return hasPermission(uuid.toString(), permissionNode);
+ }
+
+ /**
+ * Check if a PRPlayer has a permission
+ *
+ * @param identifier
+ * @param permissionNode
+ * @return true if player has the permission, false if player does not have the permission or player is null
+ */
+ public boolean hasPermission(String identifier, String permissionNode) {
+ return hasPermission(get(identifier), permissionNode);
+ }
+
+ /**
+ * Check if a PRPlayer has a permission
+ *
+ * @param PRPlayer
+ * @param permissionNode
+ * @return true if player has the permission, false if player does not have the permission or player is null
+ */
+ public boolean hasPermission(PRPlayer player, String permissionNode) {
+ if (player == null) {
+ return false;
+ }
+
+ for (PRPermission prPermission : player.getPermissions()) {
+ if (prPermission.getName().equals(permissionNode)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Check if a PRPlayer's permission is allowed
+ *
+ * @param UUID
+ * @param PRPermission
+ * @return true if permission is allowed, false if permission is not allowed or not found
+ */
+ public boolean isPermissionAllowed(UUID uuid, String permissionNode) {
+ return isPermissionAllowed(uuid.toString(), permissionNode);
+ }
+
+ /**
+ * Check if a PRPlayer's permission is allowed
+ *
+ * @param identifier
+ * @param PRPermission
+ * @return true if permission is allowed, false if permission is not allowed or not found
+ */
+ public boolean isPermissionAllowed(String identifier, String permissionNode) {
+ return isPermissionAllowed(get(identifier), permissionNode);
+ }
+
+ /**
+ * Check if a PRPlayer's permission is allowed
+ *
+ * @param PRPlayer
+ * @param PRPermission
+ * @return true if permission is allowed, false if permission is not allowed or not found
+ */
+ public boolean isPermissionAllowed(PRPlayer player, String permissionNode) {
+ if (player == null) {
+ return false;
+ }
+
+ for (PRPermission prPermission : player.getPermissions()) {
+ if (prPermission.getName().equals(permissionNode)) {
+ return prPermission.getValue();
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Set a PRPlayer's permission to allowed
+ *
+ * @param UUID
+ * @param permissionNode
+ * @return true if permission was set to allowed, false if permission was not found or player is null
+ */
+ public boolean setPermissionAllowed(UUID uuid, String permissionNode) {
+ return setPermissionAllowed(uuid.toString(), permissionNode);
+ }
+
+ /**
+ * Set a PRPlayer's permission to allowed
+ *
+ * @param identifier
+ * @param permissionNode
+ * @return true if permission was set to allowed, false if permission was not found or player is null
+ */
+ public boolean setPermissionAllowed(String identifier, String permissionNode) {
+ return setPermissionAllowed(get(identifier), permissionNode);
+ }
+
+ /**
+ * Set a PRPlayer's permission to allowed
+ *
+ * @param PRPlayer
+ * @param permissionNode
+ * @return true if permission was set to allowed, false if permission was not found or player is null
+ */
+ public boolean setPermissionAllowed(PRPlayer player, String permissionNode) {
+ if (player == null) {
+ return false;
+ }
+
+ for (PRPermission prPermission : player.getPermissions()) {
+ if (prPermission.getName().equals(permissionNode)) {
+ prPermission.setValue(true);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Set a PRPlayer's permission to disallowed
+ *
+ * @param UUID
+ * @param PRPermission
+ * @return true if permission was set to disallowed, false if permission was not found or player is null
+ */
+ public boolean setPermissionDisallowed(UUID uuid, String permissionNode) {
+ return setPermissionDisallowed(uuid.toString(), permissionNode);
+ }
+
+ /**
+ * Set a PRPlayer's permission to disallowed
+ *
+ * @param identifier
+ * @param PRPermission
+ * @return true if permission was set to disallowed, false if permission was not found or player is null
+ */
+ public boolean setPermissionDisallowed(String identifier, String permissionNode) {
+ return setPermissionDisallowed(get(identifier), permissionNode);
+ }
+
+ /**
+ * Set a PRPlayer's permission to disallowed
+ *
+ * @param PRPlayer
+ * @param PRPermission
+ * @return true if permission was set to disallowed, false if permission was not found or player is null
+ */
+ public boolean setPermissionDisallowed(PRPlayer player, String permissionNode) {
+ if (player == null) {
+ return false;
+ }
+
+ for (PRPermission prPermission : player.getPermissions()) {
+ if (prPermission.getName().equals(permissionNode)) {
+ prPermission.setValue(false);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Get all permissions of a PRPlayer
+ *
+ * @param UUID
+ * @return Set or null if player is null
+ */
+ public Set getPermissions(UUID uuid) {
+ return getPermissions(uuid.toString());
+ }
+
+ /**
+ * Get all permissions of a PRPlayer
+ *
+ * @param identifier
+ * @return Set or null if player is null
+ */
+ public Set getPermissions(String identifier) {
+ return getPermissions(get(identifier));
+ }
+
+ /**
+ * Get all permissions of a PRPlayer
+ *
+ * @param PRPlayer
+ * @return Set or null if player is null
+ */
+ public Set getPermissions(PRPlayer player) {
+ if (player == null) {
+ return null;
+ }
+
+ return player.getPermissions();
+ }
+
+ // ================================================================================
+ // || ||
+ // || USERTAGS ||
+ // || ||
+ // ================================================================================
+
+ /**
+ * Add a usertag to a PRPlayer
+ *
+ * @param UUID
+ * @param usertag
+ * @return true if the usertag was added, false if the usertag already exists or player is null
+ */
+ public boolean addUsertag(UUID uuid, String usertag) {
+ return addUsertag(uuid.toString(), usertag);
+ }
+
+ /**
+ * Add a usertag to a PRPlayer
+ *
+ * @param identifier
+ * @param usertag
+ * @return true if the usertag was added, false if the usertag already exists or player is null
+ */
+ public boolean addUsertag(String identifier, String usertag) {
+ return addUsertag(get(identifier), usertag);
+ }
+
+ /**
+ * Add a usertag to a PRPlayer
+ *
+ * @param PRPlayer
+ * @param usertag
+ * @return true if the usertag was added, false if the usertag already exists or player is null
+ */
+ public boolean addUsertag(PRPlayer player, String usertag) {
+ if (player == null) {
+ return false;
+ }
+
+ for (String tag : player.getUsertags()) {
+ if (tag.equalsIgnoreCase(usertag)) {
+ return false;
+ }
+ }
+
+ player.getUsertags().add(usertag);
+ return true;
+ }
+
+ /**
+ * Remove a usertag from a PRPlayer
+ *
+ * @param UUID
+ * @param usertag
+ * @return true if the usertag was removed from the player, false if the usertag was not found or player is null
+ */
+ public boolean removeUsertag(UUID uuid, String usertag) {
+ return removeUsertag(uuid.toString(), usertag);
+ }
+
+ /**
+ * Remove a usertag from a PRPlayer
+ *
+ * @param identifier
+ * @param usertag
+ * @return true if the usertag was removed from the player, false if the usertag was not found or player is null
+ */
+ public boolean removeUsertag(String identifier, String usertag) {
+ return removeUsertag(get(identifier), usertag);
+ }
+
+ /**
+ * Remove a usertag from a PRPlayer
+ *
+ * @param PRPlayer
+ * @param usertag
+ * @return true if the usertag was removed from the player, false if the usertag was not found or player is null
+ */
+ public boolean removeUsertag(PRPlayer player, String usertag) {
+ if (player == null) {
+ return false;
+ }
+
+ for (String tag : player.getUsertags()) {
+ if (tag.equalsIgnoreCase(usertag)) {
+ player.getUsertags().remove(tag);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Check if a PRPlayer has a usertag
+ *
+ * @param UUID
+ * @param usertag
+ * @return true if player has the usertag, false if player does not have the usertag or player is null
+ */
+ public boolean hasUsertag(UUID uuid, String usertag) {
+ return hasUsertag(uuid.toString(), usertag);
+ }
+
+ /**
+ * Check if a PRPlayer has a usertag
+ *
+ * @param identifier
+ * @param usertag
+ * @return true if player has the usertag, false if player does not have the usertag or player is null
+ */
+ public boolean hasUsertag(String identifier, String usertag) {
+ return hasUsertag(get(identifier), usertag);
+ }
+
+ /**
+ * Check if a PRPlayer has a usertag
+ *
+ * @param PRPlayer
+ * @param usertag
+ * @return true if player has the usertag, false if player does not have the usertag or player is null
+ */
+ public boolean hasUsertag(PRPlayer player, String usertag) {
+ if (player == null) {
+ return false;
+ }
+
+ for (String tag : player.getUsertags()) {
+ if (tag.equalsIgnoreCase(usertag)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Get all usertags of a PRPlayer
+ *
+ * @param UUID
+ * @return Set or null if player is null
+ */
+ public Set getUsertags(UUID uuid) {
+ return getUsertags(uuid.toString());
+ }
+
+ /**
+ * Get all usertags of a PRPlayer
+ *
+ * @param identifier
+ * @return Set or null if player is null
+ */
+ public Set getUsertags(String identifier) {
+ return getUsertags(get(identifier));
+ }
+
+ /**
+ * Get all usertags of a PRPlayer
+ *
+ * @param PRPlayer
+ * @return Set or null if player is null
+ */
+ public Set getUsertags(PRPlayer player) {
+ if (player == null) {
+ return null;
+ }
+
+ return player.getUsertags();
+ }
+}
diff --git a/API/src/main/java/nl/svenar/powerranks/api/PowerRanksAPI.java b/API/src/main/java/nl/svenar/powerranks/api/PowerRanksAPI.java
new file mode 100644
index 00000000..b5858192
--- /dev/null
+++ b/API/src/main/java/nl/svenar/powerranks/api/PowerRanksAPI.java
@@ -0,0 +1,45 @@
+package nl.svenar.powerranks.api;
+
+public class PowerRanksAPI {
+
+ private final String API_VERSION = "2.0";
+
+ private RanksAPI ranksAPI;
+ private PlayersAPI playersAPI;
+
+ /**
+ * Initialize the API
+ */
+ public PowerRanksAPI() {
+ ranksAPI = new RanksAPI();
+ playersAPI = new PlayersAPI();
+ }
+
+ /**
+ * Get the api version
+ *
+ * @return String
+ */
+ public String getApiVersion() {
+ return API_VERSION;
+ }
+
+ /**
+ * Get the RanksAPI
+ *
+ * @return RanksAPI
+ */
+ public RanksAPI getRanksAPI() {
+ return ranksAPI;
+ }
+
+ /**
+ * Get the PlayersAPI
+ *
+ * @return PlayersAPI
+ */
+ public PlayersAPI getPlayersAPI() {
+ return playersAPI;
+ }
+
+}
\ No newline at end of file
diff --git a/API/src/main/java/nl/svenar/powerranks/api/RanksAPI.java b/API/src/main/java/nl/svenar/powerranks/api/RanksAPI.java
new file mode 100644
index 00000000..0239236b
--- /dev/null
+++ b/API/src/main/java/nl/svenar/powerranks/api/RanksAPI.java
@@ -0,0 +1,914 @@
+package nl.svenar.powerranks.api;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import nl.svenar.powerranks.common.structure.PRPermission;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRCache;
+
+public class RanksAPI {
+
+ /**
+ * Create a new rank
+ *
+ * @param name
+ * @return PRRank or null if the rank already exists
+ */
+ public PRRank create(String name) {
+ return PRCache.createRank(name);
+ }
+
+ /**
+ * Get a rank by name
+ *
+ * @param name
+ * @return PRRank or null if the rank does not exists
+ */
+ public PRRank get(String name) {
+ return PRCache.getRank(name);
+ }
+
+ /**
+ * Get all ranks
+ *
+ * @return List
+ */
+ public List getRanks() {
+ return PRCache.getRanks();
+ }
+
+ /**
+ * Delete a rank by name
+ *
+ * @param name
+ * @return true if the rank was deleted, false if the rank does not exists
+ */
+ public boolean delete(String name) {
+ try {
+ PRRank rank = get(name);
+ PRCache.removeRank(rank);
+ return true;
+ } catch (NullPointerException e) {
+ return false;
+ }
+ }
+
+ /**
+ * Check if a rank exists
+ *
+ * @param name
+ * @return true if the rank exists, false if the rank does not exists
+ */
+ public boolean exists(String name) {
+ return get(name) != null;
+ }
+
+ /**
+ * Rename a rank
+ *
+ * @param oldname
+ * @param newname
+ * @return true if the rank was renamed, false if the rank does not exists or the new name already exists
+ */
+ public boolean rename(String oldname, String newname) {
+ if (!exists(oldname) || exists(newname)) {
+ return false;
+ }
+
+ PRRank rank = get(oldname);
+ rank.setName(newname);
+
+ return true;
+ }
+
+ /**
+ * Set the prefix of a rank
+ * @param name
+ * @param prefix
+ * @return true if the prefix was set, false if the rank does not exists
+ */
+ public boolean setPrefix(String name, String prefix) {
+ return setPrefix(get(name), prefix);
+ }
+
+ /**
+ * Set the prefix of a rank
+ * @param rank
+ * @param prefix
+ * @return true if the prefix was set, false if the rank does not exists
+ */
+ public boolean setPrefix(PRRank rank, String prefix) {
+ if (rank == null) {
+ return false;
+ }
+
+ rank.setPrefix(prefix);
+
+ return true;
+ }
+
+ /**
+ * Get the prefix of a rank
+ * @param name
+ * @return String or null if the rank does not exists
+ */
+ public String getPrefix(String name) {
+ return getPrefix(get(name));
+ }
+
+ /**
+ * Get the prefix of a rank
+ * @param rank
+ * @return String or null if the rank does not exists
+ */
+ public String getPrefix(PRRank rank) {
+ if (rank == null) {
+ return null;
+ }
+
+ return rank.getPrefix();
+ }
+
+ /**
+ * Set the suffix of a rank
+ * @param name
+ * @param suffix
+ * @return true if the suffix was set, false if the rank does not exists
+ */
+ public boolean setSuffix(String name, String suffix) {
+ return setSuffix(get(name), suffix);
+ }
+
+ /**
+ * Set the suffix of a rank
+ * @param rank
+ * @param suffix
+ * @return true if the suffix was set, false if the rank does not exists
+ */
+ public boolean setSuffix(PRRank rank, String suffix) {
+ if (rank == null) {
+ return false;
+ }
+
+ rank.setSuffix(suffix);
+
+ return true;
+ }
+
+ /**
+ * Get the suffix of a rank
+ * @param name
+ * @return String or null if the rank does not exists
+ */
+ public String getSuffix(String name) {
+ return getSuffix(get(name));
+ }
+
+ /**
+ * Get the suffix of a rank
+ * @param rank
+ * @return String or null if the rank does not exists
+ */
+ public String getSuffix(PRRank rank) {
+ if (rank == null) {
+ return null;
+ }
+
+ return rank.getSuffix();
+ }
+
+ /**
+ * Set the weight of a rank
+ * @param name
+ * @param weight
+ * @return true if the weight was set, false if the rank does not exists
+ */
+ public boolean setWeight(String name, int weight) {
+ return setWeight(get(name), weight);
+ }
+
+ /**
+ * Set the weight of a rank
+ * @param rank
+ * @param weight
+ * @return true if the weight was set, false if the rank does not exists
+ */
+ public boolean setWeight(PRRank rank, int weight) {
+ if (rank == null) {
+ return false;
+ }
+
+ rank.setWeight(weight);
+
+ return true;
+ }
+
+ /**
+ * Get the weight of a rank
+ * @param name
+ * @return int or -1 if the rank does not exists
+ */
+ public int getWeight(String name) {
+ return getWeight(get(name));
+ }
+
+ /**
+ * Get the weight of a rank
+ * @param rank
+ * @return int or -1 if the rank does not exists
+ */
+ public int getWeight(PRRank rank) {
+ if (rank == null) {
+ return -1;
+ }
+
+ return rank.getWeight();
+ }
+
+ /**
+ * Set the default state of a rank
+ * @param name
+ * @param isDefault
+ * @return true if the default state was set, false if the rank does not exists
+ */
+ public boolean setDefault(String name, boolean isDefault) {
+ return setDefault(get(name), isDefault);
+ }
+
+ /**
+ * Set the default state of a rank
+ * @param rank
+ * @param isDefault
+ * @return true if the default state was set, false if the rank does not exists
+ */
+ public boolean setDefault(PRRank rank, boolean isDefault) {
+ if (rank == null) {
+ return false;
+ }
+
+ rank.setDefault(isDefault);
+
+ return true;
+ }
+
+ /**
+ * Get the default state of a rank
+ * @param name
+ * @return boolean or false if the rank does not exists
+ */
+ public boolean isDefault(String name) {
+ return isDefault(get(name));
+ }
+
+ /**
+ * Get the default state of a rank
+ * @param rank
+ * @return boolean or false if the rank does not exists
+ */
+ public boolean isDefault(PRRank rank) {
+ if (rank == null) {
+ return false;
+ }
+
+ return rank.isDefault();
+ }
+
+ /**
+ * Set the name color for a player of a rank
+ * @param name
+ * @param isDefault
+ * @return true if the default state was set, false if the rank does not exists
+ */
+ public boolean setNameColor(String name, String nameColor) {
+ return setNameColor(get(name), nameColor);
+ }
+
+ /**
+ * Set the name color for a player of a rank
+ * @param rank
+ * @param isDefault
+ * @return true if the default state was set, false if the rank does not exists
+ */
+ public boolean setNameColor(PRRank rank, String nameColor) {
+ if (rank == null) {
+ return false;
+ }
+
+ rank.setNamecolor(nameColor);
+
+ return true;
+ }
+
+ /**
+ * Get the name color for a player of a rank
+ * @param name
+ * @return String or null if the rank does not exists
+ */
+ public String getNameColor(String name) {
+ return getNameColor(get(name));
+ }
+
+ /**
+ * Get the name color for a player of a rank
+ * @param rank
+ * @return String or null if the rank does not exists
+ */
+ public String getNameColor(PRRank rank) {
+ if (rank == null) {
+ return null;
+ }
+
+ return rank.getNamecolor();
+ }
+
+ /**
+ * Set the chat color for a player of a rank
+ * @param name
+ * @param isDefault
+ * @return true if the default state was set, false if the rank does not exists
+ */
+ public boolean setChatColor(String name, String chatColor) {
+ return setChatColor(get(name), chatColor);
+ }
+
+ /**
+ * Set the chat color for a player of a rank
+ * @param rank
+ * @param isDefault
+ * @return true if the default state was set, false if the rank does not exists
+ */
+ public boolean setChatColor(PRRank rank, String chatColor) {
+ if (rank == null) {
+ return false;
+ }
+
+ rank.setChatcolor(chatColor);
+
+ return true;
+ }
+
+ /**
+ * Get the chat color for a player of a rank
+ * @param name
+ * @return String or null if the rank does not exists
+ */
+ public String getChatColor(String name) {
+ return getChatColor(get(name));
+ }
+
+ /**
+ * Get the chat color for a player of a rank
+ * @param rank
+ * @return String or null if the rank does not exists
+ */
+ public String getChatColor(PRRank rank) {
+ if (rank == null) {
+ return null;
+ }
+
+ return rank.getChatcolor();
+ }
+
+ /**
+ * Add a rank as inheritance to a rank
+ * @param name
+ * @param inherit
+ * @return true if the inheritance was added, false if the rank does not exists or the inheritance already exists
+ */
+ public boolean addInheritance(String name, String inherit) {
+ return addInheritance(get(name), get(inherit));
+ }
+
+ /**
+ * Add a rank as inheritance to a rank
+ * @param PRRank
+ * @param inherit
+ * @return
+ */
+ public boolean addInheritance(PRRank rank, String inherit) {
+ return addInheritance(rank, get(inherit));
+ }
+
+ /**
+ * Add a rank as inheritance to a rank
+ * @param rank
+ * @param inheritRank
+ * @return
+ */
+ public boolean addInheritance(String name, PRRank inheritRank) {
+ return addInheritance(get(name), inheritRank);
+ }
+
+ /**
+ * Add a rank as inheritance to a rank
+ * @param PRRank
+ * @param PRRank
+ * @return true if the inheritance was added, false if the rank does not exists or the inheritance already exists
+ */
+ public boolean addInheritance(PRRank rank, PRRank inheritRank) {
+ if (rank == null || inheritRank == null) {
+ return false;
+ }
+
+ for (String inheritance : rank.getInheritances()) {
+ if (inheritance.equalsIgnoreCase(inheritRank.getName())) {
+ return false;
+ }
+ }
+
+ rank.getInheritances().add(inheritRank.getName());
+
+ return true;
+ }
+
+ /**
+ * Remove a rank as inheritance from a rank
+ * @param name
+ * @param inherit
+ * @return true if the inheritance was removed, false if the rank does not exists or the inheritance does not exists
+ */
+ public boolean removeInheritance(String name, String inherit) {
+ return removeInheritance(get(name), get(inherit));
+ }
+
+ /**
+ * Remove a rank as inheritance from a rank
+ * @param PRRank
+ * @param inherit
+ * @return true if the inheritance was removed, false if the rank does not exists or the inheritance does not exists
+ */
+ public boolean removeInheritance(PRRank rank, String inherit) {
+ return removeInheritance(rank, get(inherit));
+ }
+
+ /**
+ * Remove a rank as inheritance from a rank
+ * @param name
+ * @param inheritRank
+ * @return true if the inheritance was removed, false if the rank does not exists or the inheritance does not exists
+ */
+ public boolean removeInheritance(String name, PRRank inheritRank) {
+ return removeInheritance(get(name), inheritRank);
+ }
+
+ /**
+ * Remove a rank as inheritance from a rank
+ * @param PRRank
+ * @param PRRank
+ * @return true if the inheritance was removed, false if the rank does not exists or the inheritance does not exists
+ */
+ public boolean removeInheritance(PRRank rank, PRRank inheritRank) {
+ if (rank == null) {
+ return false;
+ }
+
+ boolean found = false;
+ for (String inheritance : rank.getInheritances()) {
+ if (inheritance.equalsIgnoreCase(inheritRank.getName())) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ return false;
+ }
+
+ rank.getInheritances().remove(inheritRank.getName());
+
+ return true;
+ }
+
+ /**
+ * Get all inheritances of a rank
+ * @param name
+ * @return List or null if the rank does not exists
+ */
+ public List getInheritances(String name) {
+ return getInheritances(get(name));
+ }
+
+ /**
+ * Get all inheritances of a rank
+ * @param rank
+ * @return List or null if the rank does not exists
+ */
+ public List getInheritances(PRRank rank) {
+ if (rank == null) {
+ return null;
+ }
+
+ List inheritances = new ArrayList();
+ for (String inherit : rank.getInheritances()) {
+ PRRank prRank = get(inherit);
+ if (prRank != null) {
+ inheritances.add(prRank);
+ }
+ }
+
+ return inheritances;
+ }
+
+ /**
+ * Add a permission to a rank
+ * @param name
+ * @param permissionNode
+ * @param allowed
+ * @return true if the permission was added, false if the rank does not exists or the permission already exists
+ */
+ public boolean addPermission(String name, String permissionNode, boolean allowed) {
+ return addPermission(get(name), new PRPermission(permissionNode, allowed));
+ }
+
+ /**
+ * Add a permission to a rank
+ * @param rank
+ * @param permissionNode
+ * @param allowed
+ * @return true if the permission was added, false if the rank does not exists or the permission already exists
+ */
+ public boolean addPermission(PRRank rank, String permissionNode, boolean allowed) {
+ return addPermission(rank, new PRPermission(permissionNode, allowed));
+ }
+
+ /**
+ * Add a permission to a rank
+ * @param name
+ * @param permission
+ * @return true if the permission was added, false if the rank does not exists or the permission already exists
+ */
+ public boolean addPermission(String name, PRPermission permission) {
+ return addPermission(get(name), permission);
+ }
+
+ /**
+ * Add a permission to a rank
+ * @param rank
+ * @param permission
+ * @return true if the permission was added, false if the rank does not exists or the permission already exists
+ */
+ public boolean addPermission(PRRank rank, PRPermission permission) {
+ if (rank == null) {
+ return false;
+ }
+
+ for (PRPermission prPermission : rank.getPermissions()) {
+ if (prPermission.getName().equals(permission.getName())) {
+ return false;
+ }
+ }
+
+ rank.getPermissions().add(permission);
+
+ return true;
+ }
+
+ /**
+ * Remove a permission from a rank
+ * @param name
+ * @param permissionNode
+ * @return true if the permission was removed, false if the rank does not exists or the permission does not exists
+ */
+ public boolean removePermission(String name, String permission) {
+ return removePermission(get(name), permission);
+ }
+
+ /**
+ * Remove a permission from a rank
+ * @param rank
+ * @param permissionNode
+ * @return true if the permission was removed, false if the rank does not exists or the permission does not exists
+ */
+ public boolean removePermission(PRRank rank, String permission) {
+ if (rank == null) {
+ return false;
+ }
+
+ PRPermission foundPermission = null;
+ for (PRPermission prPermission : rank.getPermissions()) {
+ if (prPermission.getName().equals(permission)) {
+ foundPermission = prPermission;
+ break;
+ }
+ }
+
+ if (foundPermission == null) {
+ return false;
+ }
+
+ rank.getPermissions().remove(foundPermission);
+
+ return true;
+ }
+
+ /**
+ * Get all permissions of a rank
+ * @param name
+ * @return List or null if the rank does not exists
+ */
+ public List getPermissions(String name) {
+ return getPermissions(get(name));
+ }
+
+ /**
+ * Get all permissions of a rank
+ * @param rank
+ * @return List or null if the rank does not exists
+ */
+ public List getPermissions(PRRank rank) {
+ if (rank == null) {
+ return null;
+ }
+
+ return rank.getPermissions();
+ }
+
+ /**
+ * Add a rank to a rank as buyable
+ * @param name
+ * @param buyableRankName
+ * @return true if the buyable rank was added, false if the rank does not exists or the buyable rank already exists
+ */
+ public boolean addBuyableRank(String name, String buyableRankName) {
+ return addBuyableRank(get(name), get(buyableRankName));
+ }
+
+ /**
+ * Add a rank to a rank as buyable
+ * @param name
+ * @param buyableRankName
+ * @return true if the buyable rank was added, false if the rank does not exists or the buyable rank already exists
+ */
+ public boolean addBuyableRank(PRRank rank, String buyableRankName) {
+ return addBuyableRank(rank, get(buyableRankName));
+ }
+
+ /**
+ * Add a rank to a rank as buyable
+ * @param name
+ * @param buyableRank
+ * @return true if the buyable rank was added, false if the rank does not exists or the buyable rank already exists
+ */
+ public boolean addBuyableRank(String name, PRRank buyableRank) {
+ return addBuyableRank(get(name), buyableRank);
+ }
+
+ /**
+ * Add a rank to a rank as buyable
+ * @param rank
+ * @param buyableRank
+ * @return true if the buyable rank was added, false if the rank does not exists or the buyable rank already exists
+ */
+ public boolean addBuyableRank(PRRank rank, PRRank buyableRank) {
+ if (rank == null) {
+ return false;
+ }
+
+ for (String prBuyableRank : rank.getBuyableRanks()) {
+ if (prBuyableRank.equalsIgnoreCase(buyableRank.getName())) {
+ return false;
+ }
+ }
+
+ rank.getBuyableRanks().add(buyableRank.getName());
+
+ return true;
+ }
+
+ /**
+ * Remove a rank from a rank as buyable
+ * @param name
+ * @param buyableRankName
+ * @return true if the buyable rank was removed, false if the rank does not exists or the buyable rank does not exists
+ */
+ public boolean removeBuyableRank(String name, String buyableRankName) {
+ return removeBuyableRank(get(name), get(buyableRankName));
+ }
+
+ /**
+ * Remove a rank from a rank as buyable
+ * @param name
+ * @param buyableRankName
+ * @return true if the buyable rank was removed, false if the rank does not exists or the buyable rank does not exists
+ */
+ public boolean removeBuyableRank(PRRank rank, String buyableRankName) {
+ return removeBuyableRank(rank, get(buyableRankName));
+ }
+
+ /**
+ * Remove a rank from a rank as buyable
+ * @param name
+ * @param buyableRank
+ * @return true if the buyable rank was removed, false if the rank does not exists or the buyable rank does not exists
+ */
+ public boolean removeBuyableRank(String name, PRRank buyableRank) {
+ return removeBuyableRank(get(name), buyableRank);
+ }
+
+ /**
+ * Remove a rank from a rank as buyable
+ * @param rank
+ * @param buyableRank
+ * @return true if the buyable rank was removed, false if the rank does not exists or the buyable rank does not exists
+ */
+ public boolean removeBuyableRank(PRRank rank, PRRank buyableRank) {
+ if (rank == null) {
+ return false;
+ }
+
+ boolean found = false;
+ for (String prBuyableRank : rank.getBuyableRanks()) {
+ if (prBuyableRank.equalsIgnoreCase(buyableRank.getName())) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ return false;
+ }
+
+ rank.getBuyableRanks().remove(buyableRank.getName());
+
+ return true;
+ }
+
+ /**
+ * Get all buyable ranks of a rank
+ * @param name
+ * @return List or null if the rank does not exists
+ */
+ public List getBuyableRanks(String name) {
+ return getBuyableRanks(get(name));
+ }
+
+ /**
+ * Get all buyable ranks of a rank
+ * @param rank
+ * @return List or null if the rank does not exists
+ */
+ public List getBuyableRanks(PRRank rank) {
+ if (rank == null) {
+ return null;
+ }
+
+ List buyableRanks = new ArrayList();
+ for (String buyableRank : rank.getBuyableRanks()) {
+ PRRank prRank = get(buyableRank);
+ if (prRank != null) {
+ buyableRanks.add(prRank);
+ }
+ }
+
+ return buyableRanks;
+ }
+
+ /**
+ * Set the buy cost of a rank
+ * @param name
+ * @param cost
+ * @return true if the buy cost was set, false if the rank does not exists
+ */
+ public boolean setBuyCost(String name, float cost) {
+ return setBuyCost(get(name), cost);
+ }
+
+ /**
+ * Set the buy cost of a rank
+ * @param rank
+ * @param cost
+ * @return true if the buy cost was set, false if the rank does not exists
+ */
+ public boolean setBuyCost(PRRank rank, float cost) {
+ if (rank == null) {
+ return false;
+ }
+
+ rank.setBuyCost(cost);
+
+ return true;
+ }
+
+ /**
+ * Get the buy cost of a rank
+ * @param name
+ * @return float or -1 if the rank does not exists
+ */
+ public float getBuyCost(String name) {
+ return getBuyCost(get(name));
+ }
+
+ /**
+ * Get the buy cost of a rank
+ * @param rank
+ * @return float or -1 if the rank does not exists
+ */
+ public float getBuyCost(PRRank rank) {
+ if (rank == null) {
+ return -1;
+ }
+
+ return rank.getBuyCost();
+ }
+
+ /**
+ * Set the buy description of a rank
+ * @param name
+ * @param description
+ * @return true if the buy description was set, false if the rank does not exists
+ */
+ public boolean setBuyDescription(String name, String description) {
+ return setBuyDescription(get(name), description);
+ }
+
+ /**
+ * Set the buy description of a rank
+ * @param rank
+ * @param description
+ * @return true if the buy description was set, false if the rank does not exists
+ */
+ public boolean setBuyDescription(PRRank rank, String description) {
+ if (rank == null) {
+ return false;
+ }
+
+ rank.setBuyDescription(description);
+
+ return true;
+ }
+
+ /**
+ * Get the buy description of a rank
+ * @param name
+ * @return String or null if the rank does not exists
+ */
+ public String getBuyDescription(String name) {
+ return getBuyDescription(get(name));
+ }
+
+ /**
+ * Get the buy description of a rank
+ * @param rank
+ * @return String or null if the rank does not exists
+ */
+ public String getBuyDescription(PRRank rank) {
+ if (rank == null) {
+ return null;
+ }
+
+ return rank.getBuyDescription();
+ }
+
+ /**
+ * Set the buy command of a rank
+ * This command will be executed when a player buys the rank
+ * @param name
+ * @param command
+ * @return true if the buy command was set, false if the rank does not exists
+ */
+ public boolean setBuyCommand(String name, String command) {
+ return setBuyCommand(get(name), command);
+ }
+
+ /**
+ * Set the buy command of a rank
+ * This command will be executed when a player buys the rank
+ * @param rank
+ * @param command
+ * @return true if the buy command was set, false if the rank does not exists
+ */
+ public boolean setBuyCommand(PRRank rank, String command) {
+ if (rank == null) {
+ return false;
+ }
+
+ rank.setBuyCommand(command);
+
+ return true;
+ }
+
+ /**
+ * Get the buy command of a rank
+ * This command will be executed when a player buys the rank
+ * @param name
+ * @return String or null if the rank does not exists
+ */
+ public String getBuyCommand(String name) {
+ return getBuyCommand(get(name));
+ }
+
+ /**
+ * Get the buy command of a rank
+ * This command will be executed when a player buys the rank
+ * @param rank
+ * @return String or null if the rank does not exists
+ */
+ public String getBuyCommand(PRRank rank) {
+ if (rank == null) {
+ return null;
+ }
+
+ return rank.getBuyCommand();
+ }
+}
diff --git a/API/src/test/java/nl/svenar/powerranks/test/tests/TestPlayersAPI.java b/API/src/test/java/nl/svenar/powerranks/test/tests/TestPlayersAPI.java
new file mode 100644
index 00000000..0633226d
--- /dev/null
+++ b/API/src/test/java/nl/svenar/powerranks/test/tests/TestPlayersAPI.java
@@ -0,0 +1,130 @@
+package nl.svenar.powerranks.test.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.UUID;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import nl.svenar.powerranks.api.PowerRanksAPI;
+import nl.svenar.powerranks.common.structure.PRPermission;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRCache;
+import nl.svenar.powerranks.test.util.TestDebugger;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestPlayersAPI {
+
+ private PRRank rank1, rank2;
+ private PRPlayer player1;
+ private PowerRanksAPI api;
+
+ @Before
+ public void setupCache() {
+ TestDebugger.log(this, "===== Setting up PRCache =====");
+ PRCache.reset();
+
+ rank1 = PRCache.createRank("rank1");
+ rank1.setWeight(10);
+ rank1.setPrefix("prefix1");
+ rank1.setSuffix("suffix1");
+
+ rank2 = PRCache.createRank("rank2");
+ rank2.setWeight(20);
+ rank2.setPrefix("prefix2");
+ rank2.setSuffix("suffix2");
+
+ player1 = PRCache.createPlayer("player1", UUID.randomUUID());
+
+ api = new PowerRanksAPI();
+ }
+
+ @After
+ public void cleanupCache() {
+ TestDebugger.log(this, "===== Cleaning up PRCache =====");
+ PRCache.reset();
+ }
+
+ @Test
+ public void A_TestRanks() {
+ TestDebugger.log(this, "[A_TestRanks] Setup...");
+
+ assertEquals(0, api.getPlayersAPI().getRanks(player1).size());
+
+ api.getPlayersAPI().addRank(player1, rank1);
+ api.getPlayersAPI().addRank(player1, rank1);
+ api.getPlayersAPI().addRank(player1, rank2);
+ assertEquals(2, api.getPlayersAPI().getRanks(player1).size());
+
+ api.getPlayersAPI().removeRank(player1, rank1);
+ api.getPlayersAPI().removeRank(player1, rank1);
+ assertEquals(1, api.getPlayersAPI().getRanks(player1).size());
+
+ TestDebugger.log(this, "[A_TestRanks] OK");
+ }
+
+ @Test
+ public void B_TestPermissions() {
+ TestDebugger.log(this, "[B_TestPermissions] Setup...");
+
+ assertEquals(0, api.getPlayersAPI().getPermissions(player1).size());
+
+ api.getPlayersAPI().addPermission(player1, new PRPermission("test.permission.1", true));
+ api.getPlayersAPI().addPermission(player1, new PRPermission("test.permission.2", false));
+ assertEquals(2, api.getPlayersAPI().getPermissions(player1).size());
+
+ assertTrue(api.getPlayersAPI().hasPermission(player1, "test.permission.1"));
+ assertTrue(api.getPlayersAPI().hasPermission(player1, "test.permission.2"));
+ assertTrue(api.getPlayersAPI().isPermissionAllowed(player1, "test.permission.1"));
+ assertTrue(!api.getPlayersAPI().isPermissionAllowed(player1, "test.permission.2"));
+
+ api.getPlayersAPI().removePermission(player1, new PRPermission("test.permission.1", true));
+ api.getPlayersAPI().removePermission(player1, new PRPermission("test.permission.1", true));
+ assertEquals(1, api.getPlayersAPI().getPermissions(player1).size());
+
+ assertTrue(!api.getPlayersAPI().hasPermission(player1, "test.permission.1"));
+ assertTrue(api.getPlayersAPI().hasPermission(player1, "test.permission.2"));
+ assertTrue(!api.getPlayersAPI().isPermissionAllowed(player1, "test.permission.1"));
+ assertTrue(!api.getPlayersAPI().isPermissionAllowed(player1, "test.permission.2"));
+
+
+ TestDebugger.log(this, "[B_TestPermissions] OK");
+ }
+
+ @Test
+ public void C_TestPlaytime() {
+ TestDebugger.log(this, "[C_TestPlaytime] Setup...");
+
+ assertEquals(0, api.getPlayersAPI().getPlaytime(player1));
+
+ api.getPlayersAPI().setPlaytime(player1, 100);
+
+ assertEquals(100, api.getPlayersAPI().getPlaytime(player1));
+
+ TestDebugger.log(this, "[C_TestPlaytime] OK");
+ }
+
+ @Test
+ public void D_TestUsertags() {
+ TestDebugger.log(this, "[D_TestUsertags] Setup...");
+
+ assertEquals(0, api.getPlayersAPI().getUsertags(player1).size());
+
+ api.getPlayersAPI().addUsertag(player1, "usertag1");
+ api.getPlayersAPI().addUsertag(player1, "usertag2");
+ assertEquals(2, api.getPlayersAPI().getUsertags(player1).size());
+
+ api.getPlayersAPI().removeUsertag(player1, "usertag1");
+ api.getPlayersAPI().removeUsertag(player1, "usertag1");
+ assertEquals(1, api.getPlayersAPI().getUsertags(player1).size());
+
+ TestDebugger.log(this, "[D_TestUsertags] OK");
+ }
+
+}
diff --git a/API/src/test/java/nl/svenar/powerranks/test/tests/TestRanksAPI.java b/API/src/test/java/nl/svenar/powerranks/test/tests/TestRanksAPI.java
new file mode 100644
index 00000000..b2f05d14
--- /dev/null
+++ b/API/src/test/java/nl/svenar/powerranks/test/tests/TestRanksAPI.java
@@ -0,0 +1,145 @@
+package nl.svenar.powerranks.test.tests;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import nl.svenar.powerranks.api.PowerRanksAPI;
+import nl.svenar.powerranks.common.structure.PRPermission;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRCache;
+import nl.svenar.powerranks.test.util.TestDebugger;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestRanksAPI {
+
+ private PRRank rank1, rank2, rank3;
+ private PowerRanksAPI api;
+
+ @Before
+ public void setupCache() {
+ TestDebugger.log(this, "===== Setting up PRCache =====");
+ PRCache.reset();
+
+ rank1 = PRCache.createRank("rank1");
+ rank1.setWeight(10);
+ rank1.setPrefix("prefix1");
+ rank1.setSuffix("suffix1");
+
+ rank2 = PRCache.createRank("rank2");
+ rank2.setWeight(20);
+ rank2.setPrefix("prefix2");
+ rank2.setSuffix("suffix2");
+
+ rank3 = PRCache.createRank("rank3");
+ rank3.setWeight(30);
+ rank3.setPrefix("prefix3");
+ rank3.setSuffix("suffix3");
+
+ api = new PowerRanksAPI();
+ }
+
+ @After
+ public void cleanupCache() {
+ TestDebugger.log(this, "===== Cleaning up PRCache =====");
+ PRCache.reset();
+ }
+
+ @Test
+ public void A_TestGetRank() {
+ TestDebugger.log(this, "[A_TestGetRank] Setup...");
+
+ assertEquals(rank1, api.getRanksAPI().get("rank1"));
+ assertEquals(rank2, api.getRanksAPI().get("rank2"));
+ assertEquals(rank3, api.getRanksAPI().get("rank3"));
+
+ TestDebugger.log(this, "[A_TestGetRank] OK");
+ }
+
+ @Test
+ public void B_TestPrefix() {
+ TestDebugger.log(this, "[B_TestPrefix] Setup...");
+
+ assertEquals(rank1.getPrefix(), api.getRanksAPI().getPrefix(rank1));
+
+ api.getRanksAPI().setPrefix(rank1, "newprefix1");
+ assertEquals("newprefix1", api.getRanksAPI().getPrefix(rank1));
+
+ TestDebugger.log(this, "[B_TestPrefix] OK");
+ }
+
+ @Test
+ public void C_TestSuffix() {
+ TestDebugger.log(this, "[C_TestSuffix] Setup...");
+
+ assertEquals(rank1.getSuffix(), api.getRanksAPI().getSuffix(rank1));
+
+ api.getRanksAPI().setSuffix(rank1, "newprefix1");
+ assertEquals("newprefix1", api.getRanksAPI().getSuffix(rank1));
+
+ TestDebugger.log(this, "[C_TestSuffix] OK");
+ }
+
+ @Test
+ public void D_TestPermissions() {
+ TestDebugger.log(this, "[D_TestPermissions] Setup...");
+
+ assertEquals(0, api.getRanksAPI().getPermissions(rank1).size());
+
+ PRPermission permission1 = new PRPermission("permission.1", true);
+ PRPermission permission2 = new PRPermission("permission.2", false);
+ api.getRanksAPI().addPermission(rank1, permission1);
+ api.getRanksAPI().addPermission(rank1, permission2);
+ assertEquals(2, api.getRanksAPI().getPermissions(rank1).size());
+
+ api.getRanksAPI().removePermission(rank1, permission1.getName());
+ assertEquals(1, api.getRanksAPI().getPermissions(rank1).size());
+
+ TestDebugger.log(this, "[D_TestPermissions] OK");
+ }
+
+ @Test
+ public void E_NameColor() {
+ TestDebugger.log(this, "[E_NameColor] Setup...");
+
+ assertEquals(rank1.getNamecolor(), api.getRanksAPI().getNameColor(rank1));
+
+ api.getRanksAPI().setNameColor(rank1, "&a");
+ assertEquals("&a", api.getRanksAPI().getNameColor(rank1));
+
+ TestDebugger.log(this, "[E_NameColor] OK");
+ }
+
+ @Test
+ public void F_ChatColor() {
+ TestDebugger.log(this, "[F_ChatColor] Setup...");
+
+ assertEquals(rank1.getNamecolor(), api.getRanksAPI().getChatColor(rank1));
+
+ api.getRanksAPI().setChatColor(rank1, "&a");
+ assertEquals("&a", api.getRanksAPI().getChatColor(rank1));
+
+ TestDebugger.log(this, "[F_ChatColor] OK");
+ }
+
+ @Test
+ public void G_Inheritances() {
+ TestDebugger.log(this, "[G_Inheritances] Setup...");
+
+ assertEquals(0, api.getRanksAPI().getInheritances(rank1).size());
+
+ api.getRanksAPI().addInheritance(rank1, rank2);
+ api.getRanksAPI().addInheritance(rank1, rank3);
+ assertEquals(2, api.getRanksAPI().getInheritances(rank1).size());
+
+ api.getRanksAPI().removeInheritance(rank1, rank2);
+ assertEquals(1, api.getRanksAPI().getInheritances(rank1).size());
+
+ TestDebugger.log(this, "[G_Inheritances] OK");
+
+ }
+}
diff --git a/src/test/java/nl/svenar/powerranks/test/util/TestDebugger.java b/API/src/test/java/nl/svenar/powerranks/test/util/TestDebugger.java
similarity index 100%
rename from src/test/java/nl/svenar/powerranks/test/util/TestDebugger.java
rename to API/src/test/java/nl/svenar/powerranks/test/util/TestDebugger.java
diff --git a/Bukkit/pom.xml b/Bukkit/pom.xml
new file mode 100644
index 00000000..77302cb1
--- /dev/null
+++ b/Bukkit/pom.xml
@@ -0,0 +1,222 @@
+
+ 4.0.0
+ nl.svenar
+ powerranks.bukkit
+ ${revision}
+ PowerRanks Bukkit
+ Rank-based permission manager
+
+
+ 1.8
+ UTF-8
+ src/main/java
+ src/main/resources
+ nl.svenar.lib
+ false
+
+
+
+ nl.svenar
+ powerranks
+ ${revision}
+
+
+
+ clean compile package
+ ${output.name}
+ ${src.dir}
+
+
+ ${rsc.dir}
+ true
+
+
+
+
+ maven-compiler-plugin
+ 3.8.0
+
+
+ ${java.version}
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.1.0
+
+ true
+ false
+ false
+ false
+ false
+
+
+ *:*
+
+ META-INF/license/**
+ META-INF/*
+ META-INF/maven/**
+ META-INF/versions/*/module-info.class
+ LICENSE
+ NOTICE
+ /*.txt
+ build.properties
+ com/fasterxml/jackson/databind/ext/Java7*
+
+
+
+
+
+ nl.svenar:powerranks.core
+ nl.svenar:powerranks.api
+ com.squareup.okhttp3:okhttp
+ com.squareup.okio:okio
+ org.jetbrains.kotlin:kotlin-stdlib
+ org.yaml:snakeyaml
+ com.fasterxml.jackson.core:jackson-core
+ com.fasterxml.jackson.core:jackson-databind
+ com.fasterxml.jackson.core:jackson-annotations
+ com.fasterxml.jackson.dataformat:jackson-dataformat-yaml
+ com.googlecode.json-simple:json-simple
+ com.googlecode.json-simple:json-simple
+
+
+
+
+ okhttp3
+ ${shade.basepattern}.okhttp3
+
+
+ okio
+ ${shade.basepattern}.okio
+
+
+ kotlin
+ ${shade.basepattern}.kotlin
+
+
+ org.yaml
+ ${shade.basepattern}.yaml
+
+
+ com.fasterxml
+ ${shade.basepattern}.fasterxml
+
+
+ org.json
+ ${shade.basepattern}.json
+
+
+ target/reduced-pom.xml
+
+
+
+ package
+
+ shade
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.3.1
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.2.1
+
+ ${skipBukkitTests}
+
+
+
+
+
+
+
+ spigotmc-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
+
+ placeholderapi
+ https://repo.extendedclip.com/content/repositories/placeholderapi/
+
+
+ jitpack.io
+ https://jitpack.io
+
+
+ svenar
+ https://svenar.nl/repo/
+
+
+ papermc
+ https://repo.papermc.io/repository/maven-public/
+
+
+
+
+
+ nl.svenar
+ powerranks.core
+ ${revision}
+
+
+ nl.svenar
+ powerranks.api
+ ${revision}
+
+
+
+ com.github.seeseemelk
+ MockBukkit-v1.20
+ 3.39.0
+ test
+
+
+
+ me.clip.deluxetags
+ deluxetags
+ 1.8.2
+ provided
+
+
+ me.clip
+ placeholderapi
+ 2.11.4
+ provided
+
+
+ com.github.MilkBowl
+ VaultAPI
+ 1.7.1
+ provided
+
+
+ org.bukkit
+ bukkit
+
+
+
+
+ org.spigotmc
+ spigot-api
+ 1.20.2-R0.1-SNAPSHOT
+ provided
+
+
+ com.nametagedit
+ nametagedit
+ 4.5.20
+
+
+
\ No newline at end of file
diff --git a/src/main/java/nl/svenar/powerranks/PowerRanks.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/PowerRanks.java
similarity index 89%
rename from src/main/java/nl/svenar/powerranks/PowerRanks.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/PowerRanks.java
index 117fc990..750a4b23 100644
--- a/src/main/java/nl/svenar/powerranks/PowerRanks.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/PowerRanks.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks;
+package nl.svenar.powerranks.bukkit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -9,11 +9,13 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.Set;
import java.util.Map.Entry;
import java.util.UUID;
import java.util.concurrent.Callable;
import org.bukkit.permissions.PermissionAttachment;
+import org.bukkit.permissions.PermissionAttachmentInfo;
import java.io.OutputStream;
import java.lang.reflect.Field;
@@ -39,48 +41,49 @@
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitScheduler;
-import nl.svenar.common.PowerLogger;
-import nl.svenar.common.storage.PowerConfigManager;
-import nl.svenar.common.storage.provided.YAMLConfigManager;
-import nl.svenar.common.structure.PRPermission;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.common.utils.PRUtil;
-import nl.svenar.common.utils.PowerColor;
-import nl.svenar.powerranks.addons.AddonsManager;
+import nl.svenar.powerranks.common.PowerLogger;
+import nl.svenar.powerranks.common.storage.PermissionRegistry;
+import nl.svenar.powerranks.common.storage.PowerConfigManager;
+import nl.svenar.powerranks.common.storage.provided.YAMLConfigManager;
+import nl.svenar.powerranks.common.structure.PRPermission;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.common.utils.PowerColor;
+import nl.svenar.powerranks.bukkit.addons.AddonsManager;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.cache.LanguageManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommandHandler;
+import nl.svenar.powerranks.bukkit.data.BungeecordManager;
+import nl.svenar.powerranks.bukkit.data.Messages;
+import nl.svenar.powerranks.bukkit.data.PowerPermissibleBase;
+import nl.svenar.powerranks.bukkit.data.PowerRanksVerbose;
+import nl.svenar.powerranks.bukkit.data.TablistManager;
+import nl.svenar.powerranks.bukkit.data.Users;
+import nl.svenar.powerranks.bukkit.events.ChatTabExecutor;
+import nl.svenar.powerranks.bukkit.events.OnBlockChange;
+import nl.svenar.powerranks.bukkit.events.OnChat;
+import nl.svenar.powerranks.bukkit.events.OnInteract;
+import nl.svenar.powerranks.bukkit.events.OnInventory;
+import nl.svenar.powerranks.bukkit.events.OnJoin;
+import nl.svenar.powerranks.bukkit.events.OnMove;
+import nl.svenar.powerranks.bukkit.events.OnPreCommand;
+import nl.svenar.powerranks.bukkit.events.OnSignChanged;
+import nl.svenar.powerranks.bukkit.events.OnWorldChange;
+import nl.svenar.powerranks.bukkit.external.DeluxeTagsHook;
+import nl.svenar.powerranks.bukkit.external.PowerRanksExpansion;
+import nl.svenar.powerranks.bukkit.external.VaultHook;
+import nl.svenar.powerranks.bukkit.gui.GUI;
+import nl.svenar.powerranks.bukkit.metrics.Metrics;
+import nl.svenar.powerranks.bukkit.update.ConfigFilesUpdater;
+import nl.svenar.powerranks.bukkit.update.Updater;
+import nl.svenar.powerranks.bukkit.update.Updater.UpdateResult;
+import nl.svenar.powerranks.bukkit.update.Updater.UpdateType;
+import nl.svenar.powerranks.bukkit.util.BukkitPowerColor;
+import nl.svenar.powerranks.bukkit.util.Util;
+
import nl.svenar.powerranks.api.PowerRanksAPI;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.cache.LanguageManager;
-import nl.svenar.powerranks.commands.PowerCommandHandler;
-import nl.svenar.powerranks.data.BungeecordManager;
-import nl.svenar.powerranks.data.Messages;
-import nl.svenar.powerranks.data.PowerPermissibleBase;
-import nl.svenar.powerranks.data.PowerRanksVerbose;
-import nl.svenar.powerranks.data.TablistManager;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.events.ChatTabExecutor;
-import nl.svenar.powerranks.events.OnBlockChange;
-import nl.svenar.powerranks.events.OnChat;
-import nl.svenar.powerranks.events.OnInteract;
-import nl.svenar.powerranks.events.OnInventory;
-import nl.svenar.powerranks.events.OnJoin;
-import nl.svenar.powerranks.events.OnMove;
-import nl.svenar.powerranks.events.OnPreCommand;
-import nl.svenar.powerranks.events.OnSignChanged;
-import nl.svenar.powerranks.events.OnWorldChange;
-import nl.svenar.powerranks.external.DeluxeTagsHook;
-import nl.svenar.powerranks.external.PowerRanksExpansion;
-import nl.svenar.powerranks.external.TABHook;
-import nl.svenar.powerranks.external.VaultHook;
-import nl.svenar.powerranks.gui.GUI;
-import nl.svenar.powerranks.metrics.Metrics;
-import nl.svenar.powerranks.update.ConfigFilesUpdater;
-import nl.svenar.powerranks.update.Updater;
-import nl.svenar.powerranks.update.Updater.UpdateResult;
-import nl.svenar.powerranks.update.Updater.UpdateType;
-import nl.svenar.powerranks.util.BukkitPowerColor;
-import nl.svenar.powerranks.util.Util;
import com.google.common.collect.ImmutableMap;
import com.nametagedit.plugin.NametagEdit;
@@ -111,6 +114,7 @@ public class PowerRanks extends JavaPlugin implements Listener {
private static PowerConfigManager tablistConfigManager;
private BungeecordManager bungeecordManager;
+ private PermissionRegistry permissionRegistry;
// Soft Dependencies
private VaultHook vaultHook;
@@ -119,7 +123,6 @@ public class PowerRanks extends JavaPlugin implements Listener {
public static boolean vaultEconomyEnabled = false;
public static boolean vaultPermissionsEnabled = false;
public static PowerRanksExpansion placeholderapiExpansion;
- public static TABHook plugin_hook_tab;
public static boolean plugin_hook_deluxetags = false;
public static boolean plugin_hook_nametagedit = false;
// Soft Dependencies
@@ -146,7 +149,6 @@ public void onEnable() {
Instant startTime = Instant.now();
PowerRanks.log = this.getLogger();
- PowerRanksAPI.plugin = this;
ConfigFilesUpdater.updateOldDataFiles();
@@ -174,7 +176,7 @@ public void onEnable() {
new Messages(this);
new PowerRanksVerbose(this);
- this.createDir(PowerRanks.fileLoc);
+ PRUtil.createDir(PowerRanks.fileLoc);
PowerRanks.log.info("Loading config file");
configManager = new YAMLConfigManager(PowerRanks.fileLoc, "config.yml", "config.yml");
@@ -191,6 +193,11 @@ public void onEnable() {
addonsManager = new AddonsManager(this);
addonsManager.setup();
+ permissionRegistry = new PermissionRegistry();
+ for (PermissionAttachmentInfo pai : Bukkit.getConsoleSender().getEffectivePermissions()) {
+ permissionRegistry.queuePermission(pai.getPermission());
+ }
+
PowerRanks.log.info("");
PowerRanks.log.info("=== ----------- LOADING DATA ----------- ===");
PowerRanks.log.info("Loading player & rank data");
@@ -249,8 +256,12 @@ public void onEnable() {
}
public void onDisable() {
- this.tablistManager.stop();
- this.bungeecordManager.stop();
+ if (this.tablistManager != null) {
+ this.tablistManager.stop();
+ }
+ if (this.bungeecordManager != null) {
+ this.bungeecordManager.stop();
+ }
Bukkit.getServer().getScheduler().cancelTasks(this);
@@ -439,26 +450,12 @@ public void run() {
}
}.runTaskTimer(this, update_check_interval, update_check_interval);
- // new BukkitRunnable() {
- // @Override
- // public void run() {
- // PowerRanksVerbose.log("task", "Running task check player name change");
-
- // for (Player player : Bukkit.getServer().getOnlinePlayers()) {
- // if (!playerNameCache.containsKey(player.getUniqueId())) {
- // playerNameCache.put(player.getUniqueId(), player.getName());
- // }
-
- // if (!playerNameCache.get(player.getUniqueId()).equals(player.getName())) {
- // log.info("Player name changed from '" +
- // playerNameCache.get(player.getUniqueId()) + "' to '" + player.getName() +
- // "'");
- // playerNameCache.put(player.getUniqueId(), player.getName());
- // CacheManager.getPlayer(player.getUniqueId().toString()).setName(player.getName());
- // }
- // }
- // }
- // }.runTaskTimer(this, TASK_TPS, TASK_TPS);
+ new BukkitRunnable() {
+ @Override
+ public void run() {
+ permissionRegistry.tick();
+ }
+ }.runTaskTimer(this, 1, 1);
}
private Player getPlayerFromUUID(UUID uuid) {
@@ -627,7 +624,7 @@ public void run() {
prPlayername = Util.getNameFromAPI(prPlayer.getUUID().toString());
}
- getServer().getConsoleSender().sendMessage(Util.powerFormatter(
+ getServer().getConsoleSender().sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage("general.player-rank-expired-console"),
ImmutableMap.builder()
@@ -641,7 +638,7 @@ public void run() {
PowerRanks.getInstance().updateTablistName(player);
PowerRanks.getInstance().getTablistManager().updateSorting(player);
- player.sendMessage(Util.powerFormatter(
+ player.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage("general.player-rank-has-expired"),
ImmutableMap.builder()
@@ -669,10 +666,6 @@ public void run() {
}.runTaskTimer(this, Util.TASK_TPS, Util.TASK_TPS * 10);
}
- public TABHook getTABHook() {
- return plugin_hook_tab;
- }
-
public DeluxeTagsHook getDeluxeTagsHook() {
return this.deluxeTagsHook;
}
@@ -821,30 +814,13 @@ public boolean configContainsKey(String path) {
return configYaml.isSet(path);
}
- public void createDir(final String path) {
- final File file = new File(path);
- if (!file.exists()) {
- file.mkdirs();
- }
- }
-
- private boolean deleteDir(File directoryToBeDeleted) {
- File[] allContents = directoryToBeDeleted.listFiles();
- if (allContents != null) {
- for (File file : allContents) {
- this.deleteDir(file);
- }
- }
- return directoryToBeDeleted.delete();
- }
-
public void factoryReset(CommandSender sender) {
CacheManager.setRanks(new ArrayList());
CacheManager.setPlayers(new ArrayList());
- this.deleteDir(new File(PowerRanks.fileLoc));
- this.createDir(PowerRanks.fileLoc);
+ PRUtil.deleteDir(new File(PowerRanks.fileLoc));
+ PRUtil.createDir(PowerRanks.fileLoc);
configManager = new YAMLConfigManager(PowerRanks.fileLoc, "config.yml", "config.yml");
languageManager = new LanguageManager();
@@ -896,11 +872,15 @@ public void copy(final InputStream in, final File file) {
}
public void playerInjectPermissible(Player player) {
+ if (isMockBukkitLoaded()) {
+ return;
+ }
try {
Field f = Util.obcClass("entity.CraftHumanEntity").getDeclaredField("perm");
f.setAccessible(true);
f.set(player, new PowerPermissibleBase(player, this));
f.setAccessible(false);
+ // } catch (ClassNotFoundException e) {
} catch (Exception e) {
e.printStackTrace();
}
@@ -930,7 +910,7 @@ public void run() {
prefix_format = prefix.length() == 0 ? prefix_format.replaceAll("\\[prefix\\]( )?", "")
: prefix_format;
- prefix_format = Util.powerFormatter(prefix_format,
+ prefix_format = PRUtil.powerFormatter(prefix_format,
ImmutableMap.builder()
.put("prefix", prefix)
.put("usertag", !PowerRanks.plugin_hook_deluxetags ? usertag
@@ -940,7 +920,7 @@ public void run() {
suffix_format = suffix.length() == 0 ? suffix_format.replaceAll("( )?\\[suffix\\]", "")
: suffix_format;
- suffix_format = Util.powerFormatter(suffix_format,
+ suffix_format = PRUtil.powerFormatter(suffix_format,
ImmutableMap.builder()
.put("suffix", suffix)
.put("usertag",
@@ -968,14 +948,16 @@ public void run() {
}
public void updateTablistName(Player player) {
- try {
- player.updateCommands(); // TODO find a better place for this
- } catch (NoSuchMethodError e) {
+ if (!isMockBukkitLoaded()) {
+ try {
+ player.updateCommands(); // TODO find a better place for this
+ } catch (NoSuchMethodError e) {
+ }
}
PRPlayer prPlayer = CacheManager.getPlayer(player);
- List playerRanks = prPlayer.getRanks();
+ Set playerRanks = prPlayer.getRanks();
List ranks = new ArrayList();
for (PRPlayerRank playerRank : playerRanks) {
@@ -1019,7 +1001,7 @@ public void updateTablistName(Player player) {
}
Map, ?> availableUsertags = getUsertagManager().getMap("usertags", new HashMap());
- ArrayList playerUsertags = prPlayer.getUsertags();
+ Set playerUsertags = prPlayer.getUsertags();
for (String playerUsertag : playerUsertags) {
String value = "";
@@ -1045,6 +1027,11 @@ public void updateTablistName(Player player, String prefix, String suffix,
String usertag, String nameColor, boolean updateNTE) {
PowerRanksVerbose.log("updateTablistName", "Updating " + player.getName() + "'s tablist format");
+ PRPlayer prPlayer = CacheManager.getPlayer(player);
+ if (prPlayer.getNickname().length() > 0) {
+ player.setDisplayName(prPlayer.getNickname().length() > 0 ? prPlayer.getNickname() : player.getName());
+ }
+
String player_formatted_name = (nameColor.length() == 0 ? "&r" : "")
+ applyMultiColorFlow(nameColor, player.getDisplayName());
@@ -1069,7 +1056,7 @@ public void updateTablistName(Player player, String prefix, String suffix,
format = tmp_format;
}
- format = Util.powerFormatter(format,
+ format = PRUtil.powerFormatter(format,
ImmutableMap.builder().put("prefix", prefix).put("suffix", suffix)
.put("usertag", usertag)
.put("player", player_formatted_name).put("world", player.getWorld().getName()).build(),
@@ -1128,10 +1115,6 @@ public static String applyMultiColorFlow(String rawColors, String text) {
return output;
}
- public PowerRanksAPI loadAPI() {
- return new PowerRanksAPI();
- }
-
public void updatePlaytime(Player player, long join_time, long leave_time, boolean write_to_file) {
long current_playtime = CacheManager.getPlayer(player.getUniqueId().toString()).getPlaytime();
@@ -1202,6 +1185,10 @@ public static BukkitPowerColor getPowerColor() {
return powerColor;
}
+ public static PowerRanksAPI getAPI() {
+ return new PowerRanksAPI();
+ }
+
public static PowerRanks getInstance() {
return instance;
}
@@ -1209,4 +1196,17 @@ public static PowerRanks getInstance() {
public static String getVersion() {
return instance.getDescription().getVersion();
}
+
+ private boolean isMockBukkitLoaded() {
+ try {
+ Class.forName("be.seeseemelk.mockbukkit.MockBukkit");
+ return true;
+ } catch (ClassNotFoundException e) {
+ return false;
+ }
+ }
+
+ public PermissionRegistry getPermissionRegistry() {
+ return permissionRegistry;
+ }
}
diff --git a/src/main/java/nl/svenar/powerranks/addons/AddonDownloader.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/AddonDownloader.java
similarity index 92%
rename from src/main/java/nl/svenar/powerranks/addons/AddonDownloader.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/AddonDownloader.java
index 6863caab..e1c3e6a6 100644
--- a/src/main/java/nl/svenar/powerranks/addons/AddonDownloader.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/AddonDownloader.java
@@ -1,11 +1,11 @@
-package nl.svenar.powerranks.addons;
+package nl.svenar.powerranks.bukkit.addons;
import java.util.ArrayList;
import java.util.List;
import com.google.gson.Gson;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.util.Util;
public class AddonDownloader {
private String addonsURL = "http://addons.powerranks.nl/addons.json";
diff --git a/src/main/java/nl/svenar/powerranks/addons/AddonsManager.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/AddonsManager.java
similarity index 96%
rename from src/main/java/nl/svenar/powerranks/addons/AddonsManager.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/AddonsManager.java
index 4028f97e..7ea1c280 100644
--- a/src/main/java/nl/svenar/powerranks/addons/AddonsManager.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/AddonsManager.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.addons;
+package nl.svenar.powerranks.bukkit.addons;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
@@ -8,8 +8,8 @@
import java.util.List;
import java.util.Map.Entry;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.util.Util;
public class AddonsManager {
diff --git a/src/main/java/nl/svenar/powerranks/addons/DownloadableAddon.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/DownloadableAddon.java
similarity index 93%
rename from src/main/java/nl/svenar/powerranks/addons/DownloadableAddon.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/DownloadableAddon.java
index 9e68473c..69fb220b 100644
--- a/src/main/java/nl/svenar/powerranks/addons/DownloadableAddon.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/DownloadableAddon.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.addons;
+package nl.svenar.powerranks.bukkit.addons;
import java.io.BufferedInputStream;
import java.io.File;
@@ -8,9 +8,9 @@
import java.net.URLConnection;
import java.util.ArrayList;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.addons.AddonDownloader.Addon;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.addons.AddonDownloader.Addon;
+import nl.svenar.powerranks.bukkit.util.Util;
public class DownloadableAddon {
diff --git a/src/main/java/nl/svenar/powerranks/addons/PowerRanksAddon.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/PowerRanksAddon.java
similarity index 96%
rename from src/main/java/nl/svenar/powerranks/addons/PowerRanksAddon.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/PowerRanksAddon.java
index d4efccb4..3f7e4d43 100644
--- a/src/main/java/nl/svenar/powerranks/addons/PowerRanksAddon.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/PowerRanksAddon.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.addons;
+package nl.svenar.powerranks.bukkit.addons;
import java.util.ArrayList;
import java.util.List;
@@ -7,9 +7,9 @@
import org.bukkit.World;
import org.bukkit.block.Block;
-import nl.svenar.common.storage.PowerStorageManager;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.events.ChatTabExecutor;
+import nl.svenar.powerranks.common.storage.PowerStorageManager;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.events.ChatTabExecutor;
public abstract class PowerRanksAddon {
diff --git a/src/main/java/nl/svenar/powerranks/addons/PowerRanksConfig.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/PowerRanksConfig.java
similarity index 98%
rename from src/main/java/nl/svenar/powerranks/addons/PowerRanksConfig.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/PowerRanksConfig.java
index 6b7bc654..7d239823 100644
--- a/src/main/java/nl/svenar/powerranks/addons/PowerRanksConfig.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/PowerRanksConfig.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.addons;
+package nl.svenar.powerranks.bukkit.addons;
import java.io.File;
import java.io.IOException;
@@ -9,7 +9,7 @@
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
-import nl.svenar.powerranks.PowerRanks;
+import nl.svenar.powerranks.bukkit.PowerRanks;
public class PowerRanksConfig {
diff --git a/src/main/java/nl/svenar/powerranks/addons/PowerRanksFileUtil.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/PowerRanksFileUtil.java
similarity index 96%
rename from src/main/java/nl/svenar/powerranks/addons/PowerRanksFileUtil.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/PowerRanksFileUtil.java
index 629464ef..183f9dfb 100644
--- a/src/main/java/nl/svenar/powerranks/addons/PowerRanksFileUtil.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/PowerRanksFileUtil.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.addons;
+package nl.svenar.powerranks.bukkit.addons;
import java.io.File;
import java.io.IOException;
diff --git a/src/main/java/nl/svenar/powerranks/addons/PowerRanksPlayer.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/PowerRanksPlayer.java
similarity index 87%
rename from src/main/java/nl/svenar/powerranks/addons/PowerRanksPlayer.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/PowerRanksPlayer.java
index 810dd229..4ad3c18b 100644
--- a/src/main/java/nl/svenar/powerranks/addons/PowerRanksPlayer.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/addons/PowerRanksPlayer.java
@@ -1,10 +1,9 @@
-package nl.svenar.powerranks.addons;
+package nl.svenar.powerranks.bukkit.addons;
import org.bukkit.entity.Player;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.api.PowerRanksAPI;
-import nl.svenar.powerranks.data.Users;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.data.Users;
public class PowerRanksPlayer {
@@ -12,7 +11,6 @@ public class PowerRanksPlayer {
private Player player;
private Users users;
private String name;
- private PowerRanksAPI api;
public PowerRanksPlayer(PowerRanks powerRanks, Player player) {
this.powerRanks = powerRanks;
@@ -20,14 +18,12 @@ public PowerRanksPlayer(PowerRanks powerRanks, Player player) {
this.users = new Users(this.powerRanks);
if (player != null)
name = player.getName();
- this.api = new PowerRanksAPI();
}
public PowerRanksPlayer(PowerRanks powerRanks, String name) {
this.powerRanks = powerRanks;
this.name = name;
this.users = new Users(this.powerRanks);
- this.api = new PowerRanksAPI();
}
public PowerRanks getPowerRanks() {
@@ -49,10 +45,6 @@ public String getRank() {
return users.getPrimaryRank(getPlayer());
}
- public PowerRanksAPI getAPI() {
- return api;
- }
-
// // Set the users rank
// // Arguments: rankname(as registered in powerRanks)
// // Returns: boolean (true on success & false on fail)
diff --git a/src/main/java/nl/svenar/powerranks/cache/CacheManager.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/cache/CacheManager.java
similarity index 87%
rename from src/main/java/nl/svenar/powerranks/cache/CacheManager.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/cache/CacheManager.java
index 09005337..7ae76e44 100755
--- a/src/main/java/nl/svenar/powerranks/cache/CacheManager.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/cache/CacheManager.java
@@ -1,30 +1,31 @@
-package nl.svenar.powerranks.cache;
+package nl.svenar.powerranks.bukkit.cache;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.Set;
import java.util.UUID;
import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
-import nl.svenar.common.storage.PowerConfigManager;
-import nl.svenar.common.storage.PowerSQLConfiguration;
-import nl.svenar.common.storage.PowerStorageManager;
-import nl.svenar.common.storage.provided.JSONStorageManager;
-import nl.svenar.common.storage.provided.MySQLStorageManager;
-import nl.svenar.common.storage.provided.PSMStorageManager;
-import nl.svenar.common.storage.provided.SQLiteStorageManager;
-import nl.svenar.common.storage.provided.YAMLStorageManager;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.common.utils.PRCache;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.addons.PowerRanksAddon;
-import nl.svenar.powerranks.events.OnJoin;
+import nl.svenar.powerranks.common.storage.PowerConfigManager;
+import nl.svenar.powerranks.common.storage.PowerSQLConfiguration;
+import nl.svenar.powerranks.common.storage.PowerStorageManager;
+import nl.svenar.powerranks.common.storage.provided.JSONStorageManager;
+import nl.svenar.powerranks.common.storage.provided.MySQLStorageManager;
+import nl.svenar.powerranks.common.storage.provided.PSMStorageManager;
+import nl.svenar.powerranks.common.storage.provided.SQLiteStorageManager;
+import nl.svenar.powerranks.common.storage.provided.YAMLStorageManager;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRCache;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksAddon;
+import nl.svenar.powerranks.bukkit.events.OnJoin;
public class CacheManager {
@@ -76,7 +77,7 @@ public static PRPlayer createPlayer(Player player) {
return PRCache.createPlayer(player.getName(), player.getUniqueId());
}
- public static List getDefaultRanks() {
+ public static Set getDefaultRanks() {
return PRCache.getDefaultRanks();
}
@@ -96,8 +97,8 @@ public static void load(String dataDirectory) {
PowerSQLConfiguration configuration = new PowerSQLConfiguration(pcm.getString("storage.mysql.host", "127.0.0.1"),
pcm.getInt("storage.mysql.port", 3306), pcm.getString("storage.mysql.database", "powerranks"),
pcm.getString("storage.mysql.username", "username"), pcm.getString("storage.mysql.password", "password"),
- pcm.getBool("storage.mysql.ssl", false), "ranks", "players", "messages");
- storageManager = new MySQLStorageManager(configuration, pcm.getBool("storage.mysql.verbose", false));
+ pcm.getBool("storage.mysql.ssl", false), "ranks", "players", "messages", pcm.getBool("storage.mysql.verbose", false));
+ storageManager = new MySQLStorageManager(configuration);
} else { // Default to yaml
PowerRanksAddon usedStorageManagerAddon = null;
diff --git a/src/main/java/nl/svenar/powerranks/cache/LanguageManager.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/cache/LanguageManager.java
similarity index 94%
rename from src/main/java/nl/svenar/powerranks/cache/LanguageManager.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/cache/LanguageManager.java
index 2499cc20..2e0be7e0 100644
--- a/src/main/java/nl/svenar/powerranks/cache/LanguageManager.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/cache/LanguageManager.java
@@ -1,13 +1,13 @@
-package nl.svenar.powerranks.cache;
+package nl.svenar.powerranks.bukkit.cache;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
-import nl.svenar.common.storage.PowerConfigManager;
-import nl.svenar.common.storage.provided.YAMLConfigManager;
-import nl.svenar.powerranks.PowerRanks;
+import nl.svenar.powerranks.common.storage.PowerConfigManager;
+import nl.svenar.powerranks.common.storage.provided.YAMLConfigManager;
+import nl.svenar.powerranks.bukkit.PowerRanks;
public class LanguageManager {
diff --git a/src/main/java/nl/svenar/powerranks/commands/PowerCommand.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/PowerCommand.java
similarity index 91%
rename from src/main/java/nl/svenar/powerranks/commands/PowerCommand.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/PowerCommand.java
index 4f63a326..d1b3845c 100644
--- a/src/main/java/nl/svenar/powerranks/commands/PowerCommand.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/PowerCommand.java
@@ -1,11 +1,11 @@
-package nl.svenar.powerranks.commands;
+package nl.svenar.powerranks.bukkit.commands;
import java.util.ArrayList;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
-import nl.svenar.powerranks.PowerRanks;
+import nl.svenar.powerranks.bukkit.PowerRanks;
public abstract class PowerCommand {
diff --git a/src/main/java/nl/svenar/powerranks/commands/PowerCommandHandler.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/PowerCommandHandler.java
similarity index 69%
rename from src/main/java/nl/svenar/powerranks/commands/PowerCommandHandler.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/PowerCommandHandler.java
index dc868954..aac6e369 100644
--- a/src/main/java/nl/svenar/powerranks/commands/PowerCommandHandler.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/PowerCommandHandler.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands;
+package nl.svenar.powerranks.bukkit.commands;
import java.io.File;
import java.util.ArrayList;
@@ -14,67 +14,68 @@
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.addons.PowerRanksAddon;
-import nl.svenar.powerranks.addons.PowerRanksPlayer;
-import nl.svenar.powerranks.commands.PowerCommand.COMMAND_EXECUTOR;
-import nl.svenar.powerranks.commands.addons.cmd_addoninfo;
-import nl.svenar.powerranks.commands.addons.cmd_addonmanager;
-import nl.svenar.powerranks.commands.addons.cmd_listaddons;
-import nl.svenar.powerranks.commands.buyable.cmd_addbuyablerank;
-import nl.svenar.powerranks.commands.buyable.cmd_buyrank;
-import nl.svenar.powerranks.commands.buyable.cmd_delbuyablerank;
-import nl.svenar.powerranks.commands.buyable.cmd_rankup;
-import nl.svenar.powerranks.commands.buyable.cmd_setbuycommand;
-import nl.svenar.powerranks.commands.buyable.cmd_setbuycost;
-import nl.svenar.powerranks.commands.buyable.cmd_setbuydescription;
-import nl.svenar.powerranks.commands.core.cmd_config;
-import nl.svenar.powerranks.commands.core.cmd_dump;
-import nl.svenar.powerranks.commands.core.cmd_factoryreset;
-import nl.svenar.powerranks.commands.core.cmd_help;
-import nl.svenar.powerranks.commands.core.cmd_pluginhook;
-import nl.svenar.powerranks.commands.core.cmd_reload;
-import nl.svenar.powerranks.commands.core.cmd_stats;
-import nl.svenar.powerranks.commands.core.cmd_tablist;
-import nl.svenar.powerranks.commands.core.cmd_verbose;
-import nl.svenar.powerranks.commands.player.cmd_addownrank;
-import nl.svenar.powerranks.commands.player.cmd_addplayerperm;
-import nl.svenar.powerranks.commands.player.cmd_addrank;
-import nl.svenar.powerranks.commands.player.cmd_checkrank;
-import nl.svenar.powerranks.commands.player.cmd_delplayerperm;
-import nl.svenar.powerranks.commands.player.cmd_delrank;
-import nl.svenar.powerranks.commands.player.cmd_haspermission;
-import nl.svenar.powerranks.commands.player.cmd_listplayerpermissions;
-import nl.svenar.powerranks.commands.player.cmd_playerinfo;
-import nl.svenar.powerranks.commands.player.cmd_setownrank;
-import nl.svenar.powerranks.commands.player.cmd_setrank;
-import nl.svenar.powerranks.commands.rank.cmd_addinheritance;
-import nl.svenar.powerranks.commands.rank.cmd_addperm;
-import nl.svenar.powerranks.commands.rank.cmd_createrank;
-import nl.svenar.powerranks.commands.rank.cmd_deleterank;
-import nl.svenar.powerranks.commands.rank.cmd_delinheritance;
-import nl.svenar.powerranks.commands.rank.cmd_delperm;
-import nl.svenar.powerranks.commands.rank.cmd_listdefaultranks;
-import nl.svenar.powerranks.commands.rank.cmd_listpermissions;
-import nl.svenar.powerranks.commands.rank.cmd_listranks;
-import nl.svenar.powerranks.commands.rank.cmd_rankinfo;
-import nl.svenar.powerranks.commands.rank.cmd_renamerank;
-import nl.svenar.powerranks.commands.rank.cmd_setchatcolor;
-import nl.svenar.powerranks.commands.rank.cmd_setdefault;
-import nl.svenar.powerranks.commands.rank.cmd_setnamecolor;
-import nl.svenar.powerranks.commands.rank.cmd_setprefix;
-import nl.svenar.powerranks.commands.rank.cmd_setsuffix;
-import nl.svenar.powerranks.commands.rank.cmd_setweight;
-import nl.svenar.powerranks.commands.test.cmd_test;
-import nl.svenar.powerranks.commands.usertags.cmd_addusertag;
-import nl.svenar.powerranks.commands.usertags.cmd_clearusertag;
-import nl.svenar.powerranks.commands.usertags.cmd_createusertag;
-import nl.svenar.powerranks.commands.usertags.cmd_delusertag;
-import nl.svenar.powerranks.commands.usertags.cmd_editusertag;
-import nl.svenar.powerranks.commands.usertags.cmd_listusertags;
-import nl.svenar.powerranks.commands.usertags.cmd_removeusertag;
-import nl.svenar.powerranks.commands.usertags.cmd_setusertag;
-import nl.svenar.powerranks.commands.webeditor.cmd_webeditor;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksAddon;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksPlayer;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand.COMMAND_EXECUTOR;
+import nl.svenar.powerranks.bukkit.commands.addons.cmd_addoninfo;
+import nl.svenar.powerranks.bukkit.commands.addons.cmd_addonmanager;
+import nl.svenar.powerranks.bukkit.commands.addons.cmd_listaddons;
+import nl.svenar.powerranks.bukkit.commands.buyable.cmd_addbuyablerank;
+import nl.svenar.powerranks.bukkit.commands.buyable.cmd_buyrank;
+import nl.svenar.powerranks.bukkit.commands.buyable.cmd_delbuyablerank;
+import nl.svenar.powerranks.bukkit.commands.buyable.cmd_rankup;
+import nl.svenar.powerranks.bukkit.commands.buyable.cmd_setbuycommand;
+import nl.svenar.powerranks.bukkit.commands.buyable.cmd_setbuycost;
+import nl.svenar.powerranks.bukkit.commands.buyable.cmd_setbuydescription;
+import nl.svenar.powerranks.bukkit.commands.core.cmd_config;
+import nl.svenar.powerranks.bukkit.commands.core.cmd_dump;
+import nl.svenar.powerranks.bukkit.commands.core.cmd_factoryreset;
+import nl.svenar.powerranks.bukkit.commands.core.cmd_help;
+import nl.svenar.powerranks.bukkit.commands.core.cmd_pluginhook;
+import nl.svenar.powerranks.bukkit.commands.core.cmd_reload;
+import nl.svenar.powerranks.bukkit.commands.core.cmd_stats;
+import nl.svenar.powerranks.bukkit.commands.core.cmd_tablist;
+import nl.svenar.powerranks.bukkit.commands.core.cmd_verbose;
+import nl.svenar.powerranks.bukkit.commands.player.cmd_addownrank;
+import nl.svenar.powerranks.bukkit.commands.player.cmd_addplayerperm;
+import nl.svenar.powerranks.bukkit.commands.player.cmd_addrank;
+import nl.svenar.powerranks.bukkit.commands.player.cmd_checkrank;
+import nl.svenar.powerranks.bukkit.commands.player.cmd_delplayerperm;
+import nl.svenar.powerranks.bukkit.commands.player.cmd_delrank;
+import nl.svenar.powerranks.bukkit.commands.player.cmd_haspermission;
+import nl.svenar.powerranks.bukkit.commands.player.cmd_listplayerpermissions;
+import nl.svenar.powerranks.bukkit.commands.player.cmd_nick;
+import nl.svenar.powerranks.bukkit.commands.player.cmd_playerinfo;
+import nl.svenar.powerranks.bukkit.commands.player.cmd_setownrank;
+import nl.svenar.powerranks.bukkit.commands.player.cmd_setrank;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_addinheritance;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_addperm;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_createrank;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_deleterank;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_delinheritance;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_delperm;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_listdefaultranks;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_listpermissions;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_listranks;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_rankinfo;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_renamerank;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_setchatcolor;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_setdefault;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_setnamecolor;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_setprefix;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_setsuffix;
+import nl.svenar.powerranks.bukkit.commands.rank.cmd_setweight;
+import nl.svenar.powerranks.bukkit.commands.test.cmd_test;
+import nl.svenar.powerranks.bukkit.commands.usertags.cmd_addusertag;
+import nl.svenar.powerranks.bukkit.commands.usertags.cmd_clearusertag;
+import nl.svenar.powerranks.bukkit.commands.usertags.cmd_createusertag;
+import nl.svenar.powerranks.bukkit.commands.usertags.cmd_delusertag;
+import nl.svenar.powerranks.bukkit.commands.usertags.cmd_editusertag;
+import nl.svenar.powerranks.bukkit.commands.usertags.cmd_listusertags;
+import nl.svenar.powerranks.bukkit.commands.usertags.cmd_removeusertag;
+import nl.svenar.powerranks.bukkit.commands.usertags.cmd_setusertag;
+import nl.svenar.powerranks.bukkit.commands.webeditor.cmd_webeditor;
public class PowerCommandHandler implements CommandExecutor {
@@ -112,6 +113,7 @@ public PowerCommandHandler(PowerRanks plugin) {
new cmd_listusertags(plugin, "listusertags", COMMAND_EXECUTOR.ALL);
new cmd_checkrank(plugin, "checkrank", COMMAND_EXECUTOR.ALL);
+ new cmd_nick(plugin, "nick", COMMAND_EXECUTOR.ALL);
new cmd_createrank(plugin, "createrank", COMMAND_EXECUTOR.ALL);
new cmd_deleterank(plugin, "deleterank", COMMAND_EXECUTOR.ALL);
diff --git a/src/main/java/nl/svenar/powerranks/commands/PowerSubCommand.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/PowerSubCommand.java
similarity index 85%
rename from src/main/java/nl/svenar/powerranks/commands/PowerSubCommand.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/PowerSubCommand.java
index 2ce9a9fc..67a291c8 100644
--- a/src/main/java/nl/svenar/powerranks/commands/PowerSubCommand.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/PowerSubCommand.java
@@ -1,12 +1,12 @@
-package nl.svenar.powerranks.commands;
+package nl.svenar.powerranks.bukkit.commands;
import org.bukkit.command.BlockCommandSender;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand.COMMAND_EXECUTOR;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand.COMMAND_EXECUTOR;
public abstract class PowerSubCommand {
diff --git a/src/main/java/nl/svenar/powerranks/commands/addons/cmd_addoninfo.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/addons/cmd_addoninfo.java
similarity index 90%
rename from src/main/java/nl/svenar/powerranks/commands/addons/cmd_addoninfo.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/addons/cmd_addoninfo.java
index 05215ca3..cc2bf0a2 100644
--- a/src/main/java/nl/svenar/powerranks/commands/addons/cmd_addoninfo.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/addons/cmd_addoninfo.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.addons;
+package nl.svenar.powerranks.bukkit.commands.addons;
import java.io.File;
import java.util.ArrayList;
@@ -6,10 +6,10 @@
import com.google.common.collect.ImmutableMap;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.addons.PowerRanksAddon;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksAddon;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.common.utils.PRUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@@ -52,7 +52,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
sender.sendMessage(ChatColor.BLUE + "===" + ChatColor.DARK_AQUA + "------------------------------"
+ ChatColor.BLUE + "===");
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed-addon-not-found"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/addons/cmd_addonmanager.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/addons/cmd_addonmanager.java
similarity index 87%
rename from src/main/java/nl/svenar/powerranks/commands/addons/cmd_addonmanager.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/addons/cmd_addonmanager.java
index bd832937..ece640e2 100644
--- a/src/main/java/nl/svenar/powerranks/commands/addons/cmd_addonmanager.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/addons/cmd_addonmanager.java
@@ -1,14 +1,14 @@
-package nl.svenar.powerranks.commands.addons;
+package nl.svenar.powerranks.bukkit.commands.addons;
import java.util.ArrayList;
import com.google.common.collect.ImmutableMap;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.addons.DownloadableAddon;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Messages;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.addons.DownloadableAddon;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Messages;
+import nl.svenar.powerranks.common.utils.PRUtil;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
@@ -31,7 +31,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
String addonmanagerCommand = args[0].toLowerCase();
if (addonmanagerCommand.equals("acceptterms")) {
PowerRanks.getConfigManager().setBool("addon_manager.accepted_terms", true);
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".terms-accepted"),
ImmutableMap.builder()
@@ -43,7 +43,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
if (addonmanagerCommand.equals("declineterms")) {
PowerRanks.getConfigManager().setBool("addon_manager.accepted_terms", false);
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".terms-declined"),
ImmutableMap.builder()
@@ -74,7 +74,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
}
if (addon == null) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".download-not-available"),
ImmutableMap.builder()
@@ -88,7 +88,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
if (addon.isCompatible()) {
if (addon.download()) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".download-complete"),
ImmutableMap.builder()
@@ -97,7 +97,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".download-failed"),
ImmutableMap.builder()
@@ -107,7 +107,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
'[', ']'));
}
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".download-incompatible"),
ImmutableMap.builder()
@@ -116,7 +116,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
'[', ']'));
}
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".download-not-available"),
ImmutableMap.builder()
@@ -140,7 +140,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
if (addon != null) {
addon.uninstall();
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".uninstall-complete"),
ImmutableMap.builder()
@@ -149,7 +149,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed-addon-not-found"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/addons/cmd_listaddons.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/addons/cmd_listaddons.java
similarity index 95%
rename from src/main/java/nl/svenar/powerranks/commands/addons/cmd_listaddons.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/addons/cmd_listaddons.java
index 41e0f4fd..fcc00ad1 100644
--- a/src/main/java/nl/svenar/powerranks/commands/addons/cmd_listaddons.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/addons/cmd_listaddons.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.addons;
+package nl.svenar.powerranks.bukkit.commands.addons;
import java.util.ArrayList;
import java.util.Collection;
@@ -8,10 +8,10 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.addons.PowerRanksAddon;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksAddon;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.util.Util;
public class cmd_listaddons extends PowerCommand {
diff --git a/src/main/java/nl/svenar/powerranks/commands/buyable/cmd_addbuyablerank.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_addbuyablerank.java
similarity index 84%
rename from src/main/java/nl/svenar/powerranks/commands/buyable/cmd_addbuyablerank.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_addbuyablerank.java
index 60993088..2c1e87db 100644
--- a/src/main/java/nl/svenar/powerranks/commands/buyable/cmd_addbuyablerank.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_addbuyablerank.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.buyable;
+package nl.svenar.powerranks.bukkit.commands.buyable;
import java.util.ArrayList;
@@ -8,12 +8,12 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_addbuyablerank extends PowerCommand {
@@ -34,7 +34,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final boolean success = this.users.addBuyableRank(rankname, rankname2);
if (CacheManager.getRank(rankname) != null && CacheManager.getRank(rankname2) != null) {
if (success) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-add"),
ImmutableMap.builder()
@@ -44,7 +44,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed-add"),
ImmutableMap.builder()
@@ -55,7 +55,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
'[', ']'));
}
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage("general.rank-not-found"),
ImmutableMap.builder()
.put("player", sender.getName())
diff --git a/src/main/java/nl/svenar/powerranks/commands/buyable/cmd_buyrank.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_buyrank.java
similarity index 85%
rename from src/main/java/nl/svenar/powerranks/commands/buyable/cmd_buyrank.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_buyrank.java
index 5ad68861..03f7d66b 100644
--- a/src/main/java/nl/svenar/powerranks/commands/buyable/cmd_buyrank.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_buyrank.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.buyable;
+package nl.svenar.powerranks.bukkit.commands.buyable;
import java.util.ArrayList;
@@ -8,15 +8,15 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Messages;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.external.VaultHook;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Messages;
+import nl.svenar.powerranks.bukkit.data.Users;
+import nl.svenar.powerranks.bukkit.external.VaultHook;
public class cmd_buyrank extends PowerCommand {
@@ -56,7 +56,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
PRPlayerRank playerRank = new PRPlayerRank(rank.getName());
CacheManager.getPlayer(player.getUniqueId().toString()).setRank(playerRank);
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-buy"),
ImmutableMap.builder()
@@ -78,7 +78,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
}
}
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed-buy-not-enough-money"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/buyable/cmd_delbuyablerank.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_delbuyablerank.java
similarity index 85%
rename from src/main/java/nl/svenar/powerranks/commands/buyable/cmd_delbuyablerank.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_delbuyablerank.java
index 21d11657..32ea1295 100644
--- a/src/main/java/nl/svenar/powerranks/commands/buyable/cmd_delbuyablerank.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_delbuyablerank.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.buyable;
+package nl.svenar.powerranks.bukkit.commands.buyable;
import java.util.ArrayList;
@@ -8,11 +8,11 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_delbuyablerank extends PowerCommand {
@@ -31,7 +31,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String rankname2 = this.users.getRankIgnoreCase(args[1]);
final boolean success = this.users.delBuyableRank(rankname, rankname2);
if (success) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-del"),
ImmutableMap.builder()
@@ -41,7 +41,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed-del"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/buyable/cmd_rankup.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_rankup.java
similarity index 79%
rename from src/main/java/nl/svenar/powerranks/commands/buyable/cmd_rankup.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_rankup.java
index 9e9e7632..e5367e16 100644
--- a/src/main/java/nl/svenar/powerranks/commands/buyable/cmd_rankup.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_rankup.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.buyable;
+package nl.svenar.powerranks.bukkit.commands.buyable;
import java.util.ArrayList;
@@ -6,10 +6,10 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.gui.GUI;
-import nl.svenar.powerranks.gui.GUIPage.GUI_PAGE_ID;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.gui.GUI;
+import nl.svenar.powerranks.bukkit.gui.GUIPage.GUI_PAGE_ID;
public class cmd_rankup extends PowerCommand {
diff --git a/src/main/java/nl/svenar/powerranks/commands/buyable/cmd_setbuycommand.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_setbuycommand.java
similarity index 84%
rename from src/main/java/nl/svenar/powerranks/commands/buyable/cmd_setbuycommand.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_setbuycommand.java
index 2313548f..d1fec5b9 100644
--- a/src/main/java/nl/svenar/powerranks/commands/buyable/cmd_setbuycommand.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_setbuycommand.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.buyable;
+package nl.svenar.powerranks.bukkit.commands.buyable;
import java.util.ArrayList;
@@ -8,11 +8,11 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_setbuycommand extends PowerCommand {
@@ -36,7 +36,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
buycommand = buycommand.substring(0, buycommand.length() - 1);
final boolean success = this.users.setBuyCommand(rankname, buycommand);
if (success) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-set"),
ImmutableMap.builder()
@@ -46,7 +46,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed-set"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/buyable/cmd_setbuycost.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_setbuycost.java
similarity index 84%
rename from src/main/java/nl/svenar/powerranks/commands/buyable/cmd_setbuycost.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_setbuycost.java
index fdd26eab..f40481b9 100644
--- a/src/main/java/nl/svenar/powerranks/commands/buyable/cmd_setbuycost.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_setbuycost.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.buyable;
+package nl.svenar.powerranks.bukkit.commands.buyable;
import java.util.ArrayList;
@@ -8,11 +8,11 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_setbuycost extends PowerCommand {
@@ -31,7 +31,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String cost = this.users.getRankIgnoreCase(args[1]);
final boolean success = this.users.setBuyCost(rankname, cost);
if (success) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-set"),
ImmutableMap.builder()
@@ -41,7 +41,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed-set"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/buyable/cmd_setbuydescription.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_setbuydescription.java
similarity index 84%
rename from src/main/java/nl/svenar/powerranks/commands/buyable/cmd_setbuydescription.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_setbuydescription.java
index c943291c..2c469e99 100644
--- a/src/main/java/nl/svenar/powerranks/commands/buyable/cmd_setbuydescription.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/buyable/cmd_setbuydescription.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.buyable;
+package nl.svenar.powerranks.bukkit.commands.buyable;
import java.util.ArrayList;
@@ -8,11 +8,11 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_setbuydescription extends PowerCommand {
@@ -36,7 +36,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
description = description.substring(0, description.length() - 1);
final boolean success = this.users.setBuyDescription(rankname, description);
if (success) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-set"),
ImmutableMap.builder()
@@ -46,7 +46,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed-set"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/core/cmd_config.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_config.java
similarity index 94%
rename from src/main/java/nl/svenar/powerranks/commands/core/cmd_config.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_config.java
index 7074d055..ce89ad7b 100644
--- a/src/main/java/nl/svenar/powerranks/commands/core/cmd_config.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_config.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.core;
+package nl.svenar.powerranks.bukkit.commands.core;
import java.util.ArrayList;
import java.util.regex.Matcher;
@@ -6,9 +6,9 @@
import com.google.common.collect.ImmutableMap;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.common.utils.PRUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -55,7 +55,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
this.plugin.updateAllPlayersTABlist();
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".removed-world-tag"),
ImmutableMap.builder()
@@ -72,7 +72,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
boolean enable = args[0].equalsIgnoreCase("enable");
if (args[1].equalsIgnoreCase("chat_formatting")) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".state-changed"),
ImmutableMap.builder()
@@ -87,7 +87,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
PowerRanks.getConfigManager().setBool("chat.enabled", enable);
} else if (args[1].equalsIgnoreCase("tablist_formatting")) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".state-changed"),
ImmutableMap.builder()
@@ -103,7 +103,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
PowerRanks.getConfigManager().setBool("tablist_modification.enabled", enable);
} else if (args[1].equalsIgnoreCase("casesensitive_permissions")) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".state-changed"),
ImmutableMap.builder()
@@ -119,7 +119,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
PowerRanks.getConfigManager().setBool("general.case-sensitive-permissions", enable);
} else if (args[1].equalsIgnoreCase("op")) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".state-changed"),
ImmutableMap.builder()
@@ -135,7 +135,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
PowerRanks.getConfigManager().setBool("general.disable-op", !enable);
} else if (args[1].equalsIgnoreCase("bungeecord")) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".state-changed"),
ImmutableMap.builder()
@@ -167,7 +167,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
try {
int time = Integer.parseInt(args[2]);
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".state-changed"),
ImmutableMap.builder()
@@ -189,7 +189,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
}
} else if (args[1].equalsIgnoreCase("language")) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".state-changed"),
ImmutableMap.builder()
@@ -205,7 +205,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
PowerRanks.getConfigManager().setString("general.language", args[2]);
} else if (args[1].equalsIgnoreCase("bungeecord_server_name")) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".state-changed"),
ImmutableMap.builder()
@@ -224,7 +224,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
try {
int time = Integer.parseInt(args[2]);
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".state-changed"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/core/cmd_dump.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_dump.java
similarity index 95%
rename from src/main/java/nl/svenar/powerranks/commands/core/cmd_dump.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_dump.java
index 0ee56d74..226d4b07 100644
--- a/src/main/java/nl/svenar/powerranks/commands/core/cmd_dump.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_dump.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.core;
+package nl.svenar.powerranks.bukkit.commands.core;
import java.io.File;
import java.time.Duration;
@@ -21,14 +21,14 @@
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitRunnable;
-import nl.svenar.common.http.DatabinClient;
-import nl.svenar.common.storage.PowerStorageManager;
-import nl.svenar.common.storage.provided.JSONStorageManager;
-import nl.svenar.common.utils.AsyncReadFile;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.PowerRanksVerbose;
+import nl.svenar.powerranks.common.http.DatabinClient;
+import nl.svenar.powerranks.common.storage.PowerStorageManager;
+import nl.svenar.powerranks.common.storage.provided.JSONStorageManager;
+import nl.svenar.powerranks.common.utils.AsyncReadFile;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.PowerRanksVerbose;
public class cmd_dump extends PowerCommand {
diff --git a/src/main/java/nl/svenar/powerranks/commands/core/cmd_factoryreset.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_factoryreset.java
similarity index 86%
rename from src/main/java/nl/svenar/powerranks/commands/core/cmd_factoryreset.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_factoryreset.java
index b3328b96..c355e6cc 100644
--- a/src/main/java/nl/svenar/powerranks/commands/core/cmd_factoryreset.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_factoryreset.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.core;
+package nl.svenar.powerranks.bukkit.commands.core;
import java.util.ArrayList;
@@ -6,9 +6,9 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Messages;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Messages;
public class cmd_factoryreset extends PowerCommand {
diff --git a/src/main/java/nl/svenar/powerranks/commands/core/cmd_help.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_help.java
similarity index 96%
rename from src/main/java/nl/svenar/powerranks/commands/core/cmd_help.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_help.java
index 2480c457..a77581ec 100644
--- a/src/main/java/nl/svenar/powerranks/commands/core/cmd_help.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_help.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.core;
+package nl.svenar.powerranks.bukkit.commands.core;
import java.util.ArrayList;
import java.util.List;
@@ -8,10 +8,10 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.LanguageManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.LanguageManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.util.Util;
public class cmd_help extends PowerCommand {
diff --git a/src/main/java/nl/svenar/powerranks/commands/core/cmd_pluginhook.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_pluginhook.java
similarity index 90%
rename from src/main/java/nl/svenar/powerranks/commands/core/cmd_pluginhook.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_pluginhook.java
index 452afa94..bf775b2c 100644
--- a/src/main/java/nl/svenar/powerranks/commands/core/cmd_pluginhook.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_pluginhook.java
@@ -1,14 +1,14 @@
-package nl.svenar.powerranks.commands.core;
+package nl.svenar.powerranks.bukkit.commands.core;
import java.util.ArrayList;
import java.util.HashMap;
import com.google.common.collect.ImmutableMap;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Messages;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Messages;
+import nl.svenar.powerranks.common.utils.PRUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -34,7 +34,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
&& PowerRanks.getConfigManager().getMap("plugin_hook", new HashMap()).keySet()
.contains(pluginname.toLowerCase())) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".state-changed"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/core/cmd_reload.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_reload.java
similarity index 94%
rename from src/main/java/nl/svenar/powerranks/commands/core/cmd_reload.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_reload.java
index 0eb894e9..9b896f38 100644
--- a/src/main/java/nl/svenar/powerranks/commands/core/cmd_reload.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_reload.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.core;
+package nl.svenar.powerranks.bukkit.commands.core;
import java.util.ArrayList;
@@ -6,10 +6,10 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.util.PluginReloader;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.util.PluginReloader;
public class cmd_reload extends PowerCommand {
diff --git a/src/main/java/nl/svenar/powerranks/commands/core/cmd_stats.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_stats.java
similarity index 77%
rename from src/main/java/nl/svenar/powerranks/commands/core/cmd_stats.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_stats.java
index 09768bdb..49802401 100644
--- a/src/main/java/nl/svenar/powerranks/commands/core/cmd_stats.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_stats.java
@@ -1,13 +1,13 @@
-package nl.svenar.powerranks.commands.core;
+package nl.svenar.powerranks.bukkit.commands.core;
import java.util.ArrayList;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Messages;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Messages;
public class cmd_stats extends PowerCommand {
diff --git a/src/main/java/nl/svenar/powerranks/commands/core/cmd_tablist.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_tablist.java
similarity index 96%
rename from src/main/java/nl/svenar/powerranks/commands/core/cmd_tablist.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_tablist.java
index 2299fef6..7a8a8783 100644
--- a/src/main/java/nl/svenar/powerranks/commands/core/cmd_tablist.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_tablist.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.core;
+package nl.svenar.powerranks.bukkit.commands.core;
import java.util.ArrayList;
import java.util.Arrays;
@@ -11,10 +11,9 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.utils.PRUtil;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
public class cmd_tablist extends PowerCommand {
@@ -39,7 +38,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
boolean enable = args[0].equalsIgnoreCase("enable");
if (args[1].equalsIgnoreCase("tablist_sorting")) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".state-changed"),
ImmutableMap.builder()
@@ -58,7 +57,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
PowerRanks.getInstance().getTablistManager().start();
} else if (args[1].equalsIgnoreCase("reverse_tablist_sorting")) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".state-changed"),
ImmutableMap.builder()
@@ -77,7 +76,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
PowerRanks.getInstance().getTablistManager().start();
} else if (args[1].equalsIgnoreCase("header_footer")) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".state-changed"),
ImmutableMap.builder()
@@ -112,7 +111,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
try {
int time = Integer.parseInt(args[2]);
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".state-changed"),
ImmutableMap.builder()
@@ -138,7 +137,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
try {
int time = Integer.parseInt(args[2]);
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".state-changed"),
ImmutableMap.builder()
@@ -249,7 +248,7 @@ private void handleAnimationCommand(CommandSender sender, Command cmd, String co
}
int time = Integer.parseInt(args[2]);
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".state-changed"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/core/cmd_verbose.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_verbose.java
similarity index 92%
rename from src/main/java/nl/svenar/powerranks/commands/core/cmd_verbose.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_verbose.java
index 55adfe61..3d416826 100644
--- a/src/main/java/nl/svenar/powerranks/commands/core/cmd_verbose.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/core/cmd_verbose.java
@@ -1,14 +1,14 @@
-package nl.svenar.powerranks.commands.core;
+package nl.svenar.powerranks.bukkit.commands.core;
import java.util.ArrayList;
import com.google.common.collect.ImmutableMap;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Messages;
-import nl.svenar.powerranks.data.PowerRanksVerbose;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Messages;
+import nl.svenar.powerranks.bukkit.data.PowerRanksVerbose;
+import nl.svenar.powerranks.common.utils.PRUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -59,7 +59,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
} else if (verboseType.equals("stop")) {
if (PowerRanksVerbose.USE_VERBOSE) {
PowerRanksVerbose.stop();
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".stopped"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/player/cmd_addownrank.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_addownrank.java
similarity index 84%
rename from src/main/java/nl/svenar/powerranks/commands/player/cmd_addownrank.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_addownrank.java
index 43bf2f58..489f1f8d 100644
--- a/src/main/java/nl/svenar/powerranks/commands/player/cmd_addownrank.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_addownrank.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.player;
+package nl.svenar.powerranks.bukkit.commands.player;
import java.util.ArrayList;
@@ -9,14 +9,14 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_addownrank extends PowerCommand {
@@ -55,7 +55,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.updateSorting(Bukkit.getPlayer(targetPlayer.getUUID()));
}
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-executor"),
@@ -65,7 +65,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-receiver"),
ImmutableMap.builder()
@@ -75,7 +75,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
'[', ']'));
} else {
if (targetPlayer != null && rank != null) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed-executor"),
diff --git a/src/main/java/nl/svenar/powerranks/commands/player/cmd_addplayerperm.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_addplayerperm.java
similarity index 83%
rename from src/main/java/nl/svenar/powerranks/commands/player/cmd_addplayerperm.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_addplayerperm.java
index a4c2a663..b436f5ef 100644
--- a/src/main/java/nl/svenar/powerranks/commands/player/cmd_addplayerperm.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_addplayerperm.java
@@ -1,21 +1,19 @@
-package nl.svenar.powerranks.commands.player;
+package nl.svenar.powerranks.bukkit.commands.player;
import java.util.ArrayList;
import com.google.common.collect.ImmutableMap;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
-import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionAttachmentInfo;
public class cmd_addplayerperm extends PowerCommand {
@@ -41,7 +39,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
}
final boolean result = this.users.addPlayerPermission(targetPlayerName, permission, allowed);
if (result) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -51,7 +49,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
@@ -81,8 +79,7 @@ public ArrayList tabCompleteEvent(CommandSender sender, String[] args) {
if (args.length == 2) {
// for (Permission pai : Bukkit.getServer().getPermissions()) {
- for (PermissionAttachmentInfo pai : Bukkit.getServer().getConsoleSender().getEffectivePermissions()) {
- String perm = pai.getPermission();
+ for (String perm : plugin.getPermissionRegistry().getPermissions()) {
String userInput = args[1];
String autocompletePermission = "";
diff --git a/src/main/java/nl/svenar/powerranks/commands/player/cmd_addrank.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_addrank.java
similarity index 86%
rename from src/main/java/nl/svenar/powerranks/commands/player/cmd_addrank.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_addrank.java
index e5c6a184..983533de 100644
--- a/src/main/java/nl/svenar/powerranks/commands/player/cmd_addrank.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_addrank.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.player;
+package nl.svenar.powerranks.bukkit.commands.player;
import java.util.ArrayList;
import java.util.Arrays;
@@ -10,14 +10,14 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_addrank extends PowerCommand {
@@ -72,7 +72,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.updateSorting(Bukkit.getPlayer(targetPlayer.getUUID()));
}
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-executor"),
@@ -82,7 +82,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
if (Bukkit.getPlayer(targetPlayer.getUUID()) != null) {
- Bukkit.getPlayer(targetPlayer.getUUID()).sendMessage(Util.powerFormatter(
+ Bukkit.getPlayer(targetPlayer.getUUID()).sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-receiver"),
ImmutableMap.builder()
@@ -92,7 +92,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
'[', ']'));
}
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed-already-has-rank"),
@@ -104,7 +104,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
}
} else {
if (targetPlayer != null && rank != null) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed-executor"),
diff --git a/src/main/java/nl/svenar/powerranks/commands/player/cmd_checkrank.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_checkrank.java
similarity index 85%
rename from src/main/java/nl/svenar/powerranks/commands/player/cmd_checkrank.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_checkrank.java
index 6a25bb2d..86dc317c 100644
--- a/src/main/java/nl/svenar/powerranks/commands/player/cmd_checkrank.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_checkrank.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.player;
+package nl.svenar.powerranks.bukkit.commands.player;
import java.util.ArrayList;
import java.util.List;
@@ -9,12 +9,12 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
public class cmd_checkrank extends PowerCommand {
@@ -35,7 +35,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
playerRanks.add(rank.getName());
}
if (playerRanks.size() > 0) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage("commands." + commandName.toLowerCase() + ".success-self"),
ImmutableMap.builder()
@@ -44,7 +44,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-self-none"),
@@ -65,7 +65,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
playerRanks.add(rank.getName());
}
if (playerRanks.size() > 0) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage("commands." + commandName.toLowerCase() + ".success-target"),
ImmutableMap.builder()
@@ -75,7 +75,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-target-none"),
@@ -86,7 +86,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
'[', ']'));
}
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage("general.player-not-found"),
ImmutableMap.builder()
.put("player", sender.getName())
diff --git a/src/main/java/nl/svenar/powerranks/commands/player/cmd_delplayerperm.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_delplayerperm.java
similarity index 86%
rename from src/main/java/nl/svenar/powerranks/commands/player/cmd_delplayerperm.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_delplayerperm.java
index 62634333..f144cbcd 100644
--- a/src/main/java/nl/svenar/powerranks/commands/player/cmd_delplayerperm.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_delplayerperm.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.player;
+package nl.svenar.powerranks.bukkit.commands.player;
import java.util.ArrayList;
@@ -8,13 +8,13 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRPermission;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPermission;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_delplayerperm extends PowerCommand {
@@ -34,7 +34,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String permission = args[1];
final boolean result = this.users.delPlayerPermission(target_player, permission);
if (result) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -44,7 +44,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/player/cmd_delrank.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_delrank.java
similarity index 85%
rename from src/main/java/nl/svenar/powerranks/commands/player/cmd_delrank.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_delrank.java
index fe961704..13ecd76d 100644
--- a/src/main/java/nl/svenar/powerranks/commands/player/cmd_delrank.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_delrank.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.player;
+package nl.svenar.powerranks.bukkit.commands.player;
import java.util.ArrayList;
@@ -9,14 +9,14 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_delrank extends PowerCommand {
@@ -63,7 +63,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.updateSorting(Bukkit.getPlayer(targetPlayer.getUUID()));
}
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-executor"),
@@ -74,7 +74,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
'[', ']'));
if (Bukkit.getPlayer(targetPlayer.getUUID()) != null) {
- Bukkit.getPlayer(targetPlayer.getUUID()).sendMessage(Util.powerFormatter(
+ Bukkit.getPlayer(targetPlayer.getUUID()).sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-receiver"),
ImmutableMap.builder()
@@ -85,7 +85,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
}
} else {
if (targetPlayer != null && rank != null) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed-executor"),
diff --git a/src/main/java/nl/svenar/powerranks/commands/player/cmd_haspermission.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_haspermission.java
similarity index 88%
rename from src/main/java/nl/svenar/powerranks/commands/player/cmd_haspermission.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_haspermission.java
index 9bb1f19e..5c94d0f0 100644
--- a/src/main/java/nl/svenar/powerranks/commands/player/cmd_haspermission.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_haspermission.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.player;
+package nl.svenar.powerranks.bukkit.commands.player;
import java.util.ArrayList;
import java.util.List;
@@ -10,14 +10,13 @@
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionAttachmentInfo;
-import nl.svenar.common.structure.PRPermission;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPermission;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
public class cmd_haspermission extends PowerCommand {
@@ -37,7 +36,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
permissionNode = args[1];
if (prPlayer == null) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage("general.player-not-found"),
ImmutableMap.builder()
.put("player", sender.getName())
@@ -47,7 +46,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
}
if (permissionNode == null || permissionNode.length() == 0) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage("general.permission-not-found"),
ImmutableMap.builder()
.put("permission", args[1])
@@ -74,7 +73,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
}
}
- ArrayList wildcardPermissions = Util.generateWildcardList(permissionNode);
+ ArrayList wildcardPermissions = PRUtil.generateWildcardList(permissionNode);
for (PRPermission perm : playerPermissions) {
if (wildcardPermissions.contains(perm.getName())) {
@@ -106,7 +105,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
sender.sendMessage(ChatColor.BLUE + "===" + ChatColor.DARK_AQUA + "------------------------------"
+ ChatColor.BLUE + "===");
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage("general.player-not-online"),
ImmutableMap.builder()
.put("player", sender.getName())
@@ -129,8 +128,7 @@ public ArrayList tabCompleteEvent(CommandSender sender, String[] args) {
if (args.length == 2) {
// for (Permission pai : Bukkit.getServer().getPermissions()) {
- for (PermissionAttachmentInfo pai : Bukkit.getServer().getConsoleSender().getEffectivePermissions()) {
- String perm = pai.getPermission();
+ for (String perm : plugin.getPermissionRegistry().getPermissions()) {
String userInput = args[1];
String autocompletePermission = "";
diff --git a/src/main/java/nl/svenar/powerranks/commands/player/cmd_listplayerpermissions.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_listplayerpermissions.java
similarity index 91%
rename from src/main/java/nl/svenar/powerranks/commands/player/cmd_listplayerpermissions.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_listplayerpermissions.java
index e900fbda..1d0b0515 100644
--- a/src/main/java/nl/svenar/powerranks/commands/player/cmd_listplayerpermissions.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_listplayerpermissions.java
@@ -1,7 +1,7 @@
-package nl.svenar.powerranks.commands.player;
+package nl.svenar.powerranks.bukkit.commands.player;
import java.util.ArrayList;
-import java.util.List;
+import java.util.Set;
import com.google.common.collect.ImmutableMap;
@@ -10,12 +10,13 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRPermission;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPermission;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.util.Util;
public class cmd_listplayerpermissions extends PowerCommand {
@@ -32,7 +33,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
if (targetPlayer != null) {
displayList(sender, targetPlayer, commandLabel, 0);
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage("general.player-not-found"),
ImmutableMap.builder()
.put("player", sender.getName())
@@ -46,7 +47,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
if (targetPlayer != null) {
displayList(sender, targetPlayer, commandLabel, page);
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage("general.player-not-found"),
ImmutableMap.builder()
.put("player", sender.getName())
@@ -69,7 +70,7 @@ private void displayList(CommandSender sender, PRPlayer prPlayer, String command
output_messages.add(ChatColor.BLUE + "===" + ChatColor.DARK_AQUA + "----------" + ChatColor.AQUA
+ plugin.getDescription().getName() + ChatColor.DARK_AQUA + "----------" + ChatColor.BLUE + "===");
- List playerPermissions = prPlayer.getPermissions();
+ Set playerPermissions = prPlayer.getPermissions();
int lines_per_page = sender instanceof Player ? 5 : 10;
int last_page = playerPermissions.size() / lines_per_page;
diff --git a/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_nick.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_nick.java
new file mode 100644
index 00000000..f38eab6e
--- /dev/null
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_nick.java
@@ -0,0 +1,151 @@
+package nl.svenar.powerranks.bukkit.commands.player;
+
+import java.util.ArrayList;
+
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import com.google.common.collect.ImmutableMap;
+
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.util.Util;
+
+public class cmd_nick extends PowerCommand {
+
+ public cmd_nick(PowerRanks plugin, String command_name, COMMAND_EXECUTOR ce) {
+ super(plugin, command_name, ce);
+ }
+
+ @Override
+ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String commandName,
+ String[] args) {
+ if (args.length == 1) { // Change own nickname
+ if (sender instanceof Player) {
+ Player targetPlayer = (Player) sender;
+ String nickname = args[0];
+ if (sender.hasPermission("powerranks.cmd." + commandName.toLowerCase() + ".setown")) {
+ if (updateNickname(targetPlayer, nickname)) {
+
+ sender.sendMessage(PRUtil.powerFormatter(
+ PowerRanks.getLanguageManager()
+ .getFormattedMessage(
+ "commands." + commandName.toLowerCase() + ".setown.success"),
+ ImmutableMap.builder()
+ .put("target", targetPlayer.getName())
+ .put("nickname", nickname)
+ .build(),
+ '[', ']'));
+ } else {
+
+ sender.sendMessage(PRUtil.powerFormatter(
+ PowerRanks.getLanguageManager()
+ .getFormattedMessage(
+ "commands." + commandName.toLowerCase() + ".setown.failed"),
+ ImmutableMap.builder()
+ .put("target", targetPlayer.getName())
+ .put("nickname", nickname)
+ .build(),
+ '[', ']'));
+ }
+ } else {
+ sender.sendMessage(PowerRanks.getLanguageManager().getFormattedMessage("general.no-permission"));
+ }
+ }
+
+ } else if (args.length == 2) { // Change other's nickname
+ String targetPlayername = args[0];
+ Player targetPlayer = Util.getPlayerByName(targetPlayername);
+ if (targetPlayer != null) {
+ String nickname = args[1];
+ if (sender.hasPermission("powerranks.cmd." + commandName.toLowerCase() + ".setother")) {
+ if (updateNickname(targetPlayer, nickname)) {
+
+ targetPlayer.sendMessage(PRUtil.powerFormatter(
+ PowerRanks.getLanguageManager()
+ .getFormattedMessage(
+ "commands." + commandName.toLowerCase() + ".setown.success"),
+ ImmutableMap.builder()
+ .put("target", targetPlayer.getName())
+ .put("nickname", nickname)
+ .build(),
+ '[', ']'));
+
+ sender.sendMessage(PRUtil.powerFormatter(
+ PowerRanks.getLanguageManager()
+ .getFormattedMessage(
+ "commands." + commandName.toLowerCase() + ".setother.success"),
+ ImmutableMap.builder()
+ .put("target", targetPlayer.getName())
+ .put("nickname", nickname)
+ .build(),
+ '[', ']'));
+
+ } else {
+ sender.sendMessage(PRUtil.powerFormatter(
+ PowerRanks.getLanguageManager()
+ .getFormattedMessage(
+ "commands." + commandName.toLowerCase() + ".setother.failed"),
+ ImmutableMap.builder()
+ .put("target", targetPlayer.getName())
+ .put("nickname", nickname)
+ .build(),
+ '[', ']'));
+
+ }
+ } else {
+ sender.sendMessage(PowerRanks.getLanguageManager().getFormattedMessage("general.no-permission"));
+ }
+ }
+
+ } else {
+ if (sender.hasPermission("powerranks.cmd." + commandName.toLowerCase())
+ || sender.hasPermission("powerranks.cmd." + commandName.toLowerCase() + ".*")) {
+ sender.sendMessage(
+ PowerRanks.getLanguageManager().getFormattedUsageMessage(commandLabel, commandName,
+ "commands." + commandName.toLowerCase() + ".arguments", sender instanceof Player));
+ } else {
+ sender.sendMessage(PowerRanks.getLanguageManager().getFormattedMessage("general.no-permission"));
+ }
+ }
+
+ return false;
+ }
+
+ private boolean updateNickname(Player targetPlayer, String nickname) {
+ PRPlayer prPlayer = CacheManager.getPlayer(targetPlayer);
+ if (prPlayer == null) {
+ return false;
+ }
+ prPlayer.setNickname(nickname);
+ return true;
+ }
+
+ public ArrayList tabCompleteEvent(CommandSender sender, String[] args) {
+ ArrayList tabcomplete = new ArrayList();
+
+ if (args.length == 1) {
+ for (PRPlayer prPlayer : CacheManager.getPlayers()) {
+ tabcomplete.add(prPlayer.getName());
+ }
+ }
+
+ if (args.length == 2) {
+ PRPlayer targetPlayer = CacheManager.getPlayer(args[0]);
+ if (targetPlayer != null) {
+ for (PRRank rank : CacheManager.getRanks()) {
+ if (!targetPlayer.hasRank(rank.getName())) {
+ tabcomplete.add(rank.getName());
+ }
+ }
+ }
+ }
+
+ return tabcomplete;
+ }
+}
diff --git a/src/main/java/nl/svenar/powerranks/commands/player/cmd_playerinfo.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_playerinfo.java
similarity index 82%
rename from src/main/java/nl/svenar/powerranks/commands/player/cmd_playerinfo.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_playerinfo.java
index e588e66a..10e361e5 100644
--- a/src/main/java/nl/svenar/powerranks/commands/player/cmd_playerinfo.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_playerinfo.java
@@ -1,15 +1,15 @@
-package nl.svenar.powerranks.commands.player;
+package nl.svenar.powerranks.bukkit.commands.player;
import java.util.ArrayList;
import com.google.common.collect.ImmutableMap;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Messages;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Messages;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -31,7 +31,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
if (targetPlayer != null) {
Messages.messagePlayerInfo(sender, targetPlayer, 0);
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage("general.player-not-found"),
ImmutableMap.builder()
.put("player", sender.getName())
@@ -46,7 +46,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
if (targetPlayer != null) {
Messages.messagePlayerInfo(sender, targetPlayer, page);
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage("general.player-not-found"),
ImmutableMap.builder()
.put("player", sender.getName())
diff --git a/src/main/java/nl/svenar/powerranks/commands/player/cmd_setownrank.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_setownrank.java
similarity index 84%
rename from src/main/java/nl/svenar/powerranks/commands/player/cmd_setownrank.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_setownrank.java
index e38915c9..abc23a47 100644
--- a/src/main/java/nl/svenar/powerranks/commands/player/cmd_setownrank.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_setownrank.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.player;
+package nl.svenar.powerranks.bukkit.commands.player;
import java.util.ArrayList;
@@ -9,14 +9,14 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_setownrank extends PowerCommand {
@@ -55,7 +55,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.updateSorting(Bukkit.getPlayer(targetPlayer.getUUID()));
}
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-executor"),
@@ -66,7 +66,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
'[', ']'));
} else {
if (targetPlayer != null && rank != null) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed-executor"),
diff --git a/src/main/java/nl/svenar/powerranks/commands/player/cmd_setrank.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_setrank.java
similarity index 88%
rename from src/main/java/nl/svenar/powerranks/commands/player/cmd_setrank.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_setrank.java
index fc69c361..97be7893 100644
--- a/src/main/java/nl/svenar/powerranks/commands/player/cmd_setrank.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/player/cmd_setrank.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.player;
+package nl.svenar.powerranks.bukkit.commands.player;
import java.util.ArrayList;
import java.util.Arrays;
@@ -12,15 +12,15 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRPermission;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPermission;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_setrank extends PowerCommand {
@@ -95,7 +95,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
}
}
if (hasRank) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-executor"),
@@ -105,7 +105,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-executor"),
@@ -117,7 +117,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
}
if (Bukkit.getPlayer(targetPlayer.getUUID()) != null) {
- Bukkit.getPlayer(targetPlayer.getUUID()).sendMessage(Util.powerFormatter(
+ Bukkit.getPlayer(targetPlayer.getUUID()).sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-receiver"),
ImmutableMap.builder()
@@ -127,7 +127,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
'[', ']'));
}
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed-executor"),
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_addinheritance.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_addinheritance.java
similarity index 83%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_addinheritance.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_addinheritance.java
index 13ae8778..77964a5b 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_addinheritance.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_addinheritance.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
@@ -8,12 +8,12 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_addinheritance extends PowerCommand {
@@ -33,7 +33,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String inheritance = args[1];
final boolean result = this.users.addInheritance(rankname, inheritance);
if (result) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -43,7 +43,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"general.rank-not-found"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_addperm.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_addperm.java
similarity index 85%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_addperm.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_addperm.java
index 2e4bb156..66ce7c06 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_addperm.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_addperm.java
@@ -1,20 +1,18 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
import com.google.common.collect.ImmutableMap;
-import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionAttachmentInfo;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_addperm extends PowerCommand {
@@ -41,7 +39,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final boolean result = this.users.addPermission(rankname, permission, allowed);
if (result) {
if (rankname.equals("*")) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-all"),
ImmutableMap.builder()
@@ -51,7 +49,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -62,7 +60,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
'[', ']'));
}
} else { // Rank not found
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
@@ -92,8 +90,7 @@ public ArrayList tabCompleteEvent(CommandSender sender, String[] args) {
if (args.length == 2) {
// for (Permission pai : Bukkit.getServer().getPermissions()) {
- for (PermissionAttachmentInfo pai : Bukkit.getServer().getConsoleSender().getEffectivePermissions()) {
- String perm = pai.getPermission();
+ for (String perm : plugin.getPermissionRegistry().getPermissions()) {
String userInput = args[1];
String autocompletePermission = "";
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_createrank.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_createrank.java
similarity index 81%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_createrank.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_createrank.java
index ee027ec5..e241b09e 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_createrank.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_createrank.java
@@ -1,13 +1,13 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
import com.google.common.collect.ImmutableMap;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
+import nl.svenar.powerranks.common.utils.PRUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -33,7 +33,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
String[] forbiddenCharacters = { "`", "~", "!", "@", "$", "%", "^", "*", "(", ")", "{", "}", "[", "]", ":",
";", "\"", "'", "|", "\\", "?", "/", ">", "<", ",", ".", "+", "=" };
if (success) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -41,8 +41,8 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.put("rank", rankname)
.build(),
'[', ']'));
- if (Util.stringContainsItemFromList(rankname, forbiddenColorCharacters)) {
- sender.sendMessage(Util.powerFormatter(
+ if (PRUtil.stringContainsItemFromList(rankname, forbiddenColorCharacters)) {
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".warning-color"),
ImmutableMap.builder()
@@ -52,8 +52,8 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
'[', ']'));
}
- if (Util.stringContainsItemFromList(rankname, forbiddenCharacters)) {
- sender.sendMessage(Util.powerFormatter(
+ if (PRUtil.stringContainsItemFromList(rankname, forbiddenCharacters)) {
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".warning-character"),
ImmutableMap.builder()
@@ -63,7 +63,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
'[', ']'));
}
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_deleterank.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_deleterank.java
similarity index 82%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_deleterank.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_deleterank.java
index d8751159..d205785e 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_deleterank.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_deleterank.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
@@ -8,11 +8,11 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_deleterank extends PowerCommand {
@@ -31,7 +31,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String rankname = this.users.getRankIgnoreCase(args[0]);
final boolean success = this.users.deleteRank(rankname);
if (success) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -40,7 +40,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_delinheritance.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_delinheritance.java
similarity index 82%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_delinheritance.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_delinheritance.java
index d3a5d809..ca5f43c0 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_delinheritance.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_delinheritance.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
@@ -8,12 +8,12 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_delinheritance extends PowerCommand {
@@ -33,7 +33,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String inheritance = args[1];
final boolean result = this.users.removeInheritance(rankname, inheritance);
if (result) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -43,7 +43,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"general.rank-not-found"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_delperm.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_delperm.java
similarity index 84%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_delperm.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_delperm.java
index 11ce1fcd..aeb7bb44 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_delperm.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_delperm.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
import java.util.List;
@@ -9,12 +9,12 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRPermission;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPermission;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_delperm extends PowerCommand {
@@ -35,7 +35,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final boolean result = this.users.removePermission(rankname, permission);
if (result) {
if (rankname.equals("*")) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-all"),
ImmutableMap.builder()
@@ -45,7 +45,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -56,7 +56,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
'[', ']'));
}
} else { // Rank not found
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_listdefaultranks.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_listdefaultranks.java
similarity index 76%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_listdefaultranks.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_listdefaultranks.java
index 29ce2aba..0a414bf7 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_listdefaultranks.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_listdefaultranks.java
@@ -1,19 +1,19 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.common.utils.PRUtil;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
public class cmd_listdefaultranks extends PowerCommand {
@@ -26,7 +26,7 @@ public cmd_listdefaultranks(PowerRanks plugin, String command_name, COMMAND_EXEC
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String commandName,
String[] args) {
if (args.length == 0) {
- List ranks = CacheManager.getDefaultRanks();
+ Set ranks = CacheManager.getDefaultRanks();
sender.sendMessage(ChatColor.BLUE + "===" + ChatColor.DARK_AQUA + "----------" + ChatColor.AQUA
+ plugin.getDescription().getName() + ChatColor.DARK_AQUA + "----------" + ChatColor.BLUE
+ "===");
@@ -35,11 +35,11 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
sender.sendMessage(ChatColor.AQUA + "Ranks (" + ranks.size() + "):");
int index = 0;
- ranks = new ArrayList<>(new HashSet<>(ranks));
- PRUtil.sortRanksByWeight(ranks);
- PRUtil.reverseRanks(ranks);
+ List sortedRanks = new ArrayList<>(ranks);
+ PRUtil.sortRanksByWeight(sortedRanks);
+ PRUtil.reverseRanks(sortedRanks);
- for (PRRank rank : ranks) {
+ for (PRRank rank : sortedRanks) {
index++;
sender.sendMessage(
ChatColor.DARK_GREEN + "#" + index + ". " + ChatColor.GRAY + "(" + rank.getWeight()
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_listpermissions.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_listpermissions.java
similarity index 92%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_listpermissions.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_listpermissions.java
index bea2403c..af94f2d2 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_listpermissions.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_listpermissions.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
import java.util.List;
@@ -10,12 +10,13 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRPermission;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPermission;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
+import nl.svenar.powerranks.bukkit.util.Util;
public class cmd_listpermissions extends PowerCommand {
@@ -42,7 +43,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
// Messages.listRankPermissions(sender, s, rankName, 0);
displayRankPermissions(sender, rankName, commandLabel, 0);
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"general.rank-not-found"),
ImmutableMap.builder()
@@ -58,7 +59,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
// Messages.listRankPermissions(sender, s, rankName, page);
displayRankPermissions(sender, rankName, commandLabel, page);
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"general.rank-not-found"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_listranks.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_listranks.java
similarity index 77%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_listranks.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_listranks.java
index a2f1f378..fda25f31 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_listranks.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_listranks.java
@@ -1,18 +1,17 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.common.utils.PRUtil;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_listranks extends PowerCommand {
@@ -35,11 +34,11 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
sender.sendMessage(ChatColor.AQUA + "Ranks (" + ranks.size() + "):");
int index = 0;
- ranks = new ArrayList<>(new HashSet<>(ranks));
- PRUtil.sortRanksByWeight(ranks);
- ranks = PRUtil.reverseRanks(ranks);
+ List sortedRanks = new ArrayList<>(ranks);
+ PRUtil.sortRanksByWeight(sortedRanks);
+ PRUtil.reverseRanks(sortedRanks);
- for (PRRank rank : ranks) {
+ for (PRRank rank : sortedRanks) {
index++;
sender.sendMessage(ChatColor.DARK_GREEN + "#" + index + ". " + ChatColor.GRAY + "(" + rank.getWeight()
+ ") " + ChatColor.GREEN + rank.getName() + ChatColor.RESET + " "
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_rankinfo.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_rankinfo.java
similarity index 82%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_rankinfo.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_rankinfo.java
index 8c2a481d..719c9ed7 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_rankinfo.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_rankinfo.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
@@ -8,12 +8,12 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Messages;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Messages;
public class cmd_rankinfo extends PowerCommand {
@@ -31,7 +31,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
if (target_rank != null) {
Messages.messageRankInfo(sender, target_rank, 0);
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"general.rank-not-found"),
ImmutableMap.builder()
@@ -47,7 +47,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
if (target_rank != null) {
Messages.messageRankInfo(sender, target_rank, page);
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"general.rank-not-found"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_renamerank.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_renamerank.java
similarity index 83%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_renamerank.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_renamerank.java
index 59b6a10b..6bdfe8f4 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_renamerank.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_renamerank.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
@@ -8,11 +8,11 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_renamerank extends PowerCommand {
@@ -32,7 +32,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String to = args[1];
final boolean result = this.users.renameRank(from, to);
if (result) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -42,7 +42,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else { // Rank not found or target name already exists
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_setchatcolor.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setchatcolor.java
similarity index 83%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_setchatcolor.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setchatcolor.java
index ed0dc485..20608549 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_setchatcolor.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setchatcolor.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
@@ -8,11 +8,11 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_setchatcolor extends PowerCommand {
@@ -32,7 +32,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String color = args[1];
final boolean result = this.users.setChatColor(rankname, color);
if (result) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -42,7 +42,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"general.rank-not-found"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_setdefault.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setdefault.java
similarity index 82%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_setdefault.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setdefault.java
index d03afc1f..d346af27 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_setdefault.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setdefault.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
@@ -8,12 +8,12 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_setdefault extends PowerCommand {
@@ -36,7 +36,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
rank.setDefault(isDefault);
if (isDefault) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-added"),
ImmutableMap.builder()
@@ -45,7 +45,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-removed"),
ImmutableMap.builder()
@@ -55,7 +55,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
'[', ']'));
}
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"general.rank-not-found"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_setnamecolor.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setnamecolor.java
similarity index 83%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_setnamecolor.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setnamecolor.java
index d6e9d550..9c7d5d35 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_setnamecolor.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setnamecolor.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
@@ -8,11 +8,11 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_setnamecolor extends PowerCommand {
@@ -32,7 +32,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String color = args[1];
final boolean result = this.users.setNameColor(rankname, color);
if (result) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -42,7 +42,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"general.rank-not-found"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_setprefix.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setprefix.java
similarity index 85%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_setprefix.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setprefix.java
index acde42f9..d29301b0 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_setprefix.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setprefix.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
@@ -8,11 +8,11 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_setprefix extends PowerCommand {
@@ -32,7 +32,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String prefix = "";
final boolean result = this.users.setPrefix(rankname, prefix);
if (result) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-clear"),
ImmutableMap.builder()
@@ -42,7 +42,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage("general.rank-not-found"),
ImmutableMap.builder()
.put("player", sender.getName())
@@ -59,7 +59,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
prefix = prefix.substring(0, prefix.length() - 1);
final boolean result = this.users.setPrefix(rankname, prefix);
if (result) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -69,7 +69,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"general.rank-not-found"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_setsuffix.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setsuffix.java
similarity index 85%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_setsuffix.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setsuffix.java
index 5c9117be..fc3c3d98 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_setsuffix.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setsuffix.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
@@ -8,11 +8,11 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_setsuffix extends PowerCommand {
@@ -32,7 +32,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String suffix = "";
final boolean result = this.users.setSuffix(rankname, suffix);
if (result) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-clear"),
ImmutableMap.builder()
@@ -42,7 +42,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"general.rank-not-found"),
ImmutableMap.builder()
@@ -60,7 +60,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
suffix = suffix.substring(0, suffix.length() - 1);
final boolean result = this.users.setSuffix(rankname, suffix);
if (result) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -70,7 +70,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"general.rank-not-found"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_setweight.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setweight.java
similarity index 82%
rename from src/main/java/nl/svenar/powerranks/commands/rank/cmd_setweight.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setweight.java
index 09acdef6..a7568246 100644
--- a/src/main/java/nl/svenar/powerranks/commands/rank/cmd_setweight.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/rank/cmd_setweight.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.rank;
+package nl.svenar.powerranks.bukkit.commands.rank;
import java.util.ArrayList;
import java.util.Objects;
@@ -9,12 +9,12 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
public class cmd_setweight extends PowerCommand {
@@ -34,7 +34,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String rankname = this.users.getRankIgnoreCase(args[0]);
final PRRank rank = CacheManager.getRank(rankname);
if (Objects.isNull(rank)) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"general.rank-not-found"),
ImmutableMap.builder()
@@ -48,7 +48,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
try {
weight = Integer.parseInt(args[1]);
} catch (Exception e) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".numbers-only"),
ImmutableMap.builder()
@@ -61,7 +61,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
if (rank != null) {
rank.setWeight(weight);
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/test/cmd_test.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/test/cmd_test.java
similarity index 90%
rename from src/main/java/nl/svenar/powerranks/commands/test/cmd_test.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/test/cmd_test.java
index 2bcfba45..ba6a23bc 100644
--- a/src/main/java/nl/svenar/powerranks/commands/test/cmd_test.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/test/cmd_test.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.test;
+package nl.svenar.powerranks.bukkit.commands.test;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -7,10 +7,10 @@
import java.util.Map;
import java.util.Map.Entry;
-import nl.svenar.common.structure.PRPermission;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.PowerPermissibleBase;
+import nl.svenar.powerranks.common.structure.PRPermission;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.PowerPermissibleBase;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
diff --git a/src/main/java/nl/svenar/powerranks/commands/usertags/cmd_addusertag.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_addusertag.java
similarity index 89%
rename from src/main/java/nl/svenar/powerranks/commands/usertags/cmd_addusertag.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_addusertag.java
index bdbe4261..6a3fc930 100644
--- a/src/main/java/nl/svenar/powerranks/commands/usertags/cmd_addusertag.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_addusertag.java
@@ -1,14 +1,15 @@
-package nl.svenar.powerranks.commands.usertags;
+package nl.svenar.powerranks.bukkit.commands.usertags;
import java.util.ArrayList;
import com.google.common.collect.ImmutableMap;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
+import nl.svenar.powerranks.bukkit.util.Util;
+import nl.svenar.powerranks.common.utils.PRUtil;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
@@ -39,7 +40,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
PowerRanks.getInstance().updateTablistName(targetPlayer);
}
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -49,7 +50,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
@@ -76,7 +77,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
PowerRanks.getInstance().updateTablistName(targetPlayer);
}
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -86,7 +87,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/usertags/cmd_clearusertag.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_clearusertag.java
similarity index 88%
rename from src/main/java/nl/svenar/powerranks/commands/usertags/cmd_clearusertag.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_clearusertag.java
index 1d63e523..a2fada6e 100644
--- a/src/main/java/nl/svenar/powerranks/commands/usertags/cmd_clearusertag.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_clearusertag.java
@@ -1,13 +1,13 @@
-package nl.svenar.powerranks.commands.usertags;
+package nl.svenar.powerranks.bukkit.commands.usertags;
import java.util.ArrayList;
import com.google.common.collect.ImmutableMap;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
+import nl.svenar.powerranks.common.utils.PRUtil;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
@@ -33,7 +33,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String playername = sender.getName();
final boolean result = this.users.clearUserTag(playername);
if (result) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -42,7 +42,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
@@ -64,7 +64,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String playername = args[0];
final boolean result = this.users.clearUserTag(playername);
if (result) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -73,7 +73,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/usertags/cmd_createusertag.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_createusertag.java
similarity index 85%
rename from src/main/java/nl/svenar/powerranks/commands/usertags/cmd_createusertag.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_createusertag.java
index c763a03d..667dea57 100644
--- a/src/main/java/nl/svenar/powerranks/commands/usertags/cmd_createusertag.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_createusertag.java
@@ -1,13 +1,13 @@
-package nl.svenar.powerranks.commands.usertags;
+package nl.svenar.powerranks.bukkit.commands.usertags;
import java.util.ArrayList;
import com.google.common.collect.ImmutableMap;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
+import nl.svenar.powerranks.common.utils.PRUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -32,7 +32,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String text = args[1];
final boolean result = this.users.createUserTag(tag, text);
if (result) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -42,7 +42,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/usertags/cmd_delusertag.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_delusertag.java
similarity index 88%
rename from src/main/java/nl/svenar/powerranks/commands/usertags/cmd_delusertag.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_delusertag.java
index 0fa59ce8..09bcc4d9 100644
--- a/src/main/java/nl/svenar/powerranks/commands/usertags/cmd_delusertag.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_delusertag.java
@@ -1,14 +1,15 @@
-package nl.svenar.powerranks.commands.usertags;
+package nl.svenar.powerranks.bukkit.commands.usertags;
import java.util.ArrayList;
import com.google.common.collect.ImmutableMap;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
+import nl.svenar.powerranks.bukkit.util.Util;
+import nl.svenar.powerranks.common.utils.PRUtil;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
@@ -39,7 +40,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
PowerRanks.getInstance().updateTablistName(targetPlayer);
}
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -49,7 +50,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
@@ -76,7 +77,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
PowerRanks.getInstance().updateTablistName(targetPlayer);
}
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -86,7 +87,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/usertags/cmd_editusertag.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_editusertag.java
similarity index 86%
rename from src/main/java/nl/svenar/powerranks/commands/usertags/cmd_editusertag.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_editusertag.java
index 362300c5..877a4d05 100644
--- a/src/main/java/nl/svenar/powerranks/commands/usertags/cmd_editusertag.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_editusertag.java
@@ -1,13 +1,13 @@
-package nl.svenar.powerranks.commands.usertags;
+package nl.svenar.powerranks.bukkit.commands.usertags;
import java.util.ArrayList;
import com.google.common.collect.ImmutableMap;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
+import nl.svenar.powerranks.common.utils.PRUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -32,7 +32,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String text = args[1];
final boolean result = this.users.editUserTag(tag, text);
if (result) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -42,7 +42,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/usertags/cmd_listusertags.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_listusertags.java
similarity index 95%
rename from src/main/java/nl/svenar/powerranks/commands/usertags/cmd_listusertags.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_listusertags.java
index 42508fb6..2b510010 100644
--- a/src/main/java/nl/svenar/powerranks/commands/usertags/cmd_listusertags.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_listusertags.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.usertags;
+package nl.svenar.powerranks.bukkit.commands.usertags;
import java.util.ArrayList;
import java.util.Set;
@@ -8,10 +8,10 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
+import nl.svenar.powerranks.bukkit.util.Util;
public class cmd_listusertags extends PowerCommand {
diff --git a/src/main/java/nl/svenar/powerranks/commands/usertags/cmd_removeusertag.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_removeusertag.java
similarity index 85%
rename from src/main/java/nl/svenar/powerranks/commands/usertags/cmd_removeusertag.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_removeusertag.java
index 4f9870d4..237f27a7 100644
--- a/src/main/java/nl/svenar/powerranks/commands/usertags/cmd_removeusertag.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_removeusertag.java
@@ -1,13 +1,13 @@
-package nl.svenar.powerranks.commands.usertags;
+package nl.svenar.powerranks.bukkit.commands.usertags;
import java.util.ArrayList;
import com.google.common.collect.ImmutableMap;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
+import nl.svenar.powerranks.common.utils.PRUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -31,7 +31,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
final String tag = args[0];
final boolean result = this.users.removeUserTag(tag);
if (result) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -40,7 +40,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/usertags/cmd_setusertag.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_setusertag.java
similarity index 90%
rename from src/main/java/nl/svenar/powerranks/commands/usertags/cmd_setusertag.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_setusertag.java
index 0f6b98ae..5f04e67f 100644
--- a/src/main/java/nl/svenar/powerranks/commands/usertags/cmd_setusertag.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/usertags/cmd_setusertag.java
@@ -1,13 +1,13 @@
-package nl.svenar.powerranks.commands.usertags;
+package nl.svenar.powerranks.bukkit.commands.usertags;
import java.util.ArrayList;
import com.google.common.collect.ImmutableMap;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.Users;
+import nl.svenar.powerranks.common.utils.PRUtil;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
@@ -38,7 +38,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
PowerRanks.getInstance().updateTablistName(targetPlayer);
}
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -48,7 +48,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
@@ -75,7 +75,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
PowerRanks.getInstance().updateTablistName(targetPlayer);
}
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success"),
ImmutableMap.builder()
@@ -85,7 +85,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
.build(),
'[', ']'));
} else {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".failed"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/commands/webeditor/cmd_webeditor.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/webeditor/cmd_webeditor.java
similarity index 90%
rename from src/main/java/nl/svenar/powerranks/commands/webeditor/cmd_webeditor.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/webeditor/cmd_webeditor.java
index c712b0db..455e111c 100644
--- a/src/main/java/nl/svenar/powerranks/commands/webeditor/cmd_webeditor.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/commands/webeditor/cmd_webeditor.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.commands.webeditor;
+package nl.svenar.powerranks.bukkit.commands.webeditor;
import java.lang.reflect.Type;
import java.util.ArrayList;
@@ -16,17 +16,16 @@
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.scheduler.BukkitRunnable;
-import nl.svenar.common.http.DatabinClient;
-import nl.svenar.common.storage.PowerStorageManager;
-import nl.svenar.common.storage.provided.JSONStorageManager;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.commands.PowerCommand;
-import nl.svenar.powerranks.data.PowerRanksVerbose;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.http.DatabinClient;
+import nl.svenar.powerranks.common.storage.PowerStorageManager;
+import nl.svenar.powerranks.common.storage.provided.JSONStorageManager;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.commands.PowerCommand;
+import nl.svenar.powerranks.bukkit.data.PowerRanksVerbose;
public class cmd_webeditor extends PowerCommand {
@@ -102,6 +101,9 @@ private void startWebeditor(CommandSender sender, String commandName) {
outputJSON += ",";
outputJSON += "\"usertags\":";
outputJSON += PowerRanks.getUsertagManager().toJSON("usertags", false);
+ outputJSON += ",";
+ outputJSON += "\"tablist\":";
+ outputJSON += PowerRanks.getTablistConfigManager().toJSON(null, false);
outputJSON += "}";
jsonmanager.removeAllData();
@@ -217,7 +219,7 @@ public void handleWebeditorDownload(CommandSender sender, Map js
}
if (!((String) serverData.get("powerranksVersion")).equals(PowerRanks.getVersion())) {
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".incompatible-version"),
ImmutableMap.builder()
@@ -232,6 +234,7 @@ public void handleWebeditorDownload(CommandSender sender, Map js
LinkedTreeMap, ?> rankData = (LinkedTreeMap, ?>) jsonData.get("rankdata");
LinkedTreeMap, ?> playerData = (LinkedTreeMap, ?>) jsonData.get("playerdata");
LinkedTreeMap, ?> usertags = (LinkedTreeMap, ?>) jsonData.get("usertags");
+ LinkedTreeMap, ?> tablist = (LinkedTreeMap, ?>) jsonData.get("tablist");
JSONStorageManager jsonmanager = new JSONStorageManager(PowerRanks.fileLoc, "dummyRanks.json",
"dummyPlayers.json");
@@ -251,12 +254,13 @@ public void handleWebeditorDownload(CommandSender sender, Map js
jsonmanager.removeAllData();
PowerRanks.getUsertagManager().fromJSON("usertags", usertags);
+ PowerRanks.getTablistConfigManager().fromJSON(null, tablist);
sender.sendMessage(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".success-downloaded"));
- sender.sendMessage(Util.powerFormatter(
+ sender.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands." + commandName.toLowerCase() + ".download-stats"),
ImmutableMap.builder()
@@ -283,8 +287,8 @@ private String getServerDataAsJSON() {
List server_permissions = new ArrayList();
- for (PermissionAttachmentInfo permission : Bukkit.getServer().getConsoleSender().getEffectivePermissions()) {
- server_permissions.add("\"" + permission.getPermission() + "\"");
+ for (String perm : plugin.getPermissionRegistry().getPermissions()) {
+ server_permissions.add("\"" + perm + "\"");
}
output += "{";
diff --git a/src/main/java/nl/svenar/powerranks/data/BannerItem.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/BannerItem.java
similarity index 95%
rename from src/main/java/nl/svenar/powerranks/data/BannerItem.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/BannerItem.java
index 9a8373ee..38fe66ed 100644
--- a/src/main/java/nl/svenar/powerranks/data/BannerItem.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/BannerItem.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.data;
+package nl.svenar.powerranks.bukkit.data;
import java.util.Arrays;
import java.util.List;
diff --git a/src/main/java/nl/svenar/powerranks/data/BungeecordManager.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/BungeecordManager.java
similarity index 94%
rename from src/main/java/nl/svenar/powerranks/data/BungeecordManager.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/BungeecordManager.java
index 25915f5d..5732742e 100644
--- a/src/main/java/nl/svenar/powerranks/data/BungeecordManager.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/BungeecordManager.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.data;
+package nl.svenar.powerranks.bukkit.data;
import java.time.Duration;
import java.time.Instant;
@@ -9,12 +9,12 @@
import org.bukkit.scheduler.BukkitRunnable;
-import nl.svenar.common.storage.provided.MySQLStorageManager;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.common.utils.PRUtil;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
+import nl.svenar.powerranks.common.storage.provided.MySQLStorageManager;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
public class BungeecordManager {
diff --git a/src/main/java/nl/svenar/powerranks/data/Messages.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/Messages.java
similarity index 97%
rename from src/main/java/nl/svenar/powerranks/data/Messages.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/Messages.java
index 6d30b63a..b2998e09 100644
--- a/src/main/java/nl/svenar/powerranks/data/Messages.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/Messages.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.data;
+package nl.svenar.powerranks.bukkit.data;
import java.io.File;
import java.text.SimpleDateFormat;
@@ -6,8 +6,10 @@
import java.time.Instant;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
import java.util.TimeZone;
@@ -18,20 +20,20 @@
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
-import nl.svenar.common.structure.PRPermission;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.common.utils.PRUtil;
-import nl.svenar.common.utils.PowerColor;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.addons.AddonsManager;
-import nl.svenar.powerranks.addons.DownloadableAddon;
-import nl.svenar.powerranks.addons.PowerRanksAddon;
-import nl.svenar.powerranks.addons.PowerRanksPlayer;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.external.VaultHook;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPermission;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.common.utils.PowerColor;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.addons.AddonsManager;
+import nl.svenar.powerranks.bukkit.addons.DownloadableAddon;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksAddon;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksPlayer;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.external.VaultHook;
+import nl.svenar.powerranks.bukkit.util.Util;
import com.google.common.collect.ImmutableMap;
@@ -479,7 +481,7 @@ private static String getSampleChatFormat(Player player) {
PRPlayer targetPlayer = CacheManager.getPlayer(player.getUniqueId().toString());
Map, ?> availableUsertags = PowerRanks.getUsertagManager().getMap("usertags", new HashMap());
- ArrayList playerUsertags = targetPlayer.getUsertags();
+ Set playerUsertags = targetPlayer.getUsertags();
for (String playerUsertag : playerUsertags) {
String value = "";
@@ -502,7 +504,7 @@ private static String getSampleChatFormat(Player player) {
String player_formatted_chat_msg = (chatColor.length() == 0 ? "&r" : "")
+ PowerRanks.applyMultiColorFlow(chatColor, playersChatMessage);
- format = Util.powerFormatter(format, ImmutableMap.builder().put("prefix", formatted_prefix)
+ format = PRUtil.powerFormatter(format, ImmutableMap.builder().put("prefix", formatted_prefix)
.put("suffix", formatted_suffix)
.put("usertag",
!PowerRanks.plugin_hook_deluxetags ? usertag
@@ -544,7 +546,7 @@ private static String getSampleChatFormat(CommandSender sender, String name, Str
String player_formatted_chat_msg = (chatColor.length() == 0 ? "&r" : "")
+ PowerRanks.applyMultiColorFlow(chatColor, playersChatMessage);
- format = Util.powerFormatter(format, ImmutableMap.builder().put("prefix", formatted_prefix)
+ format = PRUtil.powerFormatter(format, ImmutableMap.builder().put("prefix", formatted_prefix)
.put("suffix", formatted_suffix)
.put("usertag",
!PowerRanks.plugin_hook_deluxetags ? usertag
@@ -927,7 +929,7 @@ public static void listRankPermissions(CommandSender sender, Users users, String
}
public static void listPlayerPermissions(CommandSender sender, Users users, String target_player, int page) {
- List lines = users.getPlayerPermissions(target_player);
+ Set lines = users.getPlayerPermissions(target_player);
int lines_per_page = 10;
if (page < 0)
@@ -957,9 +959,13 @@ public static void listPlayerPermissions(CommandSender sender, Users users, Stri
Messages.powerRanks.getServer().dispatchCommand(
(CommandSender) Messages.powerRanks.getServer().getConsoleSender(), page_selector_tellraw);
+ Iterator permissionIterator = lines.iterator();
for (int i = 0; i < lines_per_page; i++) {
if (lines_per_page * page + i < lines.size()) {
- PRPermission permission = lines.get(lines_per_page * page + i);
+ if (!permissionIterator.hasNext()) {
+ break;
+ }
+ PRPermission permission = permissionIterator.next();
if (permission.getName().length() > 0)
sender.sendMessage(
(permission.getValue() ? ChatColor.GREEN : ChatColor.RED) + permission.getName());
diff --git a/src/main/java/nl/svenar/powerranks/data/PowerPermissibleBase.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/PowerPermissibleBase.java
similarity index 84%
rename from src/main/java/nl/svenar/powerranks/data/PowerPermissibleBase.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/PowerPermissibleBase.java
index bea5a60b..804ac196 100644
--- a/src/main/java/nl/svenar/powerranks/data/PowerPermissibleBase.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/PowerPermissibleBase.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.data;
+package nl.svenar.powerranks.bukkit.data;
import java.util.Map.Entry;
import java.util.HashMap;
@@ -12,16 +12,18 @@
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
-import nl.svenar.common.structure.PRPermission;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.storage.PermissionRegistry;
+import nl.svenar.powerranks.common.structure.PRPermission;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
public class PowerPermissibleBase extends PermissibleBase {
private PowerRanks plugin;
private Player player;
+ private PermissionRegistry permissionRegistry;
private PRPlayer prPlayer;
public static Map permissionCallCount = new HashMap();
@@ -30,6 +32,7 @@ public PowerPermissibleBase(Player player, PowerRanks plugin) {
super(player);
this.player = player;
this.plugin = plugin;
+ this.permissionRegistry = plugin.getPermissionRegistry();
this.prPlayer = CacheManager.getPlayer(player.getUniqueId().toString());
if (prPlayer == null) {
CacheManager.createPlayer(player);
@@ -68,9 +71,11 @@ public boolean isPermissionSet(String name) {
throw new IllegalArgumentException("Permission name cannot be null");
}
+ permissionRegistry.queuePermission(name);
+
PRPermission prPermission = getPRPermission(name);
if (prPermission == null) {
- for (String wildCardPermissionName : Util.generateWildcardList(name)) {
+ for (String wildCardPermissionName : PRUtil.generateWildcardList(name)) {
prPermission = getPRPermission(wildCardPermissionName);
if (prPermission != null) {
break;
@@ -104,6 +109,8 @@ public boolean hasPermission(String inName) {
throw new IllegalArgumentException("Permission name cannot be null");
}
+ permissionRegistry.queuePermission(inName);
+
if (permissionCallCount.get(inName) == null) {
permissionCallCount.put(inName, 0);
} else {
@@ -112,7 +119,7 @@ public boolean hasPermission(String inName) {
PRPermission prPermission = getPRPermission(inName);
if (prPermission == null) {
- for (String wildCardPermissionName : Util.generateWildcardList(inName)) {
+ for (String wildCardPermissionName : PRUtil.generateWildcardList(inName)) {
prPermission = getPRPermission(wildCardPermissionName);
if (prPermission != null) {
break;
@@ -120,14 +127,22 @@ public boolean hasPermission(String inName) {
}
}
+ boolean defaultHasPermission = false;
+ try {
+ defaultHasPermission = super.hasPermission(inName);
+ } catch (NullPointerException e) {
+ PowerRanksVerbose.log("hasPermission(String inName) failed", e.getMessage());
+ super.recalculatePermissions();
+ }
+
PowerRanksVerbose.log("hasPermission(String inName)",
- "called with inName: " + inName + " (" + super.hasPermission(inName) + ") - prPermission value: "
+ "called with inName: " + inName + " (" + defaultHasPermission + ") - prPermission value: "
+ (prPermission == null ? "null" : prPermission.getValue()));
if (prPermission != null) {
return prPermission.getValue();
}
- return super.hasPermission(inName);
+ return defaultHasPermission;
}
@Override
diff --git a/src/main/java/nl/svenar/powerranks/data/PowerRanksVerbose.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/PowerRanksVerbose.java
similarity index 97%
rename from src/main/java/nl/svenar/powerranks/data/PowerRanksVerbose.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/PowerRanksVerbose.java
index 71820b67..501b5795 100644
--- a/src/main/java/nl/svenar/powerranks/data/PowerRanksVerbose.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/PowerRanksVerbose.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.data;
+package nl.svenar.powerranks.bukkit.data;
import java.io.BufferedReader;
import java.io.File;
@@ -9,7 +9,7 @@
import java.util.ArrayList;
import java.util.Date;
-import nl.svenar.powerranks.PowerRanks;
+import nl.svenar.powerranks.bukkit.PowerRanks;
public class PowerRanksVerbose {
diff --git a/src/main/java/nl/svenar/powerranks/data/TablistAnimation.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/TablistAnimation.java
similarity index 94%
rename from src/main/java/nl/svenar/powerranks/data/TablistAnimation.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/TablistAnimation.java
index 615164d9..864e32e4 100644
--- a/src/main/java/nl/svenar/powerranks/data/TablistAnimation.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/TablistAnimation.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.data;
+package nl.svenar.powerranks.bukkit.data;
import java.util.ArrayList;
diff --git a/src/main/java/nl/svenar/powerranks/data/TablistManager.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/TablistManager.java
similarity index 96%
rename from src/main/java/nl/svenar/powerranks/data/TablistManager.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/TablistManager.java
index b22f2ee7..24735928 100644
--- a/src/main/java/nl/svenar/powerranks/data/TablistManager.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/TablistManager.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.data;
+package nl.svenar.powerranks.bukkit.data;
import java.time.Duration;
import java.time.Instant;
@@ -11,13 +11,13 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.common.utils.PRUtil;
-import nl.svenar.common.utils.PowerColor;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.common.utils.PowerColor;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
diff --git a/src/main/java/nl/svenar/powerranks/data/Users.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/Users.java
similarity index 97%
rename from src/main/java/nl/svenar/powerranks/data/Users.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/Users.java
index 301e2d8e..cfdb1ead 100644
--- a/src/main/java/nl/svenar/powerranks/data/Users.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/data/Users.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.data;
+package nl.svenar.powerranks.bukkit.data;
import java.util.ArrayList;
import java.util.HashMap;
@@ -13,14 +13,14 @@
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
-// import nl.svenar.PowerRanks.Cache.CachedConfig;
-import nl.svenar.common.structure.PRPermission;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.common.utils.PRUtil;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
+// import nl.svenar.powerranks.bukkit.cache.CachedConfig;
+import nl.svenar.powerranks.common.structure.PRPermission;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
public class Users implements Listener {
PowerRanks m;
@@ -712,7 +712,7 @@ public boolean addPlayerPermission(String targetPlayerName, String permission, b
if (targetPlayer != null) {
try {
- List list = targetPlayer.getPermissions();
+ Set list = targetPlayer.getPermissions();
PRPermission targetPermission = null;
for (PRPermission prPermission : list) {
if (prPermission.getName().equals(permission)) {
@@ -744,7 +744,7 @@ public boolean delPlayerPermission(String target_player_name, String permission)
if (target_player != null) {
try {
if (CacheManager.getPlayer(target_player.getUniqueId().toString()) != null) {
- List list = CacheManager.getPlayer(target_player.getUniqueId().toString())
+ Set list = CacheManager.getPlayer(target_player.getUniqueId().toString())
.getPermissions();
PRPermission targetPermission = null;
for (PRPermission prPermission : list) {
@@ -775,7 +775,7 @@ public boolean delPlayerPermission(String target_player_name, String permission)
if (uuid.length() > 0) {
if (CacheManager.getPlayer(uuid) != null) {
- List list = CacheManager.getPlayer(uuid).getPermissions();
+ Set list = CacheManager.getPlayer(uuid).getPermissions();
PRPermission targetPermission = null;
for (PRPermission prPermission : list) {
if (prPermission.getName().equals(permission)) {
@@ -810,8 +810,8 @@ public boolean delPlayerPermission(String target_player_name, String permission)
return false;
}
- public List getPlayerPermissions(String playername) {
- List list = new ArrayList();
+ public Set getPlayerPermissions(String playername) {
+ Set list = new HashSet();
Player player = Bukkit.getServer().getPlayer(playername);
if (player == null)
@@ -1041,7 +1041,7 @@ public String getUserTagValue(Player player) {
return "";
}
- String usertag = targetPlayer.getUsertags().get(0);
+ String usertag = targetPlayer.getUsertags().iterator().next();
if (usertag.length() > 0) {
return getUserTagValue(usertag);
}
@@ -1058,7 +1058,7 @@ public boolean clearUserTag(String playername) {
return false;
}
- targetPlayer.setUsertags(new ArrayList());
+ targetPlayer.setUsertags(new HashSet());
return true;
}
diff --git a/src/main/java/nl/svenar/powerranks/events/ChatTabExecutor.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/ChatTabExecutor.java
similarity index 88%
rename from src/main/java/nl/svenar/powerranks/events/ChatTabExecutor.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/ChatTabExecutor.java
index f7528a31..32b8e206 100644
--- a/src/main/java/nl/svenar/powerranks/events/ChatTabExecutor.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/ChatTabExecutor.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.events;
+package nl.svenar.powerranks.bukkit.events;
import java.util.ArrayList;
import java.util.Arrays;
@@ -8,8 +8,8 @@
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.commands.PowerCommandHandler;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.commands.PowerCommandHandler;
public class ChatTabExecutor implements TabCompleter {
diff --git a/src/main/java/nl/svenar/powerranks/events/OnBlockChange.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnBlockChange.java
similarity index 91%
rename from src/main/java/nl/svenar/powerranks/events/OnBlockChange.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnBlockChange.java
index 01d69c51..ea841de8 100644
--- a/src/main/java/nl/svenar/powerranks/events/OnBlockChange.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnBlockChange.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.events;
+package nl.svenar.powerranks.bukkit.events;
import java.io.File;
import java.util.Map.Entry;
@@ -16,10 +16,10 @@
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.MoistureChangeEvent;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.addons.PowerRanksAddon;
-import nl.svenar.powerranks.addons.PowerRanksPlayer;
-import nl.svenar.powerranks.addons.PowerRanksAddon.BlockChangeCause;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksAddon;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksPlayer;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksAddon.BlockChangeCause;
public class OnBlockChange implements Listener {
diff --git a/src/main/java/nl/svenar/powerranks/events/OnChat.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnChat.java
similarity index 88%
rename from src/main/java/nl/svenar/powerranks/events/OnChat.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnChat.java
index c4b5bec5..a177efc7 100644
--- a/src/main/java/nl/svenar/powerranks/events/OnChat.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnChat.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.events;
+package nl.svenar.powerranks.bukkit.events;
import java.io.File;
import java.util.ArrayList;
@@ -6,6 +6,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.Set;
import java.util.Map.Entry;
import org.bukkit.ChatColor;
@@ -14,16 +15,15 @@
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.common.utils.PRUtil;
-import nl.svenar.common.utils.PowerColor;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.addons.PowerRanksAddon;
-import nl.svenar.powerranks.addons.PowerRanksPlayer;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.common.utils.PowerColor;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksAddon;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksPlayer;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
import com.google.common.collect.ImmutableMap;
@@ -92,7 +92,7 @@ public void onPlayerChat(final AsyncPlayerChatEvent e) {
PRPlayer targetPlayer = CacheManager.getPlayer(player.getUniqueId().toString());
Map, ?> availableUsertags = PowerRanks.getUsertagManager().getMap("usertags",
new HashMap());
- ArrayList playerUsertags = targetPlayer.getUsertags();
+ Set playerUsertags = targetPlayer.getUsertags();
for (String playerUsertag : playerUsertags) {
String value = "";
@@ -132,7 +132,7 @@ public void onPlayerChat(final AsyncPlayerChatEvent e) {
"" + PowerColor.UNFORMATTED_COLOR_CHAR);
}
- format = Util.powerFormatter(
+ format = PRUtil.powerFormatter(
format, ImmutableMap.builder().put("prefix", formatted_prefix)
.put("suffix", formatted_suffix)
.put("usertag",
diff --git a/src/main/java/nl/svenar/powerranks/events/OnInteract.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnInteract.java
similarity index 82%
rename from src/main/java/nl/svenar/powerranks/events/OnInteract.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnInteract.java
index fa09407f..b833d990 100644
--- a/src/main/java/nl/svenar/powerranks/events/OnInteract.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnInteract.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.events;
+package nl.svenar.powerranks.bukkit.events;
import java.util.ArrayList;
import java.util.List;
@@ -7,21 +7,23 @@
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
+import org.bukkit.block.sign.Side;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.external.VaultHook;
-import nl.svenar.powerranks.gui.GUI;
-import nl.svenar.powerranks.gui.GUIPage.GUI_PAGE_ID;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.data.Users;
+import nl.svenar.powerranks.bukkit.external.VaultHook;
+import nl.svenar.powerranks.bukkit.gui.GUI;
+import nl.svenar.powerranks.bukkit.gui.GUIPage.GUI_PAGE_ID;
+import nl.svenar.powerranks.bukkit.util.Util;
public class OnInteract implements Listener {
@@ -45,12 +47,31 @@ public void onPlayerInteract(PlayerInteractEvent event) {
}
}
+ @SuppressWarnings("deprecation")
private void handlePowerRanksSign(Sign sign, Player player) {
final Users users = new Users(this.plugin);
- String sign_command = sign.getLine(1);
- String sign_argument = sign.getLine(2);
- String sign_argument2 = sign.getLine(3);
- boolean sign_error = sign.getLine(3).toLowerCase().contains("error");
+ String sign_command;
+ String sign_argument;
+ String sign_argument2;
+ boolean sign_error;
+
+ try {
+ Class.forName("org.bukkit.block.sign.Side");
+ Side signSide = Side.FRONT;
+ sign_command = sign.getSide(signSide).getLine(1);
+ if (sign_command.length() == 0) {
+ signSide = Side.BACK;
+ sign_command = sign.getSide(signSide).getLine(1);
+ }
+ sign_argument = sign.getSide(signSide).getLine(2);
+ sign_argument2 = sign.getSide(signSide).getLine(3);
+ sign_error = sign.getSide(signSide).getLine(3).toLowerCase().contains("error");
+ } catch (ClassNotFoundException e) {
+ sign_command = sign.getLine(1);
+ sign_argument = sign.getLine(2);
+ sign_argument2 = sign.getLine(3);
+ sign_error = sign.getLine(3).toLowerCase().contains("error");
+ }
if (!sign_error) {
// if (sign_command.equalsIgnoreCase("promote")) {
@@ -78,7 +99,7 @@ private void handlePowerRanksSign(Sign sign, Player player) {
if (rank != null) {
PRPlayerRank playerRank = new PRPlayerRank(rank.getName());
CacheManager.getPlayer(player.getUniqueId().toString()).setRank(playerRank);
- player.sendMessage(Util.powerFormatter(
+ player.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands.setrank.success-receiver"),
ImmutableMap.builder()
@@ -99,7 +120,7 @@ private void handlePowerRanksSign(Sign sign, Player player) {
CacheManager.getPlayer(player.getUniqueId().toString()).addRank(playerRank);
// Messages.messageSetRankSuccessSender(player, t, rank);
- player.sendMessage(Util.powerFormatter(
+ player.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands.setrank.success-receiver"),
ImmutableMap.builder()
@@ -120,7 +141,7 @@ private void handlePowerRanksSign(Sign sign, Player player) {
playerRanks.add(rank.getName());
}
if (playerRanks.size() > 0) {
- player.sendMessage(Util.powerFormatter(
+ player.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage("commands.checkrank.success-self"),
ImmutableMap.builder()
@@ -129,7 +150,7 @@ private void handlePowerRanksSign(Sign sign, Player player) {
.build(),
'[', ']'));
} else {
- player.sendMessage(Util.powerFormatter(
+ player.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager()
.getFormattedMessage(
"commands.checkrank.success-self-none"),
@@ -153,7 +174,7 @@ private void handlePowerRanksSign(Sign sign, Player player) {
if (player.hasPermission("powerranks.signs.usertag")) {
if (users.setUserTag(player, sign_argument)) {
if (sign_argument.length() > 0) {
- player.sendMessage(Util.powerFormatter(
+ player.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands.setusertag.success"),
ImmutableMap.builder()
@@ -162,7 +183,7 @@ private void handlePowerRanksSign(Sign sign, Player player) {
.build(),
'[', ']'));
} else {
- player.sendMessage(Util.powerFormatter(
+ player.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands.clearusertag.success"),
ImmutableMap.builder()
@@ -172,7 +193,7 @@ private void handlePowerRanksSign(Sign sign, Player player) {
'[', ']'));
}
} else {
- player.sendMessage(Util.powerFormatter(
+ player.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands.setusertag.failed"),
ImmutableMap.builder()
@@ -204,7 +225,7 @@ private void handlePowerRanksSign(Sign sign, Player player) {
PRPlayerRank playerRank = new PRPlayerRank(rank.getName());
CacheManager.getPlayer(player.getUniqueId().toString()).addRank(playerRank);
- player.sendMessage(Util.powerFormatter(
+ player.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands.setrank.success-receiver"),
ImmutableMap.builder()
@@ -215,7 +236,7 @@ private void handlePowerRanksSign(Sign sign, Player player) {
}
}
// users.setGroup(player, users.getRankIgnoreCase(sign_argument), true);
- player.sendMessage(Util.powerFormatter(
+ player.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands.buyrank.success-buy"),
ImmutableMap.builder()
@@ -224,7 +245,7 @@ private void handlePowerRanksSign(Sign sign, Player player) {
.build(),
'[', ']'));
} else {
- player.sendMessage(Util.powerFormatter(
+ player.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands.buyrank.failed-buy-not-enough-money"),
ImmutableMap.builder()
@@ -234,7 +255,7 @@ private void handlePowerRanksSign(Sign sign, Player player) {
'[', ']'));
}
} else {
- player.sendMessage(Util.powerFormatter(
+ player.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands.buyrank.failed-buy-not-enough-money"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/events/OnInventory.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnInventory.java
similarity index 86%
rename from src/main/java/nl/svenar/powerranks/events/OnInventory.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnInventory.java
index 64785395..8ec6c680 100644
--- a/src/main/java/nl/svenar/powerranks/events/OnInventory.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnInventory.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.events;
+package nl.svenar.powerranks.bukkit.events;
import org.bukkit.event.EventHandler;
@@ -7,8 +7,8 @@
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.inventory.Inventory;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.gui.GUI;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.gui.GUI;
import org.bukkit.event.Listener;
diff --git a/src/main/java/nl/svenar/powerranks/events/OnJoin.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnJoin.java
similarity index 87%
rename from src/main/java/nl/svenar/powerranks/events/OnJoin.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnJoin.java
index 25f22338..b794da25 100644
--- a/src/main/java/nl/svenar/powerranks/events/OnJoin.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnJoin.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.events;
+package nl.svenar.powerranks.bukkit.events;
import java.io.File;
import java.util.Date;
@@ -10,12 +10,12 @@
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.addons.PowerRanksAddon;
-import nl.svenar.powerranks.addons.PowerRanksPlayer;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.data.PowerRanksVerbose;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksAddon;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksPlayer;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.data.PowerRanksVerbose;
public class OnJoin implements Listener {
PowerRanks plugin;
diff --git a/src/main/java/nl/svenar/powerranks/events/OnMove.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnMove.java
similarity index 79%
rename from src/main/java/nl/svenar/powerranks/events/OnMove.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnMove.java
index 634c22ba..3077b62f 100644
--- a/src/main/java/nl/svenar/powerranks/events/OnMove.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnMove.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.events;
+package nl.svenar.powerranks.bukkit.events;
import java.io.File;
import java.util.Map.Entry;
@@ -8,9 +8,9 @@
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.addons.PowerRanksAddon;
-import nl.svenar.powerranks.addons.PowerRanksPlayer;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksAddon;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksPlayer;
public class OnMove implements Listener {
diff --git a/src/main/java/nl/svenar/powerranks/events/OnPreCommand.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnPreCommand.java
similarity index 94%
rename from src/main/java/nl/svenar/powerranks/events/OnPreCommand.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnPreCommand.java
index 97b973ff..04c56452 100644
--- a/src/main/java/nl/svenar/powerranks/events/OnPreCommand.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnPreCommand.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.events;
+package nl.svenar.powerranks.bukkit.events;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
@@ -7,7 +7,7 @@
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.server.ServerCommandEvent;
-import nl.svenar.powerranks.PowerRanks;
+import nl.svenar.powerranks.bukkit.PowerRanks;
public class OnPreCommand implements Listener {
diff --git a/src/main/java/nl/svenar/powerranks/events/OnSignChanged.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnSignChanged.java
similarity index 85%
rename from src/main/java/nl/svenar/powerranks/events/OnSignChanged.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnSignChanged.java
index 6ad6858e..45244dad 100644
--- a/src/main/java/nl/svenar/powerranks/events/OnSignChanged.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnSignChanged.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.events;
+package nl.svenar.powerranks.bukkit.events;
import java.util.List;
import java.util.Set;
@@ -9,10 +9,11 @@
import org.bukkit.event.Listener;
import org.bukkit.event.block.SignChangeEvent;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.data.Users;
+import nl.svenar.powerranks.bukkit.util.Util;
public class OnSignChanged implements Listener {
@@ -38,7 +39,7 @@ public void onSignChange(SignChangeEvent event) {
if (sign_command.equalsIgnoreCase("promote") || sign_command.equalsIgnoreCase("demote")
|| sign_command.equalsIgnoreCase("checkrank") || sign_command.equalsIgnoreCase("gui")) {
- event.getPlayer().sendMessage(Util.powerFormatter(
+ event.getPlayer().sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"messages.signs.created"),
ImmutableMap.builder()
@@ -56,7 +57,7 @@ public void onSignChange(SignChangeEvent event) {
}
if (!rank_exists) {
- event.getPlayer().sendMessage(Util.powerFormatter(
+ event.getPlayer().sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"general.rank-not-found"),
ImmutableMap.builder()
@@ -66,7 +67,7 @@ public void onSignChange(SignChangeEvent event) {
'[', ']'));
event.setLine(3, PowerRanks.chatColor("&4Error", true));
} else {
- event.getPlayer().sendMessage(Util.powerFormatter(
+ event.getPlayer().sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"messages.signs.created"),
ImmutableMap.builder()
@@ -88,7 +89,7 @@ public void onSignChange(SignChangeEvent event) {
usertag_exists = true;
}
if (!usertag_exists) {
- event.getPlayer().sendMessage(Util.powerFormatter(
+ event.getPlayer().sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"messages.usertags.not-found"),
ImmutableMap.builder()
@@ -98,7 +99,7 @@ public void onSignChange(SignChangeEvent event) {
'[', ']'));
event.setLine(3, PowerRanks.chatColor("&4Error", true));
} else {
- event.getPlayer().sendMessage(Util.powerFormatter(
+ event.getPlayer().sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"messages.signs.created"),
ImmutableMap.builder()
@@ -109,7 +110,7 @@ public void onSignChange(SignChangeEvent event) {
} else if (sign_command.equalsIgnoreCase("rankup")) {
List ranks = s.getGroups();
if (sign_argument.length() == 0) {
- event.getPlayer().sendMessage(Util.powerFormatter(
+ event.getPlayer().sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"messages.signs.created"),
ImmutableMap.builder()
@@ -125,7 +126,7 @@ public void onSignChange(SignChangeEvent event) {
}
}
if (!rank_exists) {
- event.getPlayer().sendMessage(Util.powerFormatter(
+ event.getPlayer().sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"general.rank-not-found"),
ImmutableMap.builder()
@@ -137,7 +138,7 @@ public void onSignChange(SignChangeEvent event) {
} else {
if (sign_argument2.length() > 0) {
if (!sign_argument2.chars().anyMatch(Character::isLetter)) {
- event.getPlayer().sendMessage(Util.powerFormatter(
+ event.getPlayer().sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"messages.signs.created"),
ImmutableMap.builder()
@@ -145,7 +146,7 @@ public void onSignChange(SignChangeEvent event) {
.build(),
'[', ']'));
} else {
- event.getPlayer().sendMessage(Util.powerFormatter(
+ event.getPlayer().sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"messages.signs.unknown-command"),
ImmutableMap.builder()
@@ -156,7 +157,7 @@ public void onSignChange(SignChangeEvent event) {
}
} else {
event.setLine(3, String.valueOf(s.getRankCost(s.getRankIgnoreCase(sign_argument))));
- event.getPlayer().sendMessage(Util.powerFormatter(
+ event.getPlayer().sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"messages.signs.created"),
ImmutableMap.builder()
@@ -168,7 +169,7 @@ public void onSignChange(SignChangeEvent event) {
}
}
} else {
- event.getPlayer().sendMessage(Util.powerFormatter(
+ event.getPlayer().sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"messages.signs.unknown-command"),
ImmutableMap.builder()
diff --git a/src/main/java/nl/svenar/powerranks/events/OnWorldChange.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnWorldChange.java
similarity index 76%
rename from src/main/java/nl/svenar/powerranks/events/OnWorldChange.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnWorldChange.java
index 6506afdd..81e7b879 100644
--- a/src/main/java/nl/svenar/powerranks/events/OnWorldChange.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/events/OnWorldChange.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.events;
+package nl.svenar.powerranks.bukkit.events;
import java.io.File;
import java.util.Map.Entry;
@@ -8,11 +8,11 @@
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChangedWorldEvent;
-import nl.svenar.common.structure.PRPlayer;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.addons.PowerRanksAddon;
-import nl.svenar.powerranks.addons.PowerRanksPlayer;
-import nl.svenar.powerranks.cache.CacheManager;
+import nl.svenar.powerranks.common.structure.PRPlayer;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksAddon;
+import nl.svenar.powerranks.bukkit.addons.PowerRanksPlayer;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
public class OnWorldChange implements Listener {
PowerRanks powerRanks;
diff --git a/src/main/java/nl/svenar/powerranks/external/DeluxeTagsHook.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/external/DeluxeTagsHook.java
similarity index 92%
rename from src/main/java/nl/svenar/powerranks/external/DeluxeTagsHook.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/external/DeluxeTagsHook.java
index a9bcbb45..2c0e3dec 100644
--- a/src/main/java/nl/svenar/powerranks/external/DeluxeTagsHook.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/external/DeluxeTagsHook.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.external;
+package nl.svenar.powerranks.bukkit.external;
import java.util.List;
@@ -7,7 +7,7 @@
import me.clip.deluxetags.DeluxeTags;
import me.clip.deluxetags.tags.DeluxeTag;
-import nl.svenar.powerranks.PowerRanks;
+import nl.svenar.powerranks.bukkit.PowerRanks;
public class DeluxeTagsHook {
diff --git a/src/main/java/nl/svenar/powerranks/external/PowerRanksExpansion.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/external/PowerRanksExpansion.java
similarity index 95%
rename from src/main/java/nl/svenar/powerranks/external/PowerRanksExpansion.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/external/PowerRanksExpansion.java
index 6fca0479..fdb7fba5 100644
--- a/src/main/java/nl/svenar/powerranks/external/PowerRanksExpansion.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/external/PowerRanksExpansion.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.external;
+package nl.svenar.powerranks.bukkit.external;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -9,12 +9,12 @@
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.common.utils.PRUtil;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.data.Users;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.data.Users;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
/**
diff --git a/src/main/java/nl/svenar/powerranks/external/PowerRanksVaultChat.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/external/PowerRanksVaultChat.java
similarity index 93%
rename from src/main/java/nl/svenar/powerranks/external/PowerRanksVaultChat.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/external/PowerRanksVaultChat.java
index 9add845d..07503bd6 100644
--- a/src/main/java/nl/svenar/powerranks/external/PowerRanksVaultChat.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/external/PowerRanksVaultChat.java
@@ -1,12 +1,11 @@
-package nl.svenar.powerranks.external;
+package nl.svenar.powerranks.bukkit.external;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.common.utils.PRUtil;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.api.PowerRanksAPI;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.data.Users;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.data.Users;
import java.util.ArrayList;
import java.util.List;
@@ -17,13 +16,11 @@
public class PowerRanksVaultChat extends Chat {
final PowerRanks plugin;
final Users users;
- final PowerRanksAPI prapi;
public PowerRanksVaultChat(PowerRanks plugin, Permission perms) {
super(perms);
this.plugin = plugin;
this.users = new Users(plugin);
- this.prapi = new PowerRanksAPI(plugin);
}
@Override
diff --git a/src/main/java/nl/svenar/powerranks/external/PowerRanksVaultPermission.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/external/PowerRanksVaultPermission.java
similarity index 87%
rename from src/main/java/nl/svenar/powerranks/external/PowerRanksVaultPermission.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/external/PowerRanksVaultPermission.java
index 3173d21e..10d59579 100644
--- a/src/main/java/nl/svenar/powerranks/external/PowerRanksVaultPermission.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/external/PowerRanksVaultPermission.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.external;
+package nl.svenar.powerranks.bukkit.external;
import java.util.ArrayList;
import java.util.List;
@@ -7,14 +7,13 @@
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitScheduler;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.common.utils.PRUtil;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.api.PowerRanksAPI;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.data.PowerRanksVerbose;
-import nl.svenar.powerranks.data.Users;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.data.PowerRanksVerbose;
+import nl.svenar.powerranks.bukkit.data.Users;
import com.google.common.collect.Iterables;
@@ -24,13 +23,11 @@
public class PowerRanksVaultPermission extends Permission {
final PowerRanks plugin;
final Users users;
- final PowerRanksAPI prapi;
private boolean playerHasErrorQueueOffline = false;
PowerRanksVaultPermission(PowerRanks plugin) {
this.plugin = plugin;
this.users = new Users(plugin);
- this.prapi = new PowerRanksAPI(plugin);
}
@Override
@@ -97,13 +94,13 @@ public boolean groupHas(String world, String name, String permission) {
@Override
public boolean groupAdd(final String world, String name, final String permission) {
PowerRanksVerbose.log("PowerRanksVaultPermission.groupAdd(...)", "Called");
- return prapi.addPermission(name, permission);
+ return false; // return prapi.addPermission(name, permission); // TODO: add support
}
@Override
public boolean groupRemove(final String world, String name, final String permission) {
PowerRanksVerbose.log("PowerRanksVaultPermission.groupRemove(...)", "Called");
- return prapi.removePermission(name, permission);
+ return false; // return prapi.removePermission(name, permission); // TODO: add support
}
@@ -145,7 +142,7 @@ public void run() {
@Override
public boolean playerAdd(final String world, OfflinePlayer player, final String permission) {
PowerRanksVerbose.log("PowerRanksVaultPermission.playerAdd(...)", "Called, player: " + player.getName());
- return prapi.addPermission(player.getPlayer(), permission);
+ return false; // return prapi.addPermission(player.getPlayer(), permission); // TODO: add support
}
@Override
@@ -166,20 +163,20 @@ public boolean playerAddTransient(Player player, String permission) {
public boolean playerAddTransient(final String worldName, OfflinePlayer player, final String permission) {
PowerRanksVerbose.log("PowerRanksVaultPermission.playerAddTransient(...)",
"Called, player: " + player.getName());
- return prapi.addPermission(player.getPlayer(), permission);
+ return false; // return prapi.addPermission(player.getPlayer(), permission); // TODO: add support
}
@Override
public boolean playerRemoveTransient(final String worldName, OfflinePlayer player, final String permission) {
PowerRanksVerbose.log("PowerRanksVaultPermission.playerRemoveTransient(...)",
"Called, player: " + player.getName());
- return prapi.removePermission(player.getPlayer(), permission);
+ return false; // return prapi.removePermission(player.getPlayer(), permission); // TODO: add support
}
@Override
public boolean playerRemove(final String world, OfflinePlayer player, final String permission) {
PowerRanksVerbose.log("PowerRanksVaultPermission.playerRemove(...)", "Called, player: " + player.getName());
- return prapi.removePermission(player.getPlayer(), permission);
+ return false; // return prapi.removePermission(player.getPlayer(), permission); // TODO: add support
}
@Override
@@ -199,20 +196,20 @@ public boolean playerRemoveTransient(OfflinePlayer player, String permission) {
@Override
public boolean playerInGroup(String world, OfflinePlayer player, String group) {
PowerRanksVerbose.log("PowerRanksVaultPermission.playerInGroup(...)", "Called, player: " + player.getName());
- return prapi.getSubranks(player.getPlayer()).contains(group);
+ return false; // return prapi.getSubranks(player.getPlayer()).contains(group); // TODO: add support
}
@Override
public boolean playerAddGroup(final String world, OfflinePlayer player, final String group) {
PowerRanksVerbose.log("PowerRanksVaultPermission.playerAddGroup(...)", "Called, player: " + player.getName());
- return prapi.addSubrank(player.getPlayer(), group);
+ return false; // return prapi.addSubrank(player.getPlayer(), group); // TODO: add support
}
@Override
public boolean playerRemoveGroup(final String world, OfflinePlayer player, final String group) {
PowerRanksVerbose.log("PowerRanksVaultPermission.playerRemoveGroup(...)",
"Called, player: " + player.getName());
- return prapi.removeSubrank(player.getPlayer(), group);
+ return false; // return prapi.removeSubrank(player.getPlayer(), group); // TODO: add support
}
@Override
diff --git a/src/main/java/nl/svenar/powerranks/external/VaultHook.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/external/VaultHook.java
similarity index 94%
rename from src/main/java/nl/svenar/powerranks/external/VaultHook.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/external/VaultHook.java
index ec77b799..f05c53b1 100644
--- a/src/main/java/nl/svenar/powerranks/external/VaultHook.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/external/VaultHook.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.external;
+package nl.svenar.powerranks.bukkit.external;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
@@ -8,7 +8,7 @@
import net.milkbowl.vault.chat.Chat;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.permission.Permission;
-import nl.svenar.powerranks.PowerRanks;
+import nl.svenar.powerranks.bukkit.PowerRanks;
public class VaultHook {
diff --git a/src/main/java/nl/svenar/powerranks/gui/GUI.java b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/gui/GUI.java
similarity index 88%
rename from src/main/java/nl/svenar/powerranks/gui/GUI.java
rename to Bukkit/src/main/java/nl/svenar/powerranks/bukkit/gui/GUI.java
index ef503536..f2f909c8 100644
--- a/src/main/java/nl/svenar/powerranks/gui/GUI.java
+++ b/Bukkit/src/main/java/nl/svenar/powerranks/bukkit/gui/GUI.java
@@ -1,4 +1,4 @@
-package nl.svenar.powerranks.gui;
+package nl.svenar.powerranks.bukkit.gui;
import java.util.HashMap;
@@ -8,14 +8,14 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
-import nl.svenar.common.structure.PRPlayerRank;
-import nl.svenar.common.structure.PRRank;
-import nl.svenar.powerranks.PowerRanks;
-import nl.svenar.powerranks.cache.CacheManager;
-import nl.svenar.powerranks.data.Users;
-import nl.svenar.powerranks.external.VaultHook;
-import nl.svenar.powerranks.gui.GUIPage.GUI_PAGE_ID;
-import nl.svenar.powerranks.util.Util;
+import nl.svenar.powerranks.common.structure.PRPlayerRank;
+import nl.svenar.powerranks.common.structure.PRRank;
+import nl.svenar.powerranks.common.utils.PRUtil;
+import nl.svenar.powerranks.bukkit.PowerRanks;
+import nl.svenar.powerranks.bukkit.cache.CacheManager;
+import nl.svenar.powerranks.bukkit.data.Users;
+import nl.svenar.powerranks.bukkit.external.VaultHook;
+import nl.svenar.powerranks.bukkit.gui.GUIPage.GUI_PAGE_ID;
public class GUI {
@@ -91,7 +91,7 @@ public static void clickedItem(Player player, int slot) {
if (rank != null) {
PRPlayerRank playerRank = new PRPlayerRank(rank.getName());
CacheManager.getPlayer(player.getUniqueId().toString()).setRank(playerRank);
- player.sendMessage(Util.powerFormatter(
+ player.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands.setrank.success-receiver"),
ImmutableMap.builder()
@@ -112,7 +112,7 @@ public static void clickedItem(Player player, int slot) {
.replaceAll("%rankname%", rankname));
}
}
- player.sendMessage(Util.powerFormatter(
+ player.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands.buyrank.success-buy"),
ImmutableMap.builder()
@@ -121,7 +121,7 @@ public static void clickedItem(Player player, int slot) {
.build(),
'[', ']'));
} else {
- player.sendMessage(Util.powerFormatter(
+ player.sendMessage(PRUtil.powerFormatter(
PowerRanks.getLanguageManager().getFormattedMessage(
"commands.buyrank.failed-buy-not-enough-money"),
ImmutableMap.