mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-02 10:57:11 +00:00
Update for the SpoutAPI changes of the past 30 seconds
This commit is contained in:
parent
0f8e622678
commit
20a5899d38
@ -24,6 +24,7 @@ package com.sk89q.worldedit.spout;
|
||||
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.Location;
|
||||
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 class SpoutUtil {
|
||||
}
|
||||
|
||||
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.CuboidSelection;
|
||||
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 class WorldEditPlugin extends CommonPlugin {
|
||||
}
|
||||
|
||||
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