From dd4a8348be28a9b4332078fad1960fb6b0ec60d2 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Tue, 12 Jan 2016 20:47:10 +0100 Subject: [PATCH] World Trim/Fill task start events --- .../Events/WorldBorderFillStartEvent.java | 36 +++++++++++++++++++ .../Events/WorldBorderTrimStartEvent.java | 36 +++++++++++++++++++ .../com/wimbli/WorldBorder/WorldFillTask.java | 2 ++ .../com/wimbli/WorldBorder/WorldTrimTask.java | 2 ++ 4 files changed, 76 insertions(+) create mode 100644 src/main/java/com/wimbli/WorldBorder/Events/WorldBorderFillStartEvent.java create mode 100644 src/main/java/com/wimbli/WorldBorder/Events/WorldBorderTrimStartEvent.java diff --git a/src/main/java/com/wimbli/WorldBorder/Events/WorldBorderFillStartEvent.java b/src/main/java/com/wimbli/WorldBorder/Events/WorldBorderFillStartEvent.java new file mode 100644 index 0000000..0ebb08b --- /dev/null +++ b/src/main/java/com/wimbli/WorldBorder/Events/WorldBorderFillStartEvent.java @@ -0,0 +1,36 @@ +package com.wimbli.WorldBorder.Events; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import com.wimbli.WorldBorder.WorldFillTask; + + +/** + * Created by Maximvdw on 12.01.2016. + */ +public class WorldBorderFillStartEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private WorldFillTask fillTask; + + public WorldBorderFillStartEvent(WorldFillTask worldFillTask) + { + this.fillTask = worldFillTask; + } + + @Override + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public WorldFillTask getFillTask(){ + return this.fillTask; + } +} diff --git a/src/main/java/com/wimbli/WorldBorder/Events/WorldBorderTrimStartEvent.java b/src/main/java/com/wimbli/WorldBorder/Events/WorldBorderTrimStartEvent.java new file mode 100644 index 0000000..6b685aa --- /dev/null +++ b/src/main/java/com/wimbli/WorldBorder/Events/WorldBorderTrimStartEvent.java @@ -0,0 +1,36 @@ +package com.wimbli.WorldBorder.Events; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import com.wimbli.WorldBorder.WorldTrimTask; + + +/** + * Created by Maximvdw on 12.01.2016. + */ +public class WorldBorderTrimStartEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private WorldTrimTask trimTask; + + public WorldBorderTrimStartEvent(WorldTrimTask trimTask) + { + this.trimTask = trimTask; + } + + @Override + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public WorldTrimTask getTrimTask(){ + return this.trimTask; + } +} \ No newline at end of file diff --git a/src/main/java/com/wimbli/WorldBorder/WorldFillTask.java b/src/main/java/com/wimbli/WorldBorder/WorldFillTask.java index c904445..6bb3993 100644 --- a/src/main/java/com/wimbli/WorldBorder/WorldFillTask.java +++ b/src/main/java/com/wimbli/WorldBorder/WorldFillTask.java @@ -12,6 +12,7 @@ import org.bukkit.Server; import org.bukkit.World; import com.wimbli.WorldBorder.Events.WorldBorderFillFinishedEvent; +import com.wimbli.WorldBorder.Events.WorldBorderFillStartEvent; public class WorldFillTask implements Runnable @@ -117,6 +118,7 @@ public class WorldFillTask implements Runnable } this.readyToGo = true; + Bukkit.getServer().getPluginManager().callEvent(new WorldBorderFillStartEvent(this)); } // for backwards compatibility public WorldFillTask(Server theServer, Player player, String worldName, int fillDistance, int chunksPerRun, int tickFrequency) diff --git a/src/main/java/com/wimbli/WorldBorder/WorldTrimTask.java b/src/main/java/com/wimbli/WorldBorder/WorldTrimTask.java index 1a0f256..91d69cf 100644 --- a/src/main/java/com/wimbli/WorldBorder/WorldTrimTask.java +++ b/src/main/java/com/wimbli/WorldBorder/WorldTrimTask.java @@ -13,6 +13,7 @@ import org.bukkit.Server; import org.bukkit.World; import com.wimbli.WorldBorder.Events.WorldBorderTrimFinishedEvent; +import com.wimbli.WorldBorder.Events.WorldBorderTrimStartEvent; public class WorldTrimTask implements Runnable @@ -88,6 +89,7 @@ public class WorldTrimTask implements Runnable return; this.readyToGo = true; + Bukkit.getServer().getPluginManager().callEvent(new WorldBorderTrimStartEvent(this)); } public void setTaskID(int ID)