diff --git a/pom.xml b/pom.xml
index b3763e8..afd9fb2 100755
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
minecraftwars
gringotts
- 2.12.6-SNAPSHOT
+ 2.12.7-SNAPSHOT
false
diff --git a/src/main/java/org/gestern/gringotts/AccountChest.java b/src/main/java/org/gestern/gringotts/AccountChest.java
index 9099eee..bc8034f 100755
--- a/src/main/java/org/gestern/gringotts/AccountChest.java
+++ b/src/main/java/org/gestern/gringotts/AccountChest.java
@@ -1,6 +1,7 @@
package org.gestern.gringotts;
import io.papermc.lib.PaperLib;
+import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
@@ -10,13 +11,20 @@
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
/**
* Represents a storage unit for an account.
*
* @author jast
*/
public class AccountChest {
+
+ private final Pattern VAULT_PATTERN = Pattern.compile(Configuration.CONF.vaultPattern, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
+
public final String id;
+
/**
* Sign marking the chest as an account chest.
*/
@@ -186,9 +194,12 @@ public boolean notValid() {
}
String[] lines = sign.getLines();
- String line0 = lines[0];
+ String line0 = ChatColor.stripColor(lines[0]).trim();
+
+
+ Matcher match = VAULT_PATTERN.matcher(line0);
- if (!line0.matches(Configuration.CONF.vaultPattern)) {
+ if (!match.matches()) {
return true;
}
diff --git a/src/main/java/org/gestern/gringotts/GringottsAccount.java b/src/main/java/org/gestern/gringotts/GringottsAccount.java
index 2b2c991..27bb68e 100644
--- a/src/main/java/org/gestern/gringotts/GringottsAccount.java
+++ b/src/main/java/org/gestern/gringotts/GringottsAccount.java
@@ -347,7 +347,7 @@ public long addToShulkerBox(long remaining, Inventory inventory) {
public long removeFromShulkerBox(long remaining, Inventory inventory) {
for (ItemStack itemStack : inventory.getContents()) {
- if (Tag.SHULKER_BOXES.isTagged(itemStack.getType()) && itemStack.getItemMeta() instanceof BlockStateMeta) {
+ if (itemStack != null && Tag.SHULKER_BOXES.isTagged(itemStack.getType()) && itemStack.getItemMeta() instanceof BlockStateMeta) {
BlockStateMeta blockState = (BlockStateMeta) itemStack.getItemMeta();
if (blockState.getBlockState() instanceof ShulkerBox) {
ShulkerBox shulkerBox = (ShulkerBox) blockState.getBlockState();
diff --git a/src/main/java/org/gestern/gringotts/event/AccountListener.java b/src/main/java/org/gestern/gringotts/event/AccountListener.java
index 358bd26..d0f8069 100755
--- a/src/main/java/org/gestern/gringotts/event/AccountListener.java
+++ b/src/main/java/org/gestern/gringotts/event/AccountListener.java
@@ -1,6 +1,7 @@
package org.gestern.gringotts.event;
import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
import org.bukkit.block.Sign;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -19,7 +20,7 @@
*/
public class AccountListener implements Listener {
- private final Pattern vaultPattern = Pattern.compile(Configuration.CONF.vaultPattern, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
+ private final Pattern VAULT_PATTERN = Pattern.compile(Configuration.CONF.vaultPattern, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
/**
* Create an account chest by adding a sign marker over it.
@@ -28,13 +29,13 @@ public class AccountListener implements Listener {
*/
@EventHandler
public void onSignChange(SignChangeEvent event) {
- String line0String = event.getLine(0);
+ String line0String = ChatColor.stripColor(event.getLine(0)).trim();
if (line0String == null) {
return;
}
- Matcher match = vaultPattern.matcher(line0String);
+ Matcher match = VAULT_PATTERN.matcher(line0String);
// consider only signs with proper formatting
if (!match.matches()) {