Few tweaks to schematic loading and error fixes.

* Not all EntityTypes in Bukkit have the correct enum name.
* Don't read entire schematic files to list. Go off file extension only.
   (Reading in files is more accurate, but slow.)
* Enforce extensions. (Due to the above, while you can technically make a
   schematic called 'test.txt', it's better that we save it as
   'test.txt.schem'.)
* Fix a few minor warnings.
This commit is contained in:
wizjany
2019-03-08 16:00:42 -05:00
parent eebba8e324
commit 7c89ece96e
5 changed files with 38 additions and 20 deletions

View File

@ -160,7 +160,10 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
}
// Entity
for (org.bukkit.entity.EntityType entityType : org.bukkit.entity.EntityType.values()) {
EntityType.REGISTRY.register("minecraft:" + entityType.name().toLowerCase(), new EntityType("minecraft:" + entityType.name().toLowerCase()));
String mcid = entityType.getName();
if (mcid != null) {
EntityType.REGISTRY.register("minecraft:" + mcid.toLowerCase(), new EntityType("minecraft:" + mcid.toLowerCase()));
}
}
// Tags
try {