Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-08 04:20:06 +01:00
Update for the SpoutAPI changes of the past 30 seconds
Dieser Commit ist enthalten in:
Ursprung
0f8e622678
Commit
20a5899d38
@ -24,6 +24,7 @@ package com.sk89q.worldedit.spout;
|
|||||||
import com.sk89q.worldedit.SessionCheck;
|
import com.sk89q.worldedit.SessionCheck;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import org.spout.api.Engine;
|
import org.spout.api.Engine;
|
||||||
|
import org.spout.api.Server;
|
||||||
import org.spout.api.entity.Player;
|
import org.spout.api.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -36,7 +37,7 @@ public class SessionTimer implements Runnable {
|
|||||||
private WorldEdit worldEdit;
|
private WorldEdit worldEdit;
|
||||||
private SessionCheck checker;
|
private SessionCheck checker;
|
||||||
|
|
||||||
public SessionTimer(WorldEdit worldEdit, final Engine game) {
|
public SessionTimer(WorldEdit worldEdit, final Server game) {
|
||||||
this.worldEdit = worldEdit;
|
this.worldEdit = worldEdit;
|
||||||
this.checker = new SessionCheck() {
|
this.checker = new SessionCheck() {
|
||||||
public boolean isOnlinePlayer(String name) {
|
public boolean isOnlinePlayer(String name) {
|
||||||
|
@ -28,6 +28,7 @@ import com.sk89q.worldedit.Location;
|
|||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.WorldVector;
|
import com.sk89q.worldedit.WorldVector;
|
||||||
import org.spout.api.Engine;
|
import org.spout.api.Engine;
|
||||||
|
import org.spout.api.Server;
|
||||||
import org.spout.api.entity.Entity;
|
import org.spout.api.entity.Entity;
|
||||||
import org.spout.api.geo.World;
|
import org.spout.api.geo.World;
|
||||||
import org.spout.api.geo.cuboid.Block;
|
import org.spout.api.geo.cuboid.Block;
|
||||||
@ -97,7 +98,7 @@ public class SpoutUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Player matchSinglePlayer(Engine game, String name) {
|
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) {
|
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.Polygonal2DSelection;
|
||||||
import com.sk89q.worldedit.spout.selections.Selection;
|
import com.sk89q.worldedit.spout.selections.Selection;
|
||||||
import com.sk89q.worldedit.util.YAMLConfiguration;
|
import com.sk89q.worldedit.util.YAMLConfiguration;
|
||||||
|
import org.spout.api.Server;
|
||||||
import org.spout.api.command.CommandSource;
|
import org.spout.api.command.CommandSource;
|
||||||
import org.spout.api.geo.World;
|
import org.spout.api.geo.World;
|
||||||
import org.spout.api.entity.Player;
|
import org.spout.api.entity.Player;
|
||||||
@ -105,14 +106,22 @@ public class WorldEditPlugin extends CommonPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getEngine().getScheduler().scheduleAsyncRepeatingTask(this,
|
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.
|
* Called on plugin disable.
|
||||||
*/
|
*/
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
for (Player player : getEngine().getOnlinePlayers()) {
|
for (Player player : getServer().getOnlinePlayers()) {
|
||||||
LocalPlayer lPlayer = wrapPlayer(player);
|
LocalPlayer lPlayer = wrapPlayer(player);
|
||||||
if (controller.getSession(lPlayer).hasCUISupport()) {
|
if (controller.getSession(lPlayer).hasCUISupport()) {
|
||||||
lPlayer.dispatchCUIHandshake();
|
lPlayer.dispatchCUIHandshake();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren