Skip to content
Permalink
Browse files

Fixed Gates not using minified IDs.

  • Loading branch information...
me4502 committed Feb 24, 2019
1 parent 96251fb commit 98ee4db3f78499652207e0759f6b8a93bec55e49
@@ -281,7 +281,8 @@ public void onRightClick(SignClickEvent event) {
addBlocks(sign, amount);

if (enforceType) {
sign.setLine(0, player.getItemInHand(HandSide.MAIN_HAND).getType().getId());
BlockType blockType = player.getItemInHand(HandSide.MAIN_HAND).getType().getBlockType();
sign.setLine(0, BlockSyntax.toMinifiedId(blockType));
sign.update(false);
}

@@ -503,7 +504,7 @@ public BlockState getGateBlock(ChangedSign sign, boolean smallSearchSize) {
}

if(enforceType && gateBlock != null && !gateBlock.getBlockType().getMaterial().isAir()) {
sign.setLine(0, BlockSyntax.toMinifiedId(gateBlock.getBlockType().getFuzzyMatcher()));
sign.setLine(0, BlockSyntax.toMinifiedId(gateBlock.getBlockType()));
sign.update(false);
}
}
@@ -23,6 +23,7 @@
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.registry.LegacyMapper;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
@@ -87,6 +88,14 @@ public static BlockData getBukkitBlock(String line) {
return BukkitAdapter.adapt(getBlock(line));
}

public static String toMinifiedId(BlockType holder) {
String output = holder.getId();
if (output.startsWith("minecraft:")) {
output = output.substring(10);
}
return output;
}

public static String toMinifiedId(BlockStateHolder holder) {
String output = holder.getAsString();
if (output.startsWith("minecraft:")) {

0 comments on commit 98ee4db

Please sign in to comment.
You can’t perform that action at this time.