Move some platform stuff to load, put enable back to postworld.

This commit is contained in:
wizjany 2019-03-15 22:38:38 -04:00
parent 678a78a982
commit d1c2a029bf
2 changed files with 7 additions and 3 deletions

View File

@ -110,6 +110,8 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
*/ */
@Override @Override
public void onEnable() { public void onEnable() {
setupTags(); // these have to be done post-world since they rely on MC registries. the other ones just use Bukkit enums
PermissionsResolverManager.initialize(this); // Setup permission resolver PermissionsResolverManager.initialize(this); // Setup permission resolver
// Register CUI // Register CUI
@ -168,12 +170,15 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
EntityType.REGISTRY.register("minecraft:" + mcid.toLowerCase(), new EntityType("minecraft:" + mcid.toLowerCase())); EntityType.REGISTRY.register("minecraft:" + mcid.toLowerCase(), new EntityType("minecraft:" + mcid.toLowerCase()));
} }
} }
}
private void setupTags() {
// Tags // Tags
try { try {
for (org.bukkit.Tag<Material> blockTag : Bukkit.getTags(Tag.REGISTRY_BLOCKS, Material.class)) { for (Tag<Material> blockTag : Bukkit.getTags(Tag.REGISTRY_BLOCKS, Material.class)) {
BlockCategory.REGISTRY.register(blockTag.getKey().toString(), new BlockCategory(blockTag.getKey().toString())); BlockCategory.REGISTRY.register(blockTag.getKey().toString(), new BlockCategory(blockTag.getKey().toString()));
} }
for (org.bukkit.Tag<Material> itemTag : Bukkit.getTags(Tag.REGISTRY_ITEMS, Material.class)) { for (Tag<Material> itemTag : Bukkit.getTags(Tag.REGISTRY_ITEMS, Material.class)) {
ItemCategory.REGISTRY.register(itemTag.getKey().toString(), new ItemCategory(itemTag.getKey().toString())); ItemCategory.REGISTRY.register(itemTag.getKey().toString(), new ItemCategory(itemTag.getKey().toString()));
} }
} catch (NoSuchMethodError e) { } catch (NoSuchMethodError e) {

View File

@ -1,7 +1,6 @@
name: WorldEdit name: WorldEdit
main: com.sk89q.worldedit.bukkit.WorldEditPlugin main: com.sk89q.worldedit.bukkit.WorldEditPlugin
version: "${internalVersion}" version: "${internalVersion}"
load: STARTUP
api-version: 1.13 api-version: 1.13
# Permissions aren't here. Read http://wiki.sk89q.com/wiki/WEPIF/DinnerPerms # Permissions aren't here. Read http://wiki.sk89q.com/wiki/WEPIF/DinnerPerms