Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-10 05:20:04 +01:00
Changed the compass so that left click is /jumpto and right click is /thru.
Dieser Commit ist enthalten in:
Ursprung
5ac8c5adf7
Commit
5e536ad302
@ -44,14 +44,6 @@ import com.sk89q.worldedit.regions.RegionSelector;
|
|||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class LocalSession {
|
public class LocalSession {
|
||||||
/**
|
|
||||||
* List of compass modes.
|
|
||||||
*/
|
|
||||||
public enum CompassMode {
|
|
||||||
JUMPTO,
|
|
||||||
THRU
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int MAX_HISTORY_SIZE = 15;
|
public static int MAX_HISTORY_SIZE = 15;
|
||||||
|
|
||||||
private LocalConfiguration config;
|
private LocalConfiguration config;
|
||||||
@ -71,7 +63,6 @@ public class LocalSession {
|
|||||||
private boolean useInventory;
|
private boolean useInventory;
|
||||||
private Snapshot snapshot;
|
private Snapshot snapshot;
|
||||||
private String lastScript;
|
private String lastScript;
|
||||||
private CompassMode compassMode = CompassMode.JUMPTO;
|
|
||||||
private boolean beenToldVersion = false;
|
private boolean beenToldVersion = false;
|
||||||
private boolean hasCUISupport = false;
|
private boolean hasCUISupport = false;
|
||||||
|
|
||||||
@ -491,24 +482,6 @@ public class LocalSession {
|
|||||||
public void setLastScript(String lastScript) {
|
public void setLastScript(String lastScript) {
|
||||||
this.lastScript = lastScript;
|
this.lastScript = lastScript;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the compass mode.
|
|
||||||
*
|
|
||||||
* @return the compassMode
|
|
||||||
*/
|
|
||||||
public CompassMode getCompassMode() {
|
|
||||||
return compassMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the compass mode.
|
|
||||||
*
|
|
||||||
* @param compassMode the compassMode to set
|
|
||||||
*/
|
|
||||||
public void setCompassMode(CompassMode compassMode) {
|
|
||||||
this.compassMode = compassMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell the player the WorldEdit version.
|
* Tell the player the WorldEdit version.
|
||||||
|
@ -30,7 +30,6 @@ import com.sk89q.minecraft.util.commands.MissingNestedCommandException;
|
|||||||
import com.sk89q.minecraft.util.commands.UnhandledCommandException;
|
import com.sk89q.minecraft.util.commands.UnhandledCommandException;
|
||||||
import com.sk89q.minecraft.util.commands.WrappedCommandException;
|
import com.sk89q.minecraft.util.commands.WrappedCommandException;
|
||||||
import com.sk89q.util.StringUtil;
|
import com.sk89q.util.StringUtil;
|
||||||
import com.sk89q.worldedit.LocalSession.CompassMode;
|
|
||||||
import com.sk89q.worldedit.bags.BlockBag;
|
import com.sk89q.worldedit.bags.BlockBag;
|
||||||
import com.sk89q.worldedit.blocks.*;
|
import com.sk89q.worldedit.blocks.*;
|
||||||
import com.sk89q.worldedit.commands.*;
|
import com.sk89q.worldedit.commands.*;
|
||||||
@ -740,23 +739,14 @@ public class WorldEdit {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean handleArmSwing(LocalPlayer player) {
|
public boolean handleArmSwing(LocalPlayer player) {
|
||||||
LocalSession session = getSession(player);
|
|
||||||
|
|
||||||
if (player.getItemInHand() == config.navigationWand
|
if (player.getItemInHand() == config.navigationWand
|
||||||
&& config.navigationWandMaxDistance > 0) {
|
&& config.navigationWandMaxDistance > 0
|
||||||
CompassMode mode = session.getCompassMode();
|
&& player.hasPermission("worldedit.navigation.jumpto")) {
|
||||||
|
WorldVector pos = player.getSolidBlockTrace(config.navigationWandMaxDistance);
|
||||||
if (player.hasPermission("worldedit.navigation.jumpto") && mode == CompassMode.JUMPTO) {
|
if (pos != null) {
|
||||||
WorldVector pos = player.getSolidBlockTrace(config.navigationWandMaxDistance);
|
player.findFreePosition(pos);
|
||||||
if (pos != null) {
|
} else {
|
||||||
player.findFreePosition(pos);
|
player.printError("No block in sight (or too far)!");
|
||||||
} else {
|
|
||||||
player.printError("No block in sight (or too far)!");
|
|
||||||
}
|
|
||||||
} else if (mode == CompassMode.THRU) { // Permission is implied
|
|
||||||
if (!player.passThroughForwardWall(40)) {
|
|
||||||
player.printError("Nothing to pass through!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -771,27 +761,14 @@ public class WorldEdit {
|
|||||||
*/
|
*/
|
||||||
public boolean handleRightClick(LocalPlayer player) {
|
public boolean handleRightClick(LocalPlayer player) {
|
||||||
LocalSession session = getSession(player);
|
LocalSession session = getSession(player);
|
||||||
|
|
||||||
if (player.getItemInHand() == config.navigationWand) {
|
if (player.getItemInHand() == config.navigationWand
|
||||||
CompassMode mode = session.getCompassMode();
|
&& config.navigationWandMaxDistance > 0
|
||||||
|
&& player.hasPermission("worldedit.navigation.thru")) {
|
||||||
|
|
||||||
if (mode == CompassMode.JUMPTO) {
|
if (!player.passThroughForwardWall(40)) {
|
||||||
if (player.hasPermission("worldedit.navigation.thru")) {
|
player.printError("Nothing to pass through!");
|
||||||
session.setCompassMode(CompassMode.THRU);
|
|
||||||
player.print("Switched to /thru mode.");
|
|
||||||
} else {
|
|
||||||
player.printError("You don't have permission for /thru.");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (player.hasPermission("worldedit.navigation.jumpto")) {
|
|
||||||
session.setCompassMode(CompassMode.JUMPTO);
|
|
||||||
player.print("Switched to /jumpto mode.");
|
|
||||||
} else {
|
|
||||||
player.printError("You don't have permission for /jumpto.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Tool tool = session.getTool(player.getItemInHand());
|
Tool tool = session.getTool(player.getItemInHand());
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren