3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-12 22:20:08 +01:00

Dropped WorldEdit prefix from session and player classes; changed them to "Local".

Dieser Commit ist enthalten in:
sk89q 2011-01-01 10:34:36 -08:00
Ursprung ac4e6e8ddf
Commit d534432a2f
5 geänderte Dateien mit 66 neuen und 66 gelöschten Zeilen

Datei anzeigen

@ -20,7 +20,7 @@
import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.ServerInterface;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditPlayer;
import com.sk89q.worldedit.LocalPlayer;
import com.sk89q.worldedit.WorldVector;
import com.sk89q.worldedit.bags.BlockBag;
import com.sk89q.worldedit.blocks.BlockType;
@ -29,7 +29,7 @@ import com.sk89q.worldedit.blocks.BlockType;
*
* @author sk89q
*/
public class HMPlayer extends WorldEditPlayer {
public class HMPlayer extends LocalPlayer {
/**
* Stores the player.
*/

Datei anzeigen

@ -224,11 +224,11 @@ public class HMWorldEditListener extends PluginListener {
* @param player
* @return
*/
public WorldEditSession _bridgeSession(Player player) {
public LocalSession _bridgeSession(Player player) {
return controller.getBridgeSession(wrapPlayer(player));
}
private WorldEditPlayer wrapPlayer(Player player) {
private LocalPlayer wrapPlayer(Player player) {
return new HMPlayer(server, player);
}
}

Datei anzeigen

@ -26,7 +26,7 @@ import com.sk89q.worldedit.blocks.BlockType;
*
* @author sk89q
*/
public abstract class WorldEditPlayer {
public abstract class LocalPlayer {
/**
* Directions.
*/
@ -51,7 +51,7 @@ public abstract class WorldEditPlayer {
*
* @param server
*/
protected WorldEditPlayer(ServerInterface server) {
protected LocalPlayer(ServerInterface server) {
this.server = server;
}
@ -310,7 +310,7 @@ public abstract class WorldEditPlayer {
*
* @return
*/
public WorldEditPlayer.DIRECTION getCardinalDirection() {
public LocalPlayer.DIRECTION getCardinalDirection() {
// From hey0's code
double rot = (getYaw() - 90) % 360;
if (rot < 0) {
@ -325,25 +325,25 @@ public abstract class WorldEditPlayer {
* @param rot
* @return
*/
private static WorldEditPlayer.DIRECTION getDirection(double rot) {
private static LocalPlayer.DIRECTION getDirection(double rot) {
if (0 <= rot && rot < 22.5) {
return WorldEditPlayer.DIRECTION.NORTH;
return LocalPlayer.DIRECTION.NORTH;
} else if (22.5 <= rot && rot < 67.5) {
return WorldEditPlayer.DIRECTION.NORTH_EAST;
return LocalPlayer.DIRECTION.NORTH_EAST;
} else if (67.5 <= rot && rot < 112.5) {
return WorldEditPlayer.DIRECTION.EAST;
return LocalPlayer.DIRECTION.EAST;
} else if (112.5 <= rot && rot < 157.5) {
return WorldEditPlayer.DIRECTION.SOUTH_EAST;
return LocalPlayer.DIRECTION.SOUTH_EAST;
} else if (157.5 <= rot && rot < 202.5) {
return WorldEditPlayer.DIRECTION.SOUTH;
return LocalPlayer.DIRECTION.SOUTH;
} else if (202.5 <= rot && rot < 247.5) {
return WorldEditPlayer.DIRECTION.SOUTH_WEST;
return LocalPlayer.DIRECTION.SOUTH_WEST;
} else if (247.5 <= rot && rot < 292.5) {
return WorldEditPlayer.DIRECTION.WEST;
return LocalPlayer.DIRECTION.WEST;
} else if (292.5 <= rot && rot < 337.5) {
return WorldEditPlayer.DIRECTION.NORTH_WEST;
return LocalPlayer.DIRECTION.NORTH_WEST;
} else if (337.5 <= rot && rot < 360.0) {
return WorldEditPlayer.DIRECTION.NORTH;
return LocalPlayer.DIRECTION.NORTH;
} else {
return null;
}
@ -486,10 +486,10 @@ public abstract class WorldEditPlayer {
*/
@Override
public boolean equals(Object other) {
if (!(other instanceof WorldEditPlayer)) {
if (!(other instanceof LocalPlayer)) {
return false;
}
WorldEditPlayer other2 = (WorldEditPlayer)other;
LocalPlayer other2 = (LocalPlayer)other;
return other2.getName().equals(getName());
}

Datei anzeigen

@ -29,7 +29,7 @@ import com.sk89q.worldedit.regions.CuboidRegion;
*
* @author sk89q
*/
public class WorldEditSession {
public class LocalSession {
/**
* List of super pick axe modes.
*/
@ -326,7 +326,7 @@ public class WorldEditSession {
* @return position
* @throws IncompleteRegionException
*/
public Vector getPlacementPosition(WorldEditPlayer player)
public Vector getPlacementPosition(LocalPlayer player)
throws IncompleteRegionException {
if (!placeAtPos1) {
return player.getBlockIn();
@ -350,7 +350,7 @@ public class WorldEditSession {
* @param player
* @return
*/
public BlockBag getBlockBag(WorldEditPlayer player) {
public BlockBag getBlockBag(LocalPlayer player) {
if (!useInventory) {
return null;
}

Datei anzeigen

@ -67,8 +67,8 @@ public class WorldEditController {
* without any WorldEdit abilities or never use WorldEdit in a session will
* not have a session object generated for them.
*/
private HashMap<WorldEditPlayer,WorldEditSession> sessions =
new HashMap<WorldEditPlayer,WorldEditSession>();
private HashMap<LocalPlayer,LocalSession> sessions =
new HashMap<LocalPlayer,LocalSession>();
/**
* List of commands. These are checked when onCommand() is called, so
@ -184,11 +184,11 @@ public class WorldEditController {
* @param player
* @return
*/
public WorldEditSession getSession(WorldEditPlayer player) {
public LocalSession getSession(LocalPlayer player) {
if (sessions.containsKey(player)) {
return sessions.get(player);
} else {
WorldEditSession session = new WorldEditSession();
LocalSession session = new LocalSession();
if (!player.hasPermission("/worldeditnomax")
&& maxChangeLimit > -1) {
if (defaultChangeLimit < 0) {
@ -216,7 +216,7 @@ public class WorldEditController {
* @param player
* @return
*/
public boolean hasSession(WorldEditPlayer player) {
public boolean hasSession(LocalPlayer player) {
return sessions.containsKey(player);
}
@ -405,8 +405,8 @@ public class WorldEditController {
* @throws InsufficientArgumentsException
* @throws DisallowedItemException
*/
public boolean performCommand(WorldEditPlayer player,
WorldEditSession session, EditSession editSession, String[] split)
public boolean performCommand(LocalPlayer player,
LocalSession session, EditSession editSession, String[] split)
throws WorldEditException
{
if (logComands) {
@ -622,17 +622,17 @@ public class WorldEditController {
checkArgs(split, 1, 2, split[0]);
if (split[1].equalsIgnoreCase("single")) {
session.setSuperPickaxeMode(WorldEditSession.SuperPickaxeMode.SINGLE);
session.setSuperPickaxeMode(LocalSession.SuperPickaxeMode.SINGLE);
player.print("Mode set to single block.");
} else if (split[1].equalsIgnoreCase("recursive")
|| split[1].equalsIgnoreCase("area")) {
if (split.length == 3) {
int size = Math.max(1, Integer.parseInt(split[2]));
if (size <= maxSuperPickaxeSize) {
WorldEditSession.SuperPickaxeMode mode =
LocalSession.SuperPickaxeMode mode =
split[1].equalsIgnoreCase("recursive") ?
WorldEditSession.SuperPickaxeMode.SAME_TYPE_RECURSIVE :
WorldEditSession.SuperPickaxeMode.SAME_TYPE_AREA;
LocalSession.SuperPickaxeMode.SAME_TYPE_RECURSIVE :
LocalSession.SuperPickaxeMode.SAME_TYPE_AREA;
session.setSuperPickaxeMode(mode);
session.setSuperPickaxeRange(size);
player.print("Mode set to " + split[1].toLowerCase() + ".");
@ -653,21 +653,21 @@ public class WorldEditController {
checkArgs(split, 1, 1, split[0]);
if (split[1].equalsIgnoreCase("none")) {
session.setTool(WorldEditSession.Tool.NONE);
session.setTool(LocalSession.Tool.NONE);
player.print("No tool equipped. -3 XP, +10 Manliness");
} else if (split[1].equalsIgnoreCase("tree")) {
if (!canUseCommand(player, "/treetool")) {
player.printError("You do not have the /treetool permission.");
return true;
}
session.setTool(WorldEditSession.Tool.TREE);
session.setTool(LocalSession.Tool.TREE);
player.print("Tree planting tool equipped. +5 XP");
} else if (split[1].equalsIgnoreCase("info")) {
if (!canUseCommand(player, "/infotool")) {
player.printError("You do not have the /infotool permission.");
return true;
}
session.setTool(WorldEditSession.Tool.INFO);
session.setTool(LocalSession.Tool.INFO);
player.print("Block information tool equipped.");
} else {
player.printError("Unknown tool.");
@ -1591,25 +1591,25 @@ public class WorldEditController {
* @param dir
* @return
*/
public Vector getDirection(WorldEditPlayer player, String dirStr)
public Vector getDirection(LocalPlayer player, String dirStr)
throws UnknownDirectionException {
int xm = 0;
int ym = 0;
int zm = 0;
WorldEditPlayer.DIRECTION dir = null;
LocalPlayer.DIRECTION dir = null;
if (dirStr.equals("me")) {
dir = player.getCardinalDirection();
}
if (dirStr.charAt(0) == 'u' || dir == WorldEditPlayer.DIRECTION.WEST) {
if (dirStr.charAt(0) == 'u' || dir == LocalPlayer.DIRECTION.WEST) {
zm += 1;
} else if (dirStr.charAt(0) == 'e' || dir == WorldEditPlayer.DIRECTION.EAST) {
} else if (dirStr.charAt(0) == 'e' || dir == LocalPlayer.DIRECTION.EAST) {
zm -= 1;
} else if (dirStr.charAt(0) == 's' || dir == WorldEditPlayer.DIRECTION.SOUTH) {
} else if (dirStr.charAt(0) == 's' || dir == LocalPlayer.DIRECTION.SOUTH) {
xm += 1;
} else if (dirStr.charAt(0) == 'n' || dir == WorldEditPlayer.DIRECTION.NORTH) {
} else if (dirStr.charAt(0) == 'n' || dir == LocalPlayer.DIRECTION.NORTH) {
xm -= 1;
} else if (dirStr.charAt(0) == 'u') {
ym += 1;
@ -1631,21 +1631,21 @@ public class WorldEditController {
* @return
*/
public CuboidClipboard.FlipDirection getFlipDirection(
WorldEditPlayer player, String dirStr)
LocalPlayer player, String dirStr)
throws UnknownDirectionException {
WorldEditPlayer.DIRECTION dir = null;
LocalPlayer.DIRECTION dir = null;
if (dirStr.equals("me")) {
dir = player.getCardinalDirection();
}
if (dirStr.charAt(0) == 'w' || dir == WorldEditPlayer.DIRECTION.EAST) {
if (dirStr.charAt(0) == 'w' || dir == LocalPlayer.DIRECTION.EAST) {
return CuboidClipboard.FlipDirection.WEST_EAST;
} else if (dirStr.charAt(0) == 'e' || dir == WorldEditPlayer.DIRECTION.EAST) {
} else if (dirStr.charAt(0) == 'e' || dir == LocalPlayer.DIRECTION.EAST) {
return CuboidClipboard.FlipDirection.WEST_EAST;
} else if (dirStr.charAt(0) == 's' || dir == WorldEditPlayer.DIRECTION.SOUTH) {
} else if (dirStr.charAt(0) == 's' || dir == LocalPlayer.DIRECTION.SOUTH) {
return CuboidClipboard.FlipDirection.NORTH_SOUTH;
} else if (dirStr.charAt(0) == 'n' || dir == WorldEditPlayer.DIRECTION.SOUTH) {
} else if (dirStr.charAt(0) == 'n' || dir == LocalPlayer.DIRECTION.SOUTH) {
return CuboidClipboard.FlipDirection.NORTH_SOUTH;
} else if (dirStr.charAt(0) == 'u') {
return CuboidClipboard.FlipDirection.UP_DOWN;
@ -1661,7 +1661,7 @@ public class WorldEditController {
*
* @param player
*/
public void removeSession(WorldEditPlayer player) {
public void removeSession(LocalPlayer player) {
sessions.remove(player);
}
@ -1689,7 +1689,7 @@ public class WorldEditController {
*
* @param player
*/
public void handleDisconnect(WorldEditPlayer player) {
public void handleDisconnect(LocalPlayer player) {
removeSession(player);
}
@ -1698,7 +1698,7 @@ public class WorldEditController {
*
* @param player
*/
public void handleArmSwing(WorldEditPlayer player) {
public void handleArmSwing(LocalPlayer player) {
if (!canUseCommand(player, "//"))
return;
}
@ -1711,14 +1711,14 @@ public class WorldEditController {
* @return false if you want the action to go through
*/
@SuppressWarnings("deprecation")
public boolean handleBlockRightClick(WorldEditPlayer player, Vector clicked) {
public boolean handleBlockRightClick(LocalPlayer player, Vector clicked) {
int itemInHand = player.getItemInHand();
// This prevents needless sessions from being created
if (!hasSession(player) && !(itemInHand == wandItem &&
canUseCommand(player, "//pos2"))) { return false; }
WorldEditSession session = getSession(player);
LocalSession session = getSession(player);
if (itemInHand == wandItem && session.isToolControlEnabled()
&& canUseCommand(player, "//pos2")) {
@ -1732,7 +1732,7 @@ public class WorldEditController {
return true;
} else if (player.isHoldingPickAxe()
&& session.getTool() == WorldEditSession.Tool.TREE) {
&& session.getTool() == LocalSession.Tool.TREE) {
EditSession editSession =
new EditSession(server, player.getWorld(), session.getBlockChangeLimit());
@ -1746,7 +1746,7 @@ public class WorldEditController {
return true;
} else if (player.isHoldingPickAxe()
&& session.getTool() == WorldEditSession.Tool.INFO) {
&& session.getTool() == LocalSession.Tool.INFO) {
BaseBlock block = (new EditSession(server, player.getWorld(), 0)).rawGetBlock(clicked);
player.print("\u00A79@" + clicked + ": " + "\u00A7e"
@ -1773,11 +1773,11 @@ public class WorldEditController {
* @param clicked
* @return false if you want the action to go through
*/
public boolean handleBlockLeftClick(WorldEditPlayer player, Vector clicked) {
public boolean handleBlockLeftClick(LocalPlayer player, Vector clicked) {
if (!canUseCommand(player, "//pos1")
&& !canUseCommand(player, "//")) { return false; }
WorldEditSession session = getSession(player);
LocalSession session = getSession(player);
if (player.getItemInHand() == wandItem) {
if (session.isToolControlEnabled()) {
@ -1812,7 +1812,7 @@ public class WorldEditController {
// Single block super pickaxe
if (session.getSuperPickaxeMode() ==
WorldEditSession.SuperPickaxeMode.SINGLE) {
LocalSession.SuperPickaxeMode.SINGLE) {
if (server.getBlockType(world, clicked) == 7 && !canBedrock) {
return true;
} else if (server.getBlockType(world, clicked) == 46) {
@ -1827,7 +1827,7 @@ public class WorldEditController {
// Area super pickaxe
} else if (session.getSuperPickaxeMode() ==
WorldEditSession.SuperPickaxeMode.SAME_TYPE_AREA) {
LocalSession.SuperPickaxeMode.SAME_TYPE_AREA) {
int ox = clicked.getBlockX();
int oy = clicked.getBlockY();
int oz = clicked.getBlockZ();
@ -1857,7 +1857,7 @@ public class WorldEditController {
// Area super pickaxe
} else if (session.getSuperPickaxeMode() ==
WorldEditSession.SuperPickaxeMode.SAME_TYPE_RECURSIVE) {
LocalSession.SuperPickaxeMode.SAME_TYPE_RECURSIVE) {
int size = session.getSuperPickaxeRange();
int initialType = server.getBlockType(world, clicked);
@ -1923,7 +1923,7 @@ public class WorldEditController {
* @param split
* @return whether the command was processed
*/
public boolean handleCommand(WorldEditPlayer player, String[] split) {
public boolean handleCommand(LocalPlayer player, String[] split) {
try {
// Legacy /, command
if (split[0].equals("/,")) {
@ -1943,7 +1943,7 @@ public class WorldEditController {
}
if (canUseCommand(player, split[0])) {
WorldEditSession session = getSession(player);
LocalSession session = getSession(player);
BlockBag blockBag = session.getBlockBag(player);
EditSession editSession =
@ -2009,7 +2009,7 @@ public class WorldEditController {
* @param blockBag
* @param editSession
*/
private static void flushBlockBag(WorldEditPlayer player,
private static void flushBlockBag(LocalPlayer player,
EditSession editSession) {
BlockBag blockBag = editSession.getBlockBag();
@ -2051,7 +2051,7 @@ public class WorldEditController {
* @param command
* @return
*/
private boolean canUseCommand(WorldEditPlayer player, String command) {
private boolean canUseCommand(LocalPlayer player, String command) {
// Allow the /worldeditselect permission
if (command.equalsIgnoreCase("//pos1")
|| command.equalsIgnoreCase("//pos2")
@ -2097,11 +2097,11 @@ public class WorldEditController {
* @param player
* @return
*/
public WorldEditSession getBridgeSession(WorldEditPlayer player) {
public LocalSession getBridgeSession(LocalPlayer player) {
if (sessions.containsKey(player)) {
return sessions.get(player);
} else {
WorldEditSession session = new WorldEditSession();
LocalSession session = new LocalSession();
session.setBlockChangeLimit(defaultChangeLimit);
sessions.put(player, session);
return session;