mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-27 05:00:08 +08:00
Update for the SpoutAPI changes of the past 30 seconds
This commit is contained in:
parent
0f8e622678
commit
20a5899d38
@ -24,6 +24,7 @@
|
||||
import com.sk89q.worldedit.SessionCheck;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import org.spout.api.Engine;
|
||||
import org.spout.api.Server;
|
||||
import org.spout.api.entity.Player;
|
||||
|
||||
/**
|
||||
@ -36,7 +37,7 @@ public class SessionTimer implements Runnable {
|
||||
private WorldEdit worldEdit;
|
||||
private SessionCheck checker;
|
||||
|
||||
public SessionTimer(WorldEdit worldEdit, final Engine game) {
|
||||
public SessionTimer(WorldEdit worldEdit, final Server game) {
|
||||
this.worldEdit = worldEdit;
|
||||
this.checker = new SessionCheck() {
|
||||
public boolean isOnlinePlayer(String name) {
|
||||
|
@ -28,6 +28,7 @@
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldVector;
|
||||
import org.spout.api.Engine;
|
||||
import org.spout.api.Server;
|
||||
import org.spout.api.entity.Entity;
|
||||
import org.spout.api.geo.World;
|
||||
import org.spout.api.geo.cuboid.Block;
|
||||
@ -97,7 +98,7 @@ public static Point center(Point loc) {
|
||||
}
|
||||
|
||||
public static Player matchSinglePlayer(Engine game, String name) {
|
||||
return game.getPlayer(name, false);
|
||||
return game instanceof Server ? ((Server) game).getPlayer(name, false) : null;
|
||||
}
|
||||
|
||||
public static Block toBlock(BlockWorldVector pt) {
|
||||
|
@ -32,6 +32,7 @@
|
||||
import com.sk89q.worldedit.spout.selections.Polygonal2DSelection;
|
||||
import com.sk89q.worldedit.spout.selections.Selection;
|
||||
import com.sk89q.worldedit.util.YAMLConfiguration;
|
||||
import org.spout.api.Server;
|
||||
import org.spout.api.command.CommandSource;
|
||||
import org.spout.api.geo.World;
|
||||
import org.spout.api.entity.Player;
|
||||
@ -105,14 +106,22 @@ public void onEnable() {
|
||||
}
|
||||
|
||||
getEngine().getScheduler().scheduleAsyncRepeatingTask(this,
|
||||
new SessionTimer(controller, getEngine()), 6 * 1000, 6 * 1000, TaskPriority.LOWEST);
|
||||
new SessionTimer(controller, getServer()), 6 * 1000, 6 * 1000, TaskPriority.LOWEST);
|
||||
}
|
||||
|
||||
public Server getServer() {
|
||||
if (!(getEngine() instanceof Server)) {
|
||||
throw new IllegalStateException("WorldEdit must be running on a server for this operation!");
|
||||
}
|
||||
|
||||
return (Server) getEngine();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on plugin disable.
|
||||
*/
|
||||
public void onDisable() {
|
||||
for (Player player : getEngine().getOnlinePlayers()) {
|
||||
for (Player player : getServer().getOnlinePlayers()) {
|
||||
LocalPlayer lPlayer = wrapPlayer(player);
|
||||
if (controller.getSession(lPlayer).hasCUISupport()) {
|
||||
lPlayer.dispatchCUIHandshake();
|
||||
|
Loading…
Reference in New Issue
Block a user