More fixes (can't have optional [] on types), experimental set effect...

... updated but still not working.
This commit is contained in:
Richard 2015-11-29 01:42:11 -02:00
parent 561a620bdc
commit 84907dd3a2
3 changed files with 11 additions and 6 deletions

View File

@ -1,6 +1,6 @@
name: SkStuff
author: TheBukor
description: A Skript addon which adds extra functionalities such as NBT and extended WorldEdit support.
version: 1.2.1
version: 1.2.2
main: me.TheBukor.SkStuff
softdepend: [Skript]

View File

@ -56,7 +56,7 @@ public class SkStuff extends JavaPlugin {
Skript.registerExpression(ExprNBTv1_8_R1.class, NBTTagCompound.class, ExpressionType.PROPERTY, "nbt[[ ]tag[s]] of %entity/block/itemstack%", "%entity/block/itemstack%'s nbt[[ ]tag[s]]");
Skript.registerExpression(ExprItemNBTv1_8_R1.class, ItemStack.class, ExpressionType.SIMPLE, "%itemstack% with [custom] nbt[[ ]tag[s]] %string%");
Skript.registerExpression(ExprTagOfv1_8_R1.class, Object.class, ExpressionType.SIMPLE, "[nbt[ ]]tag %string% of [nbt [compound]] %compound%");
Classes.registerClass(new ClassInfo<NBTTagCompound>(NBTTagCompound.class, "[nbt] compound[s]").name("NBT Tag Compound").parser(new Parser<NBTTagCompound>() {
Classes.registerClass(new ClassInfo<NBTTagCompound>(NBTTagCompound.class, "compound").name("NBT Tag Compound").parser(new Parser<NBTTagCompound>() {
@Override
public String getVariableNamePattern() {
@ -93,7 +93,7 @@ public class SkStuff extends JavaPlugin {
Skript.registerExpression(ExprNBTv1_8_R2.class, net.minecraft.server.v1_8_R2.NBTTagCompound.class, ExpressionType.PROPERTY, "nbt[[ ]tag[s]] of %entity/block/itemstack%", "%entity/block/itemstack%'s nbt[[ ]tag[s]]");
Skript.registerExpression(ExprItemNBTv1_8_R2.class, ItemStack.class, ExpressionType.SIMPLE, "%itemstack% with [custom] nbt[[ ]tag[s]] %string%");
Skript.registerExpression(ExprTagOfv1_8_R2.class, Object.class, ExpressionType.SIMPLE, "[nbt[ ]]tag %string% of [nbt [compound]] %compound%");
Classes.registerClass(new ClassInfo<net.minecraft.server.v1_8_R2.NBTTagCompound>(net.minecraft.server.v1_8_R2.NBTTagCompound.class, "[nbt] compound[s]").name("NBT Tag Compound").parser(new Parser<net.minecraft.server.v1_8_R2.NBTTagCompound>() {
Classes.registerClass(new ClassInfo<net.minecraft.server.v1_8_R2.NBTTagCompound>(net.minecraft.server.v1_8_R2.NBTTagCompound.class, "compound").name("NBT Tag Compound").parser(new Parser<net.minecraft.server.v1_8_R2.NBTTagCompound>() {
@Override
public String getVariableNamePattern() {
@ -134,7 +134,7 @@ public class SkStuff extends JavaPlugin {
Skript.registerExpression(ExprNBTv1_8_R3.class, net.minecraft.server.v1_8_R3.NBTTagCompound.class, ExpressionType.PROPERTY, "nbt[[ ]tag[s]] of %entity/block/itemstack%", "%entity/block/itemstack%'s nbt[[ ]tag[s]]");
Skript.registerExpression(ExprItemNBTv1_8_R3.class, ItemStack.class, ExpressionType.SIMPLE, "%itemstack% with [custom] nbt[[ ]tag[s]] %string%");
Skript.registerExpression(ExprTagOfv1_8_R3.class, Object.class, ExpressionType.SIMPLE, "[nbt[ ]]tag %string% of [nbt [compound]] %compound%");
Classes.registerClass(new ClassInfo<net.minecraft.server.v1_8_R3.NBTTagCompound>(net.minecraft.server.v1_8_R3.NBTTagCompound.class, "[nbt] compound[s]").name("NBT Compound").parser(new Parser<net.minecraft.server.v1_8_R3.NBTTagCompound>() {
Classes.registerClass(new ClassInfo<net.minecraft.server.v1_8_R3.NBTTagCompound>(net.minecraft.server.v1_8_R3.NBTTagCompound.class, "compound").name("NBT Compound").parser(new Parser<net.minecraft.server.v1_8_R3.NBTTagCompound>() {
@Override
public String getVariableNamePattern() {

View File

@ -12,6 +12,7 @@ import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.world.World;
import ch.njol.skript.lang.Effect;
import ch.njol.skript.lang.Expression;
@ -44,12 +45,16 @@ public class EffExecuteWorldEdit extends Effect {
Player p = player.getSingle(e);
ItemStack b = block.getSingle(e);
Integer limit = blockLimit.getSingle(e);
if (limit == null) limit = we.getWorldEdit().getConfiguration().defaultChangeLimit;
if (we.getSelection(p) != null) {
if (b.getType().isBlock()) {
try {
EditSession session = we.createEditSession(p);
session.setBlockChangeLimit(limit != null ? limit : 4096);
session.setBlocks(we.getSession(p).getRegion(), new BaseBlock(b.getTypeId()));
p.sendMessage(Boolean.toString(session.isQueueEnabled()));
session.enableQueue();
session.setBlockChangeLimit(limit);
session.setBlocks(we.getSession(p).getSelection((World) we.wrapPlayer(p).getWorld()), new BaseBlock(b.getTypeId(), b.getDurability()));
we.getSession(p).remember(session);
} catch (MaxChangedBlocksException | IncompleteRegionException ex) {
return;
}