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