Merge branch 'dev' into syntax-highlighter-unified

This commit is contained in:
bigguy345 committed 2026-02-04 22:50:04 +02:00
commit b63d76b6c0
71 files changed
+3781 -400

No files matched your search

@@ -0,0 +1,61 @@
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 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;
}
if (name.equals(".") || name.equals("..")) {
return false;
}
if (name.startsWith("___")) {
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;
}
}
@@ -81,7 +81,7 @@ public class DataScript implements IScriptHandlerPacket {
public void readFromNBT(NBTTagCompound compound) {
scripts = readScript(compound.getTagList("ScriptsContainers", 10));
this.scriptLanguage = compound.getString("ScriptLanguage");
if (!ScriptController.Instance.languages.containsKey(scriptLanguage)) {
if (scriptLanguage == null || scriptLanguage.isEmpty()) {
if (!ScriptController.Instance.languages.isEmpty()) {
this.scriptLanguage = (String) ScriptController.Instance.languages.keySet().toArray()[0];
} else {
@@ -55,7 +55,7 @@ public abstract class MultiScriptHandler extends ScriptHandler implements IScrip
* Normalize the language to a valid one if the current language is not available.
*/
protected void normalizeLanguage() {
if (!ScriptController.Instance.languages.containsKey(this.scriptLanguage)) {
if (this.scriptLanguage == null || this.scriptLanguage.isEmpty()) {
if (!ScriptController.Instance.languages.isEmpty()) {
this.scriptLanguage = (String) ScriptController.Instance.languages.keySet().toArray()[0];
} else {
@@ -142,7 +142,7 @@ public abstract class SingleScriptHandler extends ScriptHandler {
* Normalize the language to a valid one if the current language is not available.
*/
protected void normalizeLanguage() {
if (!ScriptController.Instance.languages.containsKey(this.getLanguage())) {
if (this.getLanguage() == null || this.getLanguage().isEmpty()) {
if (!ScriptController.Instance.languages.isEmpty()) {
this.setLanguage((String) ScriptController.Instance.languages.keySet().toArray()[0]);
} else {
@@ -13,10 +13,18 @@ import java.util.UUID;
public class TagMap {
public int cloneTab;
public String cloneFolder;
public HashMap<String, HashSet<UUID>> tagMap;
public TagMap(int tab) {
this.cloneTab = tab;
this.cloneFolder = null;
this.tagMap = new HashMap<String, HashSet<UUID>>();
}
public TagMap(String folder) {
this.cloneTab = -1;
this.cloneFolder = folder;
this.tagMap = new HashMap<String, HashSet<UUID>>();
}