From 6ce0e2d9f0ef91099d0936dfa6b0b0ebc2e7b552 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 31 Jul 2017 16:38:14 +1000 Subject: [PATCH] Fixes #672 --- .../com/boydti/fawe/bukkit/favs/Favs.java | 4 ++ .../event/SniperBrushChangedEvent.java | 51 +++++++++++++++++ .../event/SniperMaterialChangedEvent.java | 56 +++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 favs/src/main/java/com/thevoxelbox/voxelsniper/event/SniperBrushChangedEvent.java create mode 100644 favs/src/main/java/com/thevoxelbox/voxelsniper/event/SniperMaterialChangedEvent.java diff --git a/favs/src/main/java/com/boydti/fawe/bukkit/favs/Favs.java b/favs/src/main/java/com/boydti/fawe/bukkit/favs/Favs.java index 9002a274..6a855550 100644 --- a/favs/src/main/java/com/boydti/fawe/bukkit/favs/Favs.java +++ b/favs/src/main/java/com/boydti/fawe/bukkit/favs/Favs.java @@ -11,6 +11,8 @@ import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.Sniper; import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; import com.thevoxelbox.voxelsniper.command.VoxelVoxelCommand; +import com.thevoxelbox.voxelsniper.event.SniperBrushChangedEvent; +import com.thevoxelbox.voxelsniper.event.SniperMaterialChangedEvent; import java.io.File; import java.io.FileOutputStream; import org.bukkit.Bukkit; @@ -58,6 +60,8 @@ public class Favs extends JavaPlugin { VoxelVoxelCommand.inject(); PerformBrush.inject(); RangeBlockHelper.inject(); + SniperBrushChangedEvent.inject(); + SniperMaterialChangedEvent.inject(); // Forward the commands so //p and //d will work setupCommand("/p", new FaweCommand("voxelsniper.sniper") { @Override diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/event/SniperBrushChangedEvent.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/event/SniperBrushChangedEvent.java new file mode 100644 index 00000000..fbe2bdcb --- /dev/null +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/event/SniperBrushChangedEvent.java @@ -0,0 +1,51 @@ +package com.thevoxelbox.voxelsniper.event; + +import com.boydti.fawe.Fawe; +import com.thevoxelbox.voxelsniper.Sniper; +import com.thevoxelbox.voxelsniper.brush.IBrush; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class SniperBrushChangedEvent extends Event { + private static final HandlerList handlers = new HandlerList(); + private final Sniper sniper; + private final IBrush originalBrush; + private final IBrush newBrush; + private final String toolId; + + public SniperBrushChangedEvent(Sniper sniper, String toolId, IBrush originalBrush, IBrush newBrush) { + super(!Fawe.isMainThread()); + this.sniper = sniper; + this.originalBrush = originalBrush; + this.newBrush = newBrush; + this.toolId = toolId; + } + + public static HandlerList getHandlerList() { + return handlers; + } + + public IBrush getOriginalBrush() { + return this.originalBrush; + } + + public IBrush getNewBrush() { + return this.newBrush; + } + + public Sniper getSniper() { + return this.sniper; + } + + public String getToolId() { + return this.toolId; + } + + public HandlerList getHandlers() { + return handlers; + } + + public static Class inject() { + return SniperBrushChangedEvent.class; + } +} diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/event/SniperMaterialChangedEvent.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/event/SniperMaterialChangedEvent.java new file mode 100644 index 00000000..0aed6eae --- /dev/null +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/event/SniperMaterialChangedEvent.java @@ -0,0 +1,56 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + +package com.thevoxelbox.voxelsniper.event; + +import com.boydti.fawe.Fawe; +import com.thevoxelbox.voxelsniper.Sniper; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +import org.bukkit.material.MaterialData; + +public class SniperMaterialChangedEvent extends Event { + private static final HandlerList handlers = new HandlerList(); + private final Sniper sniper; + private final MaterialData originalMaterial; + private final MaterialData newMaterial; + private final String toolId; + + public SniperMaterialChangedEvent(Sniper sniper, String toolId, MaterialData originalMaterial, MaterialData newMaterial) { + super(!Fawe.get().isMainThread()); + this.sniper = sniper; + this.originalMaterial = originalMaterial; + this.newMaterial = newMaterial; + this.toolId = toolId; + } + + public static HandlerList getHandlerList() { + return handlers; + } + + public MaterialData getOriginalMaterial() { + return this.originalMaterial; + } + + public MaterialData getNewMaterial() { + return this.newMaterial; + } + + public Sniper getSniper() { + return this.sniper; + } + + public String getToolId() { + return this.toolId; + } + + public HandlerList getHandlers() { + return handlers; + } + + public static Class inject() { + return SniperMaterialChangedEvent.class; + } +}