FAWE support for pasting worldedit schematics

This commit is contained in:
Esophose 2019-07-19 23:15:29 -06:00
parent f155f3e694
commit 86394140e6
3 changed files with 10 additions and 6 deletions

View File

@ -50,9 +50,6 @@ dependencies {
shade (group: 'org.apache.commons', name: 'commons-lang3', version: '3.0')
shade (group: 'commons-io', name: 'commons-io', version: '2.5')
// JetBrains Annotations
compile (group: 'org.jetbrains', name: 'annotations', version: '13.0')
// Songoda Updater
shade (group: 'com.songoda', name: 'songodaupdater', version: '1')

View File

@ -656,7 +656,8 @@ public class Entity implements Listener {
@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent event) {
if (event.getEntity() instanceof ArmorStand || event.getEntity() instanceof FallingBlock
if (event.getEntity() instanceof ArmorStand
|| event.getEntity() instanceof FallingBlock
|| event.getEntity() instanceof org.bukkit.entity.Item) {
return;
}

View File

@ -17,7 +17,7 @@ public class SchematicUtil {
if (!Bukkit.getPluginManager().isPluginEnabled("WorldEdit"))
throw new IllegalStateException("Tried to generate an island using a schematic file without WorldEdit installed!");
Bukkit.getScheduler().runTask(SkyBlock.getInstance(), () -> {
Runnable pasteTask = () -> {
if (NMSUtil.getVersionNumber() > 12) { // WorldEdit 7
com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat format = com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats.findByFile(schematicFile);
try (com.sk89q.worldedit.extent.clipboard.io.ClipboardReader reader = format.getReader(new FileInputStream(schematicFile))) {
@ -59,7 +59,13 @@ public class SchematicUtil {
e.printStackTrace();
}
}
});
};
if (Bukkit.getPluginManager().isPluginEnabled("FastAsyncWorldEdit")) {
Bukkit.getScheduler().runTaskAsynchronously(SkyBlock.getInstance(), pasteTask);
} else {
Bukkit.getScheduler().runTask(SkyBlock.getInstance(), pasteTask);
}
return new Float[] { location.getYaw(), location.getPitch() };
}