mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 21:17:32 +00:00
Tab Handling GUI
This commit is contained in:
1 parent
ad4033ed62
commit
65e29e42dd
29 files changed
+2961
-304
No files matched your search
@@ -0,0 +1,59 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class CloneFolder {
|
||||
public String name;
|
||||
public long createdDate;
|
||||
|
||||
public CloneFolder() {
|
||||
this.name = "";
|
||||
this.createdDate = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public CloneFolder(String name) {
|
||||
this.name = name;
|
||||
this.createdDate = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound compound) {
|
||||
name = compound.getString("Name");
|
||||
createdDate = compound.getLong("Created");
|
||||
}
|
||||
|
||||
public NBTTagCompound writeNBT(NBTTagCompound compound) {
|
||||
compound.setString("Name", name);
|
||||
compound.setLong("Created", createdDate);
|
||||
return compound;
|
||||
}
|
||||
|
||||
public String getDirName() {
|
||||
return "folder_" + name;
|
||||
}
|
||||
|
||||
public static boolean isValidName(String name) {
|
||||
if (name == null || name.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (name.length() > 32) {
|
||||
return false;
|
||||
}
|
||||
if (!name.equals(name.trim())) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
Integer.parseInt(name);
|
||||
return false;
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
for (char c : name.toCharArray()) {
|
||||
if (c == '/' || c == '\\' || c == ':' || c == '*' || c == '?' || c == '"' || c == '<' || c == '>' || c == '|') {
|
||||
return false;
|
||||
}
|
||||
if (c < 32) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user