mirror of
https://github.com/Brettflan/WorldBorder.git
synced 2024-11-22 01:56:30 +01:00
Merge pull request #50 from timafh/master
Adding WorldBorder Fill and Trim completion Events
This commit is contained in:
commit
cc72e40412
@ -0,0 +1,37 @@
|
||||
package com.wimbli.WorldBorder.Events;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Created by timafh on 04.09.2015.
|
||||
*/
|
||||
public class WorldBorderFillFinishedEvent extends Event {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private World world;
|
||||
private long totalChunks;
|
||||
|
||||
public WorldBorderFillFinishedEvent(World world, long totalChunks) {
|
||||
this.world = world;
|
||||
this.totalChunks = totalChunks;
|
||||
}
|
||||
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
public long getTotalChunks() {
|
||||
return totalChunks;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.wimbli.WorldBorder.Events;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Created by timafh on 04.09.2015.
|
||||
*/
|
||||
public class WorldBorderTrimFinishedEvent extends Event {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private World world;
|
||||
private long totalChunks;
|
||||
|
||||
public WorldBorderTrimFinishedEvent(World world, long totalChunks) {
|
||||
this.world = world;
|
||||
this.totalChunks = totalChunks;
|
||||
}
|
||||
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
public long getTotalChunks() {
|
||||
return totalChunks;
|
||||
}
|
||||
}
|
@ -1,14 +1,16 @@
|
||||
package com.wimbli.WorldBorder;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Set;
|
||||
|
||||
import com.wimbli.WorldBorder.Events.WorldBorderFillFinishedEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public class WorldFillTask implements Runnable
|
||||
@ -312,6 +314,7 @@ public class WorldFillTask implements Runnable
|
||||
this.paused = true;
|
||||
reportProgress();
|
||||
world.save();
|
||||
Bukkit.getServer().getPluginManager().callEvent(new WorldBorderFillFinishedEvent(world, reportTotal));
|
||||
sendMessage("task successfully completed for world \"" + refWorld() + "\"!");
|
||||
this.stop();
|
||||
}
|
||||
|
@ -1,12 +1,17 @@
|
||||
package com.wimbli.WorldBorder;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import com.wimbli.WorldBorder.Events.WorldBorderTrimFinishedEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class WorldTrimTask implements Runnable
|
||||
@ -334,6 +339,7 @@ public class WorldTrimTask implements Runnable
|
||||
{
|
||||
reportTotal = reportTarget;
|
||||
reportProgress();
|
||||
Bukkit.getServer().getPluginManager().callEvent(new WorldBorderTrimFinishedEvent(world, reportTotal));
|
||||
sendMessage("task successfully completed!");
|
||||
this.stop();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user