This commit is contained in:
Jesse Boyd 2018-08-24 01:22:30 +10:00
parent 963d1192c2
commit dbd31ea347
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
14 changed files with 54 additions and 19 deletions

View File

@ -65,9 +65,6 @@ subprojects {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
version = rootProject.version
group = 'com.boydti.fawe'
compileJava { options.compilerArgs += ["-parameters"] }
repositories {

View File

@ -91,7 +91,7 @@ public class Message
@SuppressWarnings("deprecation")
public void replace()
{
snipeData.sendMessage(ChatColor.AQUA + "Replace Material: " + ChatColor.RED + snipeData.getReplaceId() + ChatColor.GRAY + " (" + BlockTypes.get(snipeData.getReplaceId()).toString() + ")");
snipeData.sendMessage(ChatColor.AQUA + "Replace Material: " + BlockTypes.getFromStateId(snipeData.getReplaceId()));
}
/**
@ -144,7 +144,7 @@ public class Message
@SuppressWarnings("deprecation")
public void voxel()
{
snipeData.sendMessage(ChatColor.GOLD + "Voxel: " + ChatColor.RED + snipeData.getVoxelId() + ChatColor.GRAY + " (" + BlockTypes.get(snipeData.getVoxelId()).toString() + ")");
snipeData.sendMessage(ChatColor.GOLD + "Voxel: " + ChatColor.RED + BlockTypes.getFromStateId(snipeData.getVoxelId()));
}
/**

View File

@ -112,7 +112,7 @@ public class VoxelSniper extends JavaPlugin
@Override
public boolean execute(FawePlayer fp, String... args) {
Player player = (Player) fp.parent;
return (Bukkit.getPluginManager().getPlugin("VoxelSniper")).onCommand(player, new Command("p") {
return onCommand(player, new Command("p") {
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
return false;
@ -125,7 +125,7 @@ public class VoxelSniper extends JavaPlugin
@Override
public boolean execute(FawePlayer fp, String... args) {
Player player = (Player) fp.parent;
return (Bukkit.getPluginManager().getPlugin("VoxelSniper")).onCommand(player, new Command("d") {
return onCommand(player, new Command("d") {
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
return false;

View File

@ -1,5 +1,9 @@
package com.thevoxelbox.voxelsniper;
import com.boydti.fawe.object.FawePlayer;
import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.worldedit.extension.platform.CommandManager;
import com.sk89q.worldedit.util.command.parametric.ExceptionConverter;
import com.thevoxelbox.voxelsniper.api.command.VoxelCommand;
import com.thevoxelbox.voxelsniper.command.*;
import org.bukkit.ChatColor;
@ -11,6 +15,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
/**
* @author Voxel
@ -72,7 +77,32 @@ public class VoxelSniperListener implements Listener
return true;
}
return found.onCommand(player, split);
FawePlayer fp = FawePlayer.wrap(player);
ExceptionConverter exceptionConverter = CommandManager.getInstance().getExceptionConverter();
try {
try {
return found.onCommand(player, split);
} catch (Throwable t) {
Throwable next = t;
exceptionConverter.convert(next);
while (next.getCause() != null) {
next = next.getCause();
exceptionConverter.convert(next);
}
throw next;
}
} catch (CommandException e) {
String message = e.getMessage();
if (message != null) {
fp.sendMessage(e.getMessage());
return true;
}
e.printStackTrace();
} catch (Throwable e) {
e.printStackTrace();
}
fp.sendMessage("An unknown FAWE error has occurred! Please see console.");
return true;
}
private boolean hasPermission(final VoxelCommand command, final Player player)

View File

@ -149,7 +149,7 @@ public class ScannerBrush extends Brush
@Override
protected final void arrow(final SnipeData v)
{
this.checkFor = BukkitAdapter.adapt(BlockTypes.get(v.getVoxelId()));
this.checkFor = BukkitAdapter.adapt(BlockTypes.getFromStateId(v.getVoxelId()));
this.scan(v, this.getTargetBlock().getFace(this.getLastBlock()));
}
@ -157,7 +157,7 @@ public class ScannerBrush extends Brush
@Override
protected final void powder(final SnipeData v)
{
this.checkFor = BukkitAdapter.adapt(BlockTypes.get(v.getVoxelId()));
this.checkFor = BukkitAdapter.adapt(BlockTypes.getFromStateId(v.getVoxelId()));
this.scan(v, this.getTargetBlock().getFace(this.getLastBlock()));
}

View File

@ -19,7 +19,7 @@ import java.util.List;
public class VoxelList
{
private BlockMask mask = new BlockMask(NullExtent.INSTANCE);
private BlockMask mask = new BlockMask();
/**
* Adds the specified id, data value pair to the VoxelList. A data value of -1 will operate on all data values of that id.

View File

@ -35,12 +35,14 @@ dependencies {
processResources {
from (sourceSets.main.resources.srcDirs) {
expand 'internalVersion': project.internalVersion
expand 'version': project.internalVersion
include 'plugin.yml'
include 'fawe.properties'
}
from (sourceSets.main.resources.srcDirs) {
exclude 'plugin.yml'
exclude 'fawe.properties'
}
}

View File

@ -22,6 +22,7 @@ package com.sk89q.worldedit.bukkit;
import static com.google.common.base.Preconditions.checkNotNull;
import com.bekvon.bukkit.residence.commands.material;
import com.sk89q.worldedit.NotABlockException;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.entity.Entity;
@ -336,7 +337,7 @@ public class BukkitAdapter {
if (itemStack.getType().isBlock()) {
return adapt(itemStack.getType().createBlockData());
} else {
return BlockTypes.AIR.getDefaultState();
throw new NotABlockException();
}
}

View File

@ -149,7 +149,7 @@ public class BukkitServerInterface implements MultiUserPlatform {
@Override
public String getPlatformName() {
return "Bukkit-Official";
return "bukkit";
}
@Override

View File

@ -1,6 +1,6 @@
name: WorldEdit
main: com.sk89q.worldedit.bukkit.WorldEditPlugin
version: "${internalVersion}"
version: "${version}"
api-version: 1.13
description: Fast Async WorldEdit plugin
authors: [Empire92]

View File

@ -83,9 +83,7 @@ public class WorldEditCommands {
}
actor.printDebug("------------------------------------");
}
actor.print(BBC.getPrefix() + "WorldEdit " + WorldEdit.getVersion() + " by sk89q");
PlatformManager pm = we.getPlatformManager();
actor.printDebug("------------------------------------");
actor.printDebug("Platforms:");
for (Platform platform : pm.getPlatforms()) {
actor.printDebug(String.format(" - %s (%s)", platform.getPlatformName(), platform.getPlatformVersion()));

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.platform;
import com.sk89q.worldedit.NotABlockException;
import com.sk89q.worldedit.PlayerDirection;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditException;
@ -394,7 +395,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
if (typeId.hasBlockType()) {
return typeId.getBlockType().getDefaultState();
} else {
return BlockTypes.AIR.getDefaultState();
throw new NotABlockException();
}
}

View File

@ -37,7 +37,7 @@ public abstract class AbstractLoggingExtent extends AbstractDelegateExtent {
*
* @param extent the extent
*/
protected AbstractLoggingExtent(Extent extent) {
public AbstractLoggingExtent(Extent extent) {
super(extent);
}

View File

@ -7,6 +7,7 @@ import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.StringMan;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.extent.NullExtent;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.registry.state.AbstractProperty;
@ -40,6 +41,11 @@ public class BlockMask extends AbstractExtentMask {
this.bitSets = new BlockMaskBuilder().addBlocks(blocks).optimize().getBits();
}
public BlockMask() {
super(NullExtent.INSTANCE);
this.bitSets = new long[BlockTypes.size()][];
}
protected BlockMask(Extent extent, long[][] bitSets) {
super(extent);
this.bitSets = bitSets;