mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Finish removal of PlayerDirection, and partially added diagonal support back to commands. (Other minor changes to WorldEdit-Sponge and FAVS)
This commit is contained in:
parent
13bf8429ce
commit
f3c633582e
@ -272,7 +272,7 @@ public class SnipeData {
|
|||||||
* @param voxelId the voxelId to set
|
* @param voxelId the voxelId to set
|
||||||
*/
|
*/
|
||||||
public final void setVoxelId(final int voxelId) {
|
public final void setVoxelId(final int voxelId) {
|
||||||
if (WorldEdit.getInstance().getConfiguration().disallowedBlocks.contains(voxelId)) {
|
if (WorldEdit.getInstance().getConfiguration().disallowedBlocks.contains(BlockTypes.getFromStateId(voxelId).getId())) {
|
||||||
if (owner != null) {
|
if (owner != null) {
|
||||||
Player plr = owner.getPlayer();
|
Player plr = owner.getPlayer();
|
||||||
if (plr != null) {
|
if (plr != null) {
|
||||||
|
@ -55,7 +55,7 @@ public class VoxelVoxelCommand extends VoxelCommand {
|
|||||||
Material blockType = block.getType();
|
Material blockType = block.getType();
|
||||||
|
|
||||||
BlockType weType = BukkitAdapter.adapt(blockType);
|
BlockType weType = BukkitAdapter.adapt(blockType);
|
||||||
if(!player.hasPermission("voxelsniper.ignorelimitations") && WorldEdit.getInstance().getConfiguration().disallowedBlocks.contains(weType)) {
|
if(!player.hasPermission("voxelsniper.ignorelimitations") && WorldEdit.getInstance().getConfiguration().disallowedBlocks.contains(weType.getId())) {
|
||||||
player.sendMessage("You are not allowed to use " + blockType.name() + ". (WorldEdit config.yml)");
|
player.sendMessage("You are not allowed to use " + blockType.name() + ". (WorldEdit config.yml)");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ public class VoxelVoxelCommand extends VoxelCommand {
|
|||||||
} else {
|
} else {
|
||||||
BlockType weType = BlockTypes.parse(args[0]);
|
BlockType weType = BlockTypes.parse(args[0]);
|
||||||
if(weType != null) {
|
if(weType != null) {
|
||||||
if(!player.hasPermission("voxelsniper.ignorelimitations") && WorldEdit.getInstance().getConfiguration().disallowedBlocks.contains(weType)) {
|
if(!player.hasPermission("voxelsniper.ignorelimitations") && WorldEdit.getInstance().getConfiguration().disallowedBlocks.contains(weType.getId())) {
|
||||||
player.sendMessage("You are not allowed to use " + weType + ".");
|
player.sendMessage("You are not allowed to use " + weType + ".");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -18,6 +18,7 @@ import com.sk89q.worldedit.internal.cui.CUIEvent;
|
|||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.session.SessionKey;
|
import com.sk89q.worldedit.session.SessionKey;
|
||||||
|
import com.sk89q.worldedit.util.Direction;
|
||||||
import com.sk89q.worldedit.util.HandSide;
|
import com.sk89q.worldedit.util.HandSide;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.util.TargetBlock;
|
import com.sk89q.worldedit.util.TargetBlock;
|
||||||
@ -342,7 +343,7 @@ public class PlayerWrapper extends AbstractPlayerActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlayerDirection getCardinalDirection() {
|
public Direction getCardinalDirection() {
|
||||||
return parent.getCardinalDirection();
|
return parent.getCardinalDirection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public abstract class LocalConfiguration {
|
|||||||
protected static final String[] defaultDisallowedBlocks = new String[] {};
|
protected static final String[] defaultDisallowedBlocks = new String[] {};
|
||||||
|
|
||||||
public boolean profile = false;
|
public boolean profile = false;
|
||||||
public Set<BlockType> disallowedBlocks = new HashSet<>();
|
public Set<String> disallowedBlocks = new HashSet<>();
|
||||||
public int defaultChangeLimit = -1;
|
public int defaultChangeLimit = -1;
|
||||||
public int maxChangeLimit = -1;
|
public int maxChangeLimit = -1;
|
||||||
public int defaultMaxPolygonalPoints = -1;
|
public int defaultMaxPolygonalPoints = -1;
|
||||||
@ -65,7 +65,7 @@ public abstract class LocalConfiguration {
|
|||||||
public String navigationWand = ItemTypes.COMPASS.getId();
|
public String navigationWand = ItemTypes.COMPASS.getId();
|
||||||
public int navigationWandMaxDistance = 50;
|
public int navigationWandMaxDistance = 50;
|
||||||
public int scriptTimeout = 3000;
|
public int scriptTimeout = 3000;
|
||||||
public Set<BlockType> allowedDataCycleBlocks = new HashSet<>();
|
public Set<String> allowedDataCycleBlocks = new HashSet<>();
|
||||||
public String saveDir = "schematics";
|
public String saveDir = "schematics";
|
||||||
public String scriptsDir = "craftscripts";
|
public String scriptsDir = "craftscripts";
|
||||||
public boolean showHelpInfo = true;
|
public boolean showHelpInfo = true;
|
||||||
|
@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* WorldEdit, a Minecraft world manipulation toolkit
|
|
||||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
|
||||||
* Copyright (C) WorldEdit team and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Lesser General Public License as published by the
|
|
||||||
* Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.sk89q.worldedit;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
|
||||||
import com.sk89q.worldedit.util.Direction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The player's direction.
|
|
||||||
*
|
|
||||||
* <p>In the future, this class will be replaced with {@link Direction}.</p>
|
|
||||||
*/
|
|
||||||
public enum PlayerDirection {
|
|
||||||
|
|
||||||
NORTH(Vector3.at(0, 0, -1), true),
|
|
||||||
NORTH_EAST((Vector3.at(1, 0, -1)).normalize(), false),
|
|
||||||
EAST(Vector3.at(1, 0, 0), true),
|
|
||||||
SOUTH_EAST((Vector3.at(1, 0, 1)).normalize(), false),
|
|
||||||
SOUTH(Vector3.at(0, 0, 1), true),
|
|
||||||
SOUTH_WEST((Vector3.at(-1, 0, 1)).normalize(), false),
|
|
||||||
WEST(Vector3.at(-1, 0, 0), true),
|
|
||||||
NORTH_WEST((Vector3.at(-1, 0, -1)).normalize(), false),
|
|
||||||
UP(Vector3.at(0, 1, 0), true),
|
|
||||||
DOWN(Vector3.at(0, -1, 0), true);
|
|
||||||
|
|
||||||
private final Vector3 dir;
|
|
||||||
private final boolean isOrthogonal;
|
|
||||||
|
|
||||||
PlayerDirection(Vector3 vec, boolean isOrthogonal) {
|
|
||||||
this.dir = vec;
|
|
||||||
this.isOrthogonal = isOrthogonal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector3 vector() {
|
|
||||||
return dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isOrthogonal() {
|
|
||||||
return isOrthogonal;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -49,6 +49,7 @@ import com.sk89q.worldedit.scripting.CraftScriptEngine;
|
|||||||
import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine;
|
import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine;
|
||||||
import com.sk89q.worldedit.session.SessionManager;
|
import com.sk89q.worldedit.session.SessionManager;
|
||||||
import com.sk89q.worldedit.session.request.Request;
|
import com.sk89q.worldedit.session.request.Request;
|
||||||
|
import com.sk89q.worldedit.util.Direction;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.util.eventbus.EventBus;
|
import com.sk89q.worldedit.util.eventbus.EventBus;
|
||||||
import com.sk89q.worldedit.util.io.file.FileSelectionAbortedException;
|
import com.sk89q.worldedit.util.io.file.FileSelectionAbortedException;
|
||||||
@ -385,22 +386,36 @@ public class WorldEdit {
|
|||||||
public BlockVector3 getDirection(Player player, String dirStr) throws UnknownDirectionException {
|
public BlockVector3 getDirection(Player player, String dirStr) throws UnknownDirectionException {
|
||||||
dirStr = dirStr.toLowerCase();
|
dirStr = dirStr.toLowerCase();
|
||||||
|
|
||||||
final PlayerDirection dir = getPlayerDirection(player, dirStr);
|
final Direction dir = getPlayerDirection(player, dirStr);
|
||||||
|
|
||||||
switch (dir) {
|
if (dir.isUpright() || dir.isCardinal()) {
|
||||||
case WEST:
|
return dir.toBlockVector();
|
||||||
case EAST:
|
} else {
|
||||||
case SOUTH:
|
|
||||||
case NORTH:
|
|
||||||
case UP:
|
|
||||||
case DOWN:
|
|
||||||
return dir.vector().toBlockPoint();
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new UnknownDirectionException(dir.name());
|
throw new UnknownDirectionException(dir.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the direction vector for a player's direction. May return
|
||||||
|
* null if a direction could not be found.
|
||||||
|
*
|
||||||
|
* @param player the player
|
||||||
|
* @param dirStr the direction string
|
||||||
|
* @return a direction vector
|
||||||
|
* @throws UnknownDirectionException thrown if the direction is not known
|
||||||
|
*/
|
||||||
|
public BlockVector3 getDiagonalDirection(Player player, String dirStr) throws UnknownDirectionException {
|
||||||
|
dirStr = dirStr.toLowerCase();
|
||||||
|
|
||||||
|
final Direction dir = getPlayerDirection(player, dirStr);
|
||||||
|
|
||||||
|
if (dir.isCardinal() || dir.isOrdinal() || dir.isUpright()) {
|
||||||
|
return dir.toBlockVector();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new UnknownDirectionException(dir.name());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the direction vector for a player's direction. May return
|
* Get the direction vector for a player's direction. May return
|
||||||
* null if a direction could not be found.
|
* null if a direction could not be found.
|
||||||
@ -410,46 +425,46 @@ public class WorldEdit {
|
|||||||
* @return a direction enum value
|
* @return a direction enum value
|
||||||
* @throws UnknownDirectionException thrown if the direction is not known
|
* @throws UnknownDirectionException thrown if the direction is not known
|
||||||
*/
|
*/
|
||||||
private PlayerDirection getPlayerDirection(Player player, String dirStr) throws UnknownDirectionException {
|
private Direction getPlayerDirection(Player player, String dirStr) throws UnknownDirectionException {
|
||||||
final PlayerDirection dir;
|
final Direction dir;
|
||||||
|
|
||||||
switch (dirStr.charAt(0)) {
|
switch (dirStr.charAt(0)) {
|
||||||
case 'w':
|
case 'w':
|
||||||
dir = PlayerDirection.WEST;
|
dir = Direction.WEST;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'e':
|
case 'e':
|
||||||
dir = PlayerDirection.EAST;
|
dir = Direction.EAST;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
if (dirStr.indexOf('w') > 0) {
|
if (dirStr.indexOf('w') > 0) {
|
||||||
return PlayerDirection.SOUTH_WEST;
|
return Direction.SOUTHWEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirStr.indexOf('e') > 0) {
|
if (dirStr.indexOf('e') > 0) {
|
||||||
return PlayerDirection.SOUTH_EAST;
|
return Direction.SOUTHEAST;
|
||||||
}
|
}
|
||||||
dir = PlayerDirection.SOUTH;
|
dir = Direction.SOUTH;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
if (dirStr.indexOf('w') > 0) {
|
if (dirStr.indexOf('w') > 0) {
|
||||||
return PlayerDirection.NORTH_WEST;
|
return Direction.NORTHWEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirStr.indexOf('e') > 0) {
|
if (dirStr.indexOf('e') > 0) {
|
||||||
return PlayerDirection.NORTH_EAST;
|
return Direction.NORTHEAST;
|
||||||
}
|
}
|
||||||
dir = PlayerDirection.NORTH;
|
dir = Direction.NORTH;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'u':
|
case 'u':
|
||||||
dir = PlayerDirection.UP;
|
dir = Direction.UP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
dir = PlayerDirection.DOWN;
|
dir = Direction.DOWN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm': // me
|
case 'm': // me
|
||||||
@ -475,6 +490,7 @@ public class WorldEdit {
|
|||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush a block bag's changes to a player.
|
* Flush a block bag's changes to a player.
|
||||||
*
|
*
|
||||||
|
@ -543,7 +543,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
public void move(FawePlayer player, LocalSession session, EditSession editSession,
|
public void move(FawePlayer player, LocalSession session, EditSession editSession,
|
||||||
@Selection Region region,
|
@Selection Region region,
|
||||||
@Optional("1") @Range(min = 1) int count,
|
@Optional("1") @Range(min = 1) int count,
|
||||||
@Optional(Direction.AIM) @Direction BlockVector3 direction,
|
@Optional(Direction.AIM) @Direction(includeDiagonals = true) BlockVector3 direction,
|
||||||
@Optional("air") Pattern replace,
|
@Optional("air") Pattern replace,
|
||||||
@Switch('b') boolean copyBiomes,
|
@Switch('b') boolean copyBiomes,
|
||||||
@Switch('e') boolean skipEntities,
|
@Switch('e') boolean skipEntities,
|
||||||
@ -610,7 +610,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
public void stack(FawePlayer player, LocalSession session, EditSession editSession,
|
public void stack(FawePlayer player, LocalSession session, EditSession editSession,
|
||||||
@Selection Region region,
|
@Selection Region region,
|
||||||
@Optional("1") @Range(min = 1) int count,
|
@Optional("1") @Range(min = 1) int count,
|
||||||
@Optional(Direction.AIM) @Direction BlockVector3 direction,
|
@Optional(Direction.AIM) @Direction(includeDiagonals = true) BlockVector3 direction,
|
||||||
@Switch('s') boolean moveSelection,
|
@Switch('s') boolean moveSelection,
|
||||||
@Switch('b') boolean copyBiomes,
|
@Switch('b') boolean copyBiomes,
|
||||||
@Switch('e') boolean skipEntities,
|
@Switch('e') boolean skipEntities,
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
package com.sk89q.worldedit.entity;
|
package com.sk89q.worldedit.entity;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.sk89q.worldedit.PlayerDirection;
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
@ -30,6 +28,7 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
|||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
|
import com.sk89q.worldedit.util.Direction;
|
||||||
import com.sk89q.worldedit.util.HandSide;
|
import com.sk89q.worldedit.util.HandSide;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
@ -61,7 +60,7 @@ public interface Player extends Entity, Actor {
|
|||||||
*
|
*
|
||||||
* @return the direction
|
* @return the direction
|
||||||
*/
|
*/
|
||||||
PlayerDirection getCardinalDirection(int yawOffset);
|
Direction getCardinalDirection(int yawOffset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the item that the player is holding.
|
* Get the item that the player is holding.
|
||||||
@ -241,7 +240,7 @@ public interface Player extends Entity, Actor {
|
|||||||
*
|
*
|
||||||
* @return the direction
|
* @return the direction
|
||||||
*/
|
*/
|
||||||
PlayerDirection getCardinalDirection();
|
Direction getCardinalDirection();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pass through the wall that you are looking at.
|
* Pass through the wall that you are looking at.
|
||||||
|
@ -267,7 +267,7 @@ public class DefaultBlockParser extends InputParser<BlockStateHolder> {
|
|||||||
if (context.isRestricted()) {
|
if (context.isRestricted()) {
|
||||||
Actor actor = context.requireActor();
|
Actor actor = context.requireActor();
|
||||||
if (actor != null) {
|
if (actor != null) {
|
||||||
if (!actor.hasPermission("worldedit.anyblock") && worldEdit.getConfiguration().disallowedBlocks.contains(blockType)) {
|
if (!actor.hasPermission("worldedit.anyblock") && worldEdit.getConfiguration().disallowedBlocks.contains(blockType.getId())) {
|
||||||
throw new DisallowedUsageException("You are not allowed to use '" + input + "'");
|
throw new DisallowedUsageException("You are not allowed to use '" + input + "'");
|
||||||
}
|
}
|
||||||
if (nbt != null) {
|
if (nbt != null) {
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
package com.sk89q.worldedit.extension.platform;
|
package com.sk89q.worldedit.extension.platform;
|
||||||
|
|
||||||
import com.sk89q.worldedit.NotABlockException;
|
import com.sk89q.worldedit.NotABlockException;
|
||||||
import com.sk89q.worldedit.PlayerDirection;
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
@ -28,6 +27,7 @@ import com.sk89q.worldedit.extent.Extent;
|
|||||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
|
import com.sk89q.worldedit.util.Direction;
|
||||||
import com.sk89q.worldedit.util.HandSide;
|
import com.sk89q.worldedit.util.HandSide;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.util.TargetBlock;
|
import com.sk89q.worldedit.util.TargetBlock;
|
||||||
@ -71,25 +71,25 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
* @param rot yaw
|
* @param rot yaw
|
||||||
* @return the direction
|
* @return the direction
|
||||||
*/
|
*/
|
||||||
private static PlayerDirection getDirection(double rot) {
|
private static Direction getDirection(double rot) {
|
||||||
if (0 <= rot && rot < 22.5) {
|
if (0 <= rot && rot < 22.5) {
|
||||||
return PlayerDirection.SOUTH;
|
return Direction.SOUTH;
|
||||||
} else if (22.5 <= rot && rot < 67.5) {
|
} else if (22.5 <= rot && rot < 67.5) {
|
||||||
return PlayerDirection.SOUTH_WEST;
|
return Direction.SOUTHWEST;
|
||||||
} else if (67.5 <= rot && rot < 112.5) {
|
} else if (67.5 <= rot && rot < 112.5) {
|
||||||
return PlayerDirection.WEST;
|
return Direction.WEST;
|
||||||
} else if (112.5 <= rot && rot < 157.5) {
|
} else if (112.5 <= rot && rot < 157.5) {
|
||||||
return PlayerDirection.NORTH_WEST;
|
return Direction.NORTHWEST;
|
||||||
} else if (157.5 <= rot && rot < 202.5) {
|
} else if (157.5 <= rot && rot < 202.5) {
|
||||||
return PlayerDirection.NORTH;
|
return Direction.NORTH;
|
||||||
} else if (202.5 <= rot && rot < 247.5) {
|
} else if (202.5 <= rot && rot < 247.5) {
|
||||||
return PlayerDirection.NORTH_EAST;
|
return Direction.NORTHEAST;
|
||||||
} else if (247.5 <= rot && rot < 292.5) {
|
} else if (247.5 <= rot && rot < 292.5) {
|
||||||
return PlayerDirection.EAST;
|
return Direction.EAST;
|
||||||
} else if (292.5 <= rot && rot < 337.5) {
|
} else if (292.5 <= rot && rot < 337.5) {
|
||||||
return PlayerDirection.SOUTH_EAST;
|
return Direction.SOUTHEAST;
|
||||||
} else if (337.5 <= rot && rot < 360.0) {
|
} else if (337.5 <= rot && rot < 360.0) {
|
||||||
return PlayerDirection.SOUTH;
|
return Direction.SOUTH;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -377,17 +377,17 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlayerDirection getCardinalDirection() {
|
public Direction getCardinalDirection() {
|
||||||
return getCardinalDirection(0);
|
return getCardinalDirection(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlayerDirection getCardinalDirection(int yawOffset) {
|
public Direction getCardinalDirection(int yawOffset) {
|
||||||
if (getLocation().getPitch() > 67.5) {
|
if (getLocation().getPitch() > 67.5) {
|
||||||
return PlayerDirection.DOWN;
|
return Direction.DOWN;
|
||||||
}
|
}
|
||||||
if (getLocation().getPitch() < -67.5) {
|
if (getLocation().getPitch() < -67.5) {
|
||||||
return PlayerDirection.UP;
|
return Direction.UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
// From hey0's code
|
// From hey0's code
|
||||||
|
@ -35,4 +35,5 @@ public @interface Direction {
|
|||||||
|
|
||||||
String AIM = "me";
|
String AIM = "me";
|
||||||
|
|
||||||
|
boolean includeDiagonals() default false;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ import com.boydti.fawe.util.MathMan;
|
|||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.IncompleteRegionException;
|
import com.sk89q.worldedit.IncompleteRegionException;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.PlayerDirection;
|
|
||||||
import com.sk89q.worldedit.UnknownDirectionException;
|
import com.sk89q.worldedit.UnknownDirectionException;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
@ -313,7 +312,11 @@ public class WorldEditBinding extends BindingHelper {
|
|||||||
public BlockVector3 getDirection(ArgumentStack context, Direction direction)
|
public BlockVector3 getDirection(ArgumentStack context, Direction direction)
|
||||||
throws ParameterException, UnknownDirectionException {
|
throws ParameterException, UnknownDirectionException {
|
||||||
Player sender = getPlayer(context);
|
Player sender = getPlayer(context);
|
||||||
return worldEdit.getDirection(sender, context.next());
|
if (direction.includeDiagonals()) {
|
||||||
|
return worldEdit.getDiagonalDirection(sender, context.next());
|
||||||
|
} else {
|
||||||
|
return worldEdit.getDirection(sender, context.next());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,11 +81,9 @@ public class PropertiesConfiguration extends LocalConfiguration {
|
|||||||
profile = getBool("profile", profile);
|
profile = getBool("profile", profile);
|
||||||
|
|
||||||
disallowedBlocks =
|
disallowedBlocks =
|
||||||
new HashSet<>(getStringSet("limits.disallowed-blocks", defaultDisallowedBlocks))
|
new HashSet<>(getStringSet("limits.disallowed-blocks", defaultDisallowedBlocks));
|
||||||
.stream().map(e -> BlockTypes.parse(e)).collect(Collectors.toSet());
|
|
||||||
allowedDataCycleBlocks =
|
allowedDataCycleBlocks =
|
||||||
new HashSet<>(getStringSet("limits.allowed-data-cycle-blocks", null))
|
new HashSet<>(getStringSet("limits.allowed-data-cycle-blocks", null));
|
||||||
.stream().map(e -> BlockTypes.parse(e)).collect(Collectors.toSet());
|
|
||||||
defaultChangeLimit = getInt("default-max-changed-blocks", defaultChangeLimit);
|
defaultChangeLimit = getInt("default-max-changed-blocks", defaultChangeLimit);
|
||||||
maxChangeLimit = getInt("max-changed-blocks", maxChangeLimit);
|
maxChangeLimit = getInt("max-changed-blocks", maxChangeLimit);
|
||||||
defaultMaxPolygonalPoints = getInt("default-max-polygon-points", defaultMaxPolygonalPoints);
|
defaultMaxPolygonalPoints = getInt("default-max-polygon-points", defaultMaxPolygonalPoints);
|
||||||
|
@ -81,11 +81,9 @@ public class YAMLConfiguration extends LocalConfiguration {
|
|||||||
butcherMaxRadius = Math.max(-1, config.getInt("limits.butcher-radius.maximum", butcherMaxRadius));
|
butcherMaxRadius = Math.max(-1, config.getInt("limits.butcher-radius.maximum", butcherMaxRadius));
|
||||||
|
|
||||||
disallowedBlocks =
|
disallowedBlocks =
|
||||||
new HashSet<>(config.getStringList("limits.disallowed-blocks", Lists.newArrayList(defaultDisallowedBlocks)))
|
new HashSet<>(config.getStringList("limits.disallowed-blocks", Lists.newArrayList(defaultDisallowedBlocks)));
|
||||||
.stream().map(e -> BlockTypes.parse(e)).collect(Collectors.toSet());
|
|
||||||
allowedDataCycleBlocks =
|
allowedDataCycleBlocks =
|
||||||
new HashSet<>(config.getStringList("limits.allowed-data-cycle-blocks", null))
|
new HashSet<>(config.getStringList("limits.allowed-data-cycle-blocks", null));
|
||||||
.stream().map(e -> BlockTypes.parse(e)).collect(Collectors.toSet());
|
|
||||||
|
|
||||||
registerHelp = config.getBoolean("register-help", true);
|
registerHelp = config.getBoolean("register-help", true);
|
||||||
logCommands = config.getBoolean("logging.log-commands", logCommands);
|
logCommands = config.getBoolean("logging.log-commands", logCommands);
|
||||||
|
@ -8,29 +8,55 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'signing'
|
id 'org.spongepowered.plugin' version '0.9.0'
|
||||||
id 'org.spongepowered.plugin' version '0.8.1'
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven { url "https://repo.codemc.org/repository/maven-public" }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':worldedit-core')
|
compile project(':worldedit-core')
|
||||||
compile 'org.spongepowered:spongeapi:7.0.0-SNAPSHOT'
|
compile 'org.spongepowered:spongeapi:7.1.0'
|
||||||
|
compile 'org.bstats:bstats-sponge:1.4'
|
||||||
testCompile group: 'org.mockito', name: 'mockito-core', version:'1.9.0-rc1'
|
testCompile group: 'org.mockito', name: 'mockito-core', version:'1.9.0-rc1'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
||||||
sponge {
|
jar.archiveName="fawe-sponge-${project.parent.version}.jar"
|
||||||
plugin {
|
jar.destinationDir = file '../mvn/com/boydti/fawe-sponge/' + project.parent.version
|
||||||
id = 'worldedit'
|
task createPom << {
|
||||||
|
pom {
|
||||||
|
project {
|
||||||
|
groupId 'com.boydti'
|
||||||
|
artifactId 'fawe-sponge'
|
||||||
|
version project.parent.version
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
.getEffectivePom()
|
||||||
|
.setDependencies(new ArrayList<>())
|
||||||
|
.writeTo("../mvn/com/boydti/fawe-sponge/${project.parent.version}/fawe-sponge-${project.parent.version}.pom")
|
||||||
|
pom {
|
||||||
|
project {
|
||||||
|
groupId 'com.boydti'
|
||||||
|
artifactId 'fawe-sponge'
|
||||||
|
version 'latest'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.getEffectivePom()
|
||||||
|
.setDependencies(new ArrayList<>())
|
||||||
|
.writeTo("../mvn/com/boydti/fawe-sponge/latest/fawe-sponge-latest.pom")
|
||||||
}
|
}
|
||||||
|
task copyFiles {
|
||||||
jar {
|
doLast {
|
||||||
manifest {
|
copy {
|
||||||
attributes("Class-Path": "truezip.jar WorldEdit/truezip.jar js.jar WorldEdit/js.jar",
|
from "../mvn/com/boydti/fawe-sponge/${project.parent.version}/"
|
||||||
"WorldEdit-Version": version)
|
into '../mvn/com/boydti/fawe-sponge/latest/'
|
||||||
|
include('*.jar')
|
||||||
|
rename ("fawe-sponge-${project.parent.version}.jar", 'fawe-sponge-latest.jar')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,13 +64,10 @@ shadowJar {
|
|||||||
dependencies {
|
dependencies {
|
||||||
include(dependency(':worldedit-core'))
|
include(dependency(':worldedit-core'))
|
||||||
}
|
}
|
||||||
|
archiveName = "${parent.name}-${project.name.replaceAll("worldedit-", "")}-${parent.version}.jar"
|
||||||
|
destinationDir = file '../target'
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
build.dependsOn(shadowJar)
|
||||||
archives shadowJar
|
build.finalizedBy(copyFiles)
|
||||||
}
|
copyFiles.dependsOn(createPom)
|
||||||
|
|
||||||
signing {
|
|
||||||
required false
|
|
||||||
sign shadowJar
|
|
||||||
}
|
|
||||||
|
@ -31,6 +31,7 @@ import com.sk89q.worldedit.math.Vector3;
|
|||||||
import com.sk89q.worldedit.session.SessionKey;
|
import com.sk89q.worldedit.session.SessionKey;
|
||||||
import com.sk89q.worldedit.util.HandSide;
|
import com.sk89q.worldedit.util.HandSide;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||||
@ -186,8 +187,6 @@ public class SpongePlayer extends AbstractPlayerActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) {
|
public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) {
|
||||||
org.spongepowered.api.world.Location<World> loc = player.getWorld().getLocation(pos.getX(), pos.getY(), pos.getZ());
|
org.spongepowered.api.world.Location<World> loc = player.getWorld().getLocation(pos.getX(), pos.getY(), pos.getZ());
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
@ -205,7 +204,6 @@ public class SpongePlayer extends AbstractPlayerActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
|
||||||
public SessionKey getSessionKey() {
|
public SessionKey getSessionKey() {
|
||||||
return new SessionKeyImpl(player.getUniqueId(), player.getName());
|
return new SessionKeyImpl(player.getUniqueId(), player.getName());
|
||||||
}
|
}
|
||||||
|
@ -25,10 +25,7 @@ import com.flowpowered.math.vector.Vector3d;
|
|||||||
import com.flowpowered.math.vector.Vector3i;
|
import com.flowpowered.math.vector.Vector3i;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
>>>>>>> f54d6afb... Make BaseBlock more memory efficient, and make it clear in the API that it's not intended to be used for every single block.
|
|
||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
|
@ -211,7 +211,7 @@ public class SpongeWorldEdit {
|
|||||||
|
|
||||||
BlockType interactedType = targetBlock.getState().getType();
|
BlockType interactedType = targetBlock.getState().getType();
|
||||||
if (event instanceof InteractBlockEvent.Primary) {
|
if (event instanceof InteractBlockEvent.Primary) {
|
||||||
if (!interactedType.getMaterial().isAir()) {
|
if (interactedType != BlockTypes.AIR) {
|
||||||
if (!optLoc.isPresent()) {
|
if (!optLoc.isPresent()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -233,7 +233,7 @@ public class SpongeWorldEdit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (event instanceof InteractBlockEvent.Secondary) {
|
} else if (event instanceof InteractBlockEvent.Secondary) {
|
||||||
if (!interactedType.getMaterial().isAir()) {
|
if (interactedType != BlockTypes.AIR) {
|
||||||
if (!optLoc.isPresent()) {
|
if (!optLoc.isPresent()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user