mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-22 10:15:54 +01:00
FAWE support for pasting worldedit schematics
This commit is contained in:
parent
f155f3e694
commit
86394140e6
@ -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')
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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() };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user