mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Made /thru work better.
This commit is contained in:
parent
9124cdd91f
commit
ebf5b97451
@ -86,26 +86,30 @@ public class SMWorldEditPlayer extends WorldEditPlayer {
|
||||
* @return whether the player was pass through
|
||||
*/
|
||||
public boolean passThroughForwardWall(int range) {
|
||||
int free = 0;
|
||||
int spots = 0;
|
||||
boolean foundNext = false;
|
||||
int searchDist = 0;
|
||||
|
||||
HitBlox hitBlox = new HitBlox(player, range, 0.2);
|
||||
Block block;
|
||||
|
||||
free = hitBlox.getLastBlock().getType() == 0 ? 1 : 0;
|
||||
while ((block = hitBlox.getNextBlock()) != null) {
|
||||
searchDist++;
|
||||
|
||||
if (searchDist > 20) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (block.getType() == 0) {
|
||||
free++;
|
||||
if (spots >= 1) {
|
||||
Vector v = new Vector(block.getX(), block.getY() + 1, block.getZ());
|
||||
if (foundNext) {
|
||||
Vector v = new Vector(block.getX(), block.getY() - 1, block.getZ());
|
||||
|
||||
if (server.getBlockType(v) == 0) {
|
||||
setPosition(v.subtract(0, 1, 0));
|
||||
setPosition(v.add(0.5, 0, 0.5));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
free = 0;
|
||||
spots++;
|
||||
foundNext = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,7 @@ public class WorldEdit {
|
||||
// Go through a wall
|
||||
} else if (split[0].equalsIgnoreCase("/thru")) {
|
||||
checkArgs(split, 0, 0, split[0]);
|
||||
if (player.passThroughForwardWall(300)) {
|
||||
if (player.passThroughForwardWall(6)) {
|
||||
player.print("Whoosh!");
|
||||
} else {
|
||||
player.printError("No free spot ahead of you found.");
|
||||
|
Loading…
Reference in New Issue
Block a user