Move listing to iris dims

This commit is contained in:
Daniel Mills 2020-10-19 03:27:56 -04:00
parent fa0a5efb25
commit 6775edddab
3 changed files with 12 additions and 11 deletions

View File

@ -56,7 +56,7 @@ public class CommandIrisObjectPaste extends MortarCommand
if(file == null || !file.exists()) if(file == null || !file.exists())
{ {
sender.sendMessage("Can't find " + args[0] + " in the " + ProjectManager.workspaceName + " folder"); sender.sendMessage("Can't find " + args[0] + " in the " + ProjectManager.WORKSPACE_NAME + " folder");
} }
ItemStack wand = sender.player().getInventory().getItemInMainHand(); ItemStack wand = sender.player().getInventory().getItemInMainHand();

View File

@ -43,7 +43,7 @@ public class IrisDataManager
public IrisDataManager(File dataFolder) public IrisDataManager(File dataFolder)
{ {
this.dataFolder = dataFolder; this.dataFolder = dataFolder;
this.packs = new File(dataFolder, ProjectManager.workspaceName); this.packs = new File(dataFolder, ProjectManager.WORKSPACE_NAME);
boolean pr = false; boolean pr = false;
if(!packs.exists()) if(!packs.exists())
{ {
@ -65,7 +65,7 @@ public class IrisDataManager
return; return;
} }
File packs = this.packs.getName().equals(ProjectManager.workspaceName) ? this.packs : dataFolder; File packs = this.packs.getName().equals(ProjectManager.WORKSPACE_NAME) ? this.packs : dataFolder;
packs.mkdirs(); packs.mkdirs();
this.lootLoader = new ResourceLoader<>(packs, "loot", "Loot", IrisLootTable.class); this.lootLoader = new ResourceLoader<>(packs, "loot", "Loot", IrisLootTable.class);
this.entityLoader = new ResourceLoader<>(packs, "entities", "Entity", IrisEntity.class); this.entityLoader = new ResourceLoader<>(packs, "entities", "Entity", IrisEntity.class);
@ -77,7 +77,7 @@ public class IrisDataManager
this.blockLoader = new ResourceLoader<>(packs, "blocks", "Block", IrisBlockData.class); this.blockLoader = new ResourceLoader<>(packs, "blocks", "Block", IrisBlockData.class);
this.objectLoader = new ObjectResourceLoader(packs, "objects", "Object"); this.objectLoader = new ObjectResourceLoader(packs, "objects", "Object");
if(packs.getName().equals(ProjectManager.workspaceName)) if(packs.getName().equals(ProjectManager.WORKSPACE_NAME))
{ {
writeExamples(); writeExamples();
} }

View File

@ -27,7 +27,8 @@ import lombok.Data;
@Data @Data
public class ProjectManager public class ProjectManager
{ {
public static final String workspaceName = "packs"; public static final String LISTING = "https://raw.githubusercontent.com/IrisDimensions/_listing/main/listing.json";
public static final String WORKSPACE_NAME = "packs";
private KMap<String, String> cacheListing = null; private KMap<String, String> cacheListing = null;
private IrisProject activeProject; private IrisProject activeProject;
@ -71,7 +72,7 @@ public class ProjectManager
{ {
if(i.isFile() && i.getName().equals(type + ".iris")) if(i.isFile() && i.getName().equals(type + ".iris"))
{ {
sender.sendMessage("Found " + type + ".iris in " + ProjectManager.workspaceName + " folder"); sender.sendMessage("Found " + type + ".iris in " + ProjectManager.WORKSPACE_NAME + " folder");
ZipUtil.unpack(i, iris); ZipUtil.unpack(i, iris);
break; break;
} }
@ -80,7 +81,7 @@ public class ProjectManager
else else
{ {
sender.sendMessage("Found " + type + " dimension in " + ProjectManager.workspaceName + " folder. Repackaging"); sender.sendMessage("Found " + type + " dimension in " + ProjectManager.WORKSPACE_NAME + " folder. Repackaging");
File f = new IrisProject(new File(getWorkspaceFolder(), type)).getPath(); File f = new IrisProject(new File(getWorkspaceFolder(), type)).getPath();
try try
@ -277,12 +278,12 @@ public class ProjectManager
if(cached) if(cached)
{ {
a = new JSONArray(Iris.getCached("cachedlisting", "https://raw.githubusercontent.com/VolmitSoftware/Iris/master/listing.json")); a = new JSONArray(Iris.getCached("cachedlisting", LISTING));
} }
else else
{ {
a = new JSONArray(Iris.getNonCached(!cached + "listing", "https://raw.githubusercontent.com/VolmitSoftware/Iris/master/listing.json")); a = new JSONArray(Iris.getNonCached(!cached + "listing", LISTING));
} }
KMap<String, String> l = new KMap<>(); KMap<String, String> l = new KMap<>();
@ -331,12 +332,12 @@ public class ProjectManager
public File getWorkspaceFolder(String... sub) public File getWorkspaceFolder(String... sub)
{ {
return Iris.instance.getDataFolderList(workspaceName, sub); return Iris.instance.getDataFolderList(WORKSPACE_NAME, sub);
} }
public File getWorkspaceFile(String... sub) public File getWorkspaceFile(String... sub)
{ {
return Iris.instance.getDataFileList(workspaceName, sub); return Iris.instance.getDataFileList(WORKSPACE_NAME, sub);
} }
public void close() public void close()