Sorry, no future block expression for the event (wait 1 tick inside...
...your script)
This commit is contained in:
parent
262c470e7d
commit
2a23535239
@ -437,13 +437,6 @@ public class SkStuff extends JavaPlugin {
|
||||
return EvtWorldEditChange.getPlayer();
|
||||
}
|
||||
}, 0);
|
||||
EventValues.registerEventValue(EvtWorldEditChange.class, Block.class, new Getter<Block, EvtWorldEditChange>() {
|
||||
@Override
|
||||
@Nullable
|
||||
public Block get(EvtWorldEditChange e) {
|
||||
return EvtWorldEditChange.getBlock();
|
||||
}
|
||||
}, -1);
|
||||
EventValues.registerEventValue(EvtWorldEditChange.class, Block.class, new Getter<Block, EvtWorldEditChange>() {
|
||||
@Override
|
||||
@Nullable
|
||||
@ -451,13 +444,6 @@ public class SkStuff extends JavaPlugin {
|
||||
return EvtWorldEditChange.getBlock();
|
||||
}
|
||||
}, 0);
|
||||
EventValues.registerEventValue(EvtWorldEditChange.class, Block.class, new Getter<Block, EvtWorldEditChange>() {
|
||||
@Override
|
||||
@Nullable
|
||||
public Block get(EvtWorldEditChange e) {
|
||||
return EvtWorldEditChange.getFutureBlock();
|
||||
}
|
||||
}, 1);
|
||||
evtWE = true;
|
||||
} catch (ClassNotFoundException ex) {
|
||||
Skript.error("Unable to register \"On WorldEdit block change\" event! You will need to upgrade to WorldEdit 6.0");
|
||||
|
@ -8,12 +8,10 @@ import org.bukkit.event.HandlerList;
|
||||
public class EvtWorldEditChange extends Event {
|
||||
static Player player;
|
||||
static Block block;
|
||||
static Block futureBlock;
|
||||
|
||||
public EvtWorldEditChange(Player player, Block block, Block futureBlock) {
|
||||
public EvtWorldEditChange(Player player, Block block) {
|
||||
EvtWorldEditChange.player = player;
|
||||
EvtWorldEditChange.block = block;
|
||||
EvtWorldEditChange.futureBlock = futureBlock;
|
||||
}
|
||||
|
||||
public static Player getPlayer() {
|
||||
@ -23,10 +21,6 @@ public class EvtWorldEditChange extends Event {
|
||||
public static Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public static Block getFutureBlock() {
|
||||
return futureBlock;
|
||||
}
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
|
@ -13,8 +13,6 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.logging.AbstractLoggingExtent;
|
||||
|
||||
import me.TheBukor.SkStuff.SkStuff;
|
||||
|
||||
public class WorldEditExtent extends AbstractLoggingExtent {
|
||||
|
||||
private final Actor actor;
|
||||
@ -30,12 +28,6 @@ public class WorldEditExtent extends AbstractLoggingExtent {
|
||||
protected void onBlockChange(final Vector vec, BaseBlock baseBlock) {
|
||||
final Block b = BukkitUtil.toLocation(world, vec).getBlock();
|
||||
final Player p = Bukkit.getPlayerExact(actor.getName());
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(new SkStuff(), new Runnable() { //Wait 1 tick to get the future block
|
||||
@Override
|
||||
public void run() {
|
||||
Block futureB = BukkitUtil.toLocation(world, vec).getBlock();
|
||||
Bukkit.getPluginManager().callEvent(new EvtWorldEditChange(p, b, futureB));
|
||||
}
|
||||
}, 1L);
|
||||
Bukkit.getPluginManager().callEvent(new EvtWorldEditChange(p, b));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user