new-3
This commit is contained in:
parent
8e6108dc9c
commit
23c490e26f
|
@ -1,21 +1,11 @@
|
|||
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.game.Game;
|
||||
import org.bukkit.Bukkit;
|
||||
import com.yaohun.enderdragonwar.util.WEUtil;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class SpawnBuildEffect extends GameGiftEffect {
|
||||
|
||||
public SpawnBuildEffect(String audience) {
|
||||
|
@ -26,22 +16,7 @@ public class SpawnBuildEffect extends GameGiftEffect {
|
|||
public void apply(Game game) {
|
||||
Player player = game.getPlayer();
|
||||
Location location = player.getLocation();
|
||||
File schema_file = new File("plugins/FastAsyncWorldEdit/schematics","anquanwu.schem");
|
||||
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");
|
||||
WEUtil.loadSchematics(player.getLocation(), "anquanwu");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user