Update
This commit is contained in:
parent
dbc979b4c9
commit
63ec09f3f7
52 changed files with 286 additions and 195 deletions
|
|
@ -1,11 +1,11 @@
|
|||
package org.gsdistance.grimmsServer.Data;
|
||||
|
||||
public enum FactionRank {
|
||||
LEADER("Leader",4),
|
||||
OFFICER("Officer",3),
|
||||
MEMBER("Member",2),
|
||||
RECRUIT("Recruit",1),
|
||||
NONE("Not a member",0);
|
||||
LEADER("Leader", 4),
|
||||
OFFICER("Officer", 3),
|
||||
MEMBER("Member", 2),
|
||||
RECRUIT("Recruit", 1),
|
||||
NONE("Not a member", 0);
|
||||
|
||||
private final String displayName;
|
||||
public final Integer weight;
|
||||
|
|
@ -19,4 +19,22 @@ public enum FactionRank {
|
|||
public String toString() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public static FactionRank fromWeight(int weight) {
|
||||
for (FactionRank rank : values()) {
|
||||
if (rank.weight == weight) {
|
||||
return rank;
|
||||
}
|
||||
}
|
||||
return NONE; // Default to NONE if no match found
|
||||
}
|
||||
|
||||
public static FactionRank fromString(String name) {
|
||||
for (FactionRank rank : values()) {
|
||||
if (rank.displayName.equalsIgnoreCase(name)) {
|
||||
return rank;
|
||||
}
|
||||
}
|
||||
return NONE; // Default to NONE if no match found
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
package org.gsdistance.grimmsServer.Data;
|
||||
|
||||
public enum PlayerRank {
|
||||
DEFAULT("Default",0),
|
||||
VIP("Vip",1),
|
||||
MVP("MVP",2),
|
||||
MODERATOR("Moderator",3),
|
||||
ADMIN("Admin",4),
|
||||
OWNER("Owner",99),;
|
||||
DEFAULT("Default", 1),
|
||||
VIP("Vip", 2),
|
||||
MVP("MVP", 3),
|
||||
MODERATOR("Moderator", 4),
|
||||
ADMIN("Admin", 5),
|
||||
OWNER("Owner", 99),
|
||||
;
|
||||
|
||||
public final String name;
|
||||
public final Integer weight;
|
||||
|
|
@ -20,4 +21,22 @@ public enum PlayerRank {
|
|||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static PlayerRank fromWeight(int weight) {
|
||||
for (PlayerRank rank : values()) {
|
||||
if (rank.weight == weight) {
|
||||
return rank;
|
||||
}
|
||||
}
|
||||
return DEFAULT; // Default to DEFAULT if no match found
|
||||
}
|
||||
|
||||
public static PlayerRank fromString(String name) {
|
||||
for (PlayerRank rank : values()) {
|
||||
if (rank.name.equalsIgnoreCase(name)) {
|
||||
return rank;
|
||||
}
|
||||
}
|
||||
return DEFAULT; // Default to DEFAULT if no match found
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class PluginDataStorage {
|
|||
File writeFolder = new File(plugin.getDataFolder().getPath() + File.separatorChar + addedPath);
|
||||
File writeFile = new File(writeFolder.getPath() + File.separatorChar + fileName);
|
||||
if (!writeFolder.exists()) {
|
||||
writeFolder.mkdir();
|
||||
writeFolder.mkdirs(); // Use mkdirs() to create the full directory structure
|
||||
}
|
||||
if (!writeFile.exists()) {
|
||||
try {
|
||||
|
|
@ -70,7 +70,6 @@ public class PluginDataStorage {
|
|||
}
|
||||
File[] files = readFolder.listFiles();
|
||||
if (files == null || files.length == 0) {
|
||||
|
||||
return (T[]) java.lang.reflect.Array.newInstance(objectType, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue