This commit is contained in:
YuTian 2024-08-16 10:13:14 +08:00
parent 8e6108dc9c
commit 23c490e26f

View File

@ -1,21 +1,11 @@
package com.yaohun.enderdragonwar.effect.types; package com.yaohun.enderdragonwar.effect.types;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.math.BlockVector3;
import com.yaohun.enderdragonwar.EnderDragonWar;
import com.yaohun.enderdragonwar.effect.GameGiftEffect; import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game; import com.yaohun.enderdragonwar.game.Game;
import org.bukkit.Bukkit; import com.yaohun.enderdragonwar.util.WEUtil;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.io.File;
public class SpawnBuildEffect extends GameGiftEffect { public class SpawnBuildEffect extends GameGiftEffect {
public SpawnBuildEffect(String audience) { public SpawnBuildEffect(String audience) {
@ -26,22 +16,7 @@ public class SpawnBuildEffect extends GameGiftEffect {
public void apply(Game game) { public void apply(Game game) {
Player player = game.getPlayer(); Player player = game.getPlayer();
Location location = player.getLocation(); Location location = player.getLocation();
File schema_file = new File("plugins/FastAsyncWorldEdit/schematics","anquanwu.schem"); WEUtil.loadSchematics(player.getLocation(), "anquanwu");
World world = game.getPlayer().getWorld();
EditSession editSession = WorldEdit.getInstance().newEditSession(BukkitAdapter.adapt(world));
Bukkit.getScheduler().runTaskAsynchronously (EnderDragonWar.plugin, () -> {
try {
Clipboard clipboard = ClipboardFormats.findByFile(schema_file).load(schema_file);
clipboard.paste(BukkitAdapter.adapt(world), BlockVector3.at(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
clipboard.flush();
} catch (Exception e) {
e.printStackTrace();
} finally {
editSession.close();
}
}
);
//WEUtil.loadSchematics(player.getLocation(), "anquanwu");
} }
} }