SkStuff/src/me/TheBukor/SkStuff/events/WorldEditExtent.java
Richard f3fcb59fa1 So reflection was awful to work with. I'm moving on to a new method...
using an Interface full of useful NMS methods. I'm still using
reflection, but only when absolutely needed.
I'm also working on a new and better implementation for NBT Lists.
Made NBT Lists and NBT Compounds serializable (can be saved in variables
through restarts), needs testing.
2016-02-28 20:01:28 -03:00

34 lines
1.2 KiB
Java

package me.TheBukor.SkStuff.events;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.bukkit.BukkitUtil;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.logging.AbstractLoggingExtent;
public class WorldEditExtent extends AbstractLoggingExtent {
private final Actor actor;
private final World world;
public WorldEditExtent(Actor actor, com.sk89q.worldedit.world.World weWorld, Extent extent) {
super(extent);
this.actor = actor;
this.world = ((BukkitWorld) weWorld).getWorld();
}
@Override
protected void onBlockChange(final Vector vec, BaseBlock baseBlock) {
final Block b = BukkitUtil.toLocation(world, vec).getBlock();
final Player p = Bukkit.getPlayerExact(actor.getName());
EvtWorldEditChange event = new EvtWorldEditChange(p, b);
Bukkit.getPluginManager().callEvent(event);
}
}