From 18ce3625c7c46f274503b95b04efbec21bea8318 Mon Sep 17 00:00:00 2001 From: MrBretzel Date: Wed, 20 Jan 2021 20:22:54 +0100 Subject: [PATCH 1/2] Added withProperties in BlockAlternative.java Example: blockAlternative.withProperties("facing"); Return the facing of the block a empty string --- .../server/instance/block/BlockAlternative.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/net/minestom/server/instance/block/BlockAlternative.java b/src/main/java/net/minestom/server/instance/block/BlockAlternative.java index f2165b7c9..1ecd9dc8b 100644 --- a/src/main/java/net/minestom/server/instance/block/BlockAlternative.java +++ b/src/main/java/net/minestom/server/instance/block/BlockAlternative.java @@ -30,6 +30,16 @@ public class BlockAlternative { } return map; } + + public String withProperties(String key) { + for (String p : properties) { + String[] parts = p.split("="); + if (parts.length > 1) + if (parts[0].equals(key)) + return parts[1]; + } + return ""; + } @Override public String toString() { From 840eb1a27e41f58b2619c586e1918bdf7fff5f2d Mon Sep 17 00:00:00 2001 From: MrBretzel Date: Thu, 21 Jan 2021 17:21:36 +0100 Subject: [PATCH 2/2] Update BlockAlternative.java --- .../net/minestom/server/instance/block/BlockAlternative.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minestom/server/instance/block/BlockAlternative.java b/src/main/java/net/minestom/server/instance/block/BlockAlternative.java index 1ecd9dc8b..584193182 100644 --- a/src/main/java/net/minestom/server/instance/block/BlockAlternative.java +++ b/src/main/java/net/minestom/server/instance/block/BlockAlternative.java @@ -31,14 +31,14 @@ public class BlockAlternative { return map; } - public String withProperties(String key) { + public String getProperty(String key) { for (String p : properties) { String[] parts = p.split("="); if (parts.length > 1) if (parts[0].equals(key)) return parts[1]; } - return ""; + return null; } @Override