Permalink
Browse files

Further updates for Sponge API 5.x

  • Loading branch information...
DarkArc committed Jun 9, 2016
1 parent 9a46d87 commit 8ce5719e5a4ed2fad79603e6f9cdfe306166ab83
@@ -31,11 +31,13 @@
import com.sk89q.worldedit.util.command.Dispatcher;
import com.sk89q.worldedit.world.World;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.entity.EntityType;
import org.spongepowered.api.item.ItemType;
import org.spongepowered.api.scheduler.Task;
import org.spongepowered.api.world.Location;
import javax.annotation.Nullable;
import java.util.*;
@@ -131,7 +133,7 @@ public CommandResult process(CommandSource source, String arguments) throws org.
}
@Override
public List<String> getSuggestions(CommandSource source, String arguments) throws org.spongepowered.api.command.CommandException {
public List<String> getSuggestions(CommandSource source, String arguments, @Nullable Location<org.spongepowered.api.world.World> targetPosition) throws CommandException {
CommandSuggestionEvent weEvent = new CommandSuggestionEvent(SpongeWorldEdit.inst().wrapCommandSource(source), command.getPrimaryAlias() + " " + arguments);
WorldEdit.getInstance().getEventBus().post(weEvent);
return weEvent.getSuggestions();
@@ -31,6 +31,7 @@
import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.sponge.nms.IDHelper;
import com.sk89q.worldedit.util.Location;
import org.spongepowered.api.data.type.HandTypes;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.text.Text;
@@ -60,7 +61,7 @@ public UUID getUniqueId() {
@Override
public int getItemInHand() {
Optional<ItemStack> is = this.player.getItemInHand();
Optional<ItemStack> is = this.player.getItemInHand(HandTypes.MAIN_HAND);
return is.isPresent() ? IDHelper.resolve(is.get().getItem()) : 0;
}

0 comments on commit 8ce5719

Please sign in to comment.