diff --git a/pom.xml b/pom.xml
index 1a5e7c5d..5aa65b1f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.dre
BreweryX
- 3.2.0
+ 3.2.0-SNAPSHOT
BreweryX
diff --git a/src/com/dre/brewery/BSealer.java b/src/com/dre/brewery/BSealer.java
index 19f81087..ac168ab4 100644
--- a/src/com/dre/brewery/BSealer.java
+++ b/src/com/dre/brewery/BSealer.java
@@ -23,6 +23,7 @@
*/
public class BSealer implements InventoryHolder {
public static final NamespacedKey TAG_KEY = new NamespacedKey(BreweryPlugin.getInstance(), "SealingTable");
+ public static final NamespacedKey LEGACY_TAG_KEY = new NamespacedKey("brewery", "sealingtable");
public static boolean recipeRegistered = false;
public static boolean inventoryHolderWorking = true;
@@ -110,7 +111,7 @@ public static boolean isBSealer(Block block) {
if (smoker.getCustomName().equals("§e" + BreweryPlugin.getInstance().languageReader.get("Etc_SealingTable"))) {
return true;
} else {
- return smoker.getPersistentDataContainer().has(TAG_KEY, PersistentDataType.BYTE);
+ return smoker.getPersistentDataContainer().has(TAG_KEY, PersistentDataType.BYTE) || smoker.getPersistentDataContainer().has(LEGACY_TAG_KEY, PersistentDataType.BYTE);
}
}
}
@@ -159,7 +160,7 @@ public static void unregisterRecipe() {
Iterator recipeIterator = BreweryPlugin.getInstance().getServer().recipeIterator();
while (recipeIterator.hasNext()) {
Recipe next = recipeIterator.next();
- if (next instanceof ShapedRecipe && ((ShapedRecipe) next).getKey().equals(TAG_KEY)) {
+ if (next instanceof ShapedRecipe && (((ShapedRecipe) next).getKey().equals(TAG_KEY) || ((ShapedRecipe) next).getKey().equals(LEGACY_TAG_KEY))) {
recipeIterator.remove();
return;
}
diff --git a/src/com/dre/brewery/BreweryPlugin.java b/src/com/dre/brewery/BreweryPlugin.java
index 0fb02ae7..9738baa9 100644
--- a/src/com/dre/brewery/BreweryPlugin.java
+++ b/src/com/dre/brewery/BreweryPlugin.java
@@ -48,6 +48,7 @@
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin;
+import java.io.File;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Iterator;
@@ -80,6 +81,18 @@ public class BreweryPlugin extends JavaPlugin {
// Metrics
public Stats stats = new Stats();
+ @Override
+ public void onLoad() {
+ final String path = BreweryPlugin.class.getProtectionDomain().getCodeSource().getLocation().getPath();
+ final String jarDir = new File(path).getParentFile().getAbsolutePath();
+
+ final File breweryFolder = new File(jarDir + File.separator + "Brewery");
+ final File breweryXFolder = new File(jarDir + File.separator + "BreweryX");
+ if (breweryFolder.exists() && !breweryXFolder.exists()) {
+ breweryFolder.renameTo(breweryXFolder);
+ }
+ }
+
@Override
public void onEnable() {
breweryPlugin = this;
diff --git a/src/com/dre/brewery/MCBarrel.java b/src/com/dre/brewery/MCBarrel.java
index 3e4feb65..82226f62 100644
--- a/src/com/dre/brewery/MCBarrel.java
+++ b/src/com/dre/brewery/MCBarrel.java
@@ -11,6 +11,7 @@
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
+import javax.naming.Name;
import java.util.ArrayList;
import java.util.List;
@@ -41,7 +42,7 @@ public void open() {
if (inv.getViewers().size() == 1 && inv.getHolder() instanceof org.bukkit.block.Barrel) {
Barrel barrel = (Barrel) inv.getHolder();
PersistentDataContainer data = barrel.getPersistentDataContainer();
- NamespacedKey key = new NamespacedKey(BreweryPlugin.getInstance(), TAG);
+ NamespacedKey key = new NamespacedKey(BreweryPlugin.getInstance(), TAG); // TODO: Legacy key this too?
if (!data.has(key, PersistentDataType.LONG)) return;
// Get the difference between the time that is stored on the Barrel and the current stored global mcBarrelTime
diff --git a/src/com/dre/brewery/lore/NBTLoadStream.java b/src/com/dre/brewery/lore/NBTLoadStream.java
index 81c4d0d2..0628eab3 100644
--- a/src/com/dre/brewery/lore/NBTLoadStream.java
+++ b/src/com/dre/brewery/lore/NBTLoadStream.java
@@ -10,6 +10,7 @@
public class NBTLoadStream extends ByteArrayInputStream {
private static final String TAG = "brewdata";
private static final NamespacedKey KEY = new NamespacedKey(BreweryPlugin.getInstance(), TAG);
+ private static final NamespacedKey LEGACY_KEY = new NamespacedKey("brewery", TAG);
public NBTLoadStream(ItemMeta meta) {
super(getNBTBytes(meta));
@@ -17,6 +18,9 @@ public NBTLoadStream(ItemMeta meta) {
private static byte[] getNBTBytes(ItemMeta meta) {
byte[] bytes = LegacyUtil.readBytesItem(meta, KEY);
+ if (bytes == null) {
+ bytes = LegacyUtil.readBytesItem(meta, LEGACY_KEY);
+ }
if (bytes == null) {
return new byte[0];
}
@@ -28,6 +32,6 @@ public boolean hasData() {
}
public static boolean hasDataInMeta(ItemMeta meta) {
- return LegacyUtil.hasBytesItem(meta, KEY);
+ return LegacyUtil.hasBytesItem(meta, KEY) || LegacyUtil.hasBytesItem(meta, LEGACY_KEY);
}
}
diff --git a/src/com/dre/brewery/recipe/BRecipe.java b/src/com/dre/brewery/recipe/BRecipe.java
index b6b4aa8d..3fa413ed 100644
--- a/src/com/dre/brewery/recipe/BRecipe.java
+++ b/src/com/dre/brewery/recipe/BRecipe.java
@@ -252,7 +252,7 @@ public static List loadIngredients(ConfigurationSection cfg, String
}
}
- Material mat = Material.matchMaterial(matParts[0]);
+ Material mat = BUtil.getMaterialSafely(matParts[0]);
short durability = -1;
if (matParts.length == 2) {
durability = (short) BreweryPlugin.getInstance().parseInt(matParts[1]);
diff --git a/src/com/dre/brewery/recipe/RecipeItem.java b/src/com/dre/brewery/recipe/RecipeItem.java
index 9e23ef0d..a4259790 100644
--- a/src/com/dre/brewery/recipe/RecipeItem.java
+++ b/src/com/dre/brewery/recipe/RecipeItem.java
@@ -262,7 +262,7 @@ protected static List loadMaterials(List ingredientsList) {
BreweryPlugin.getInstance().errorLog("Item Amount can not be specified for Custom Items: " + item);
return null;
}
- Material mat = Material.matchMaterial(ingredParts[0]);
+ Material mat = BUtil.getMaterialSafely(ingredParts[0]);
if (mat == null && !BreweryPlugin.use1_14 && ingredParts[0].equalsIgnoreCase("cornflower")) {
// Using this in default custom-items, but will error on < 1.14
diff --git a/src/com/dre/brewery/utility/BUtil.java b/src/com/dre/brewery/utility/BUtil.java
index 0163977e..d5f9fac8 100644
--- a/src/com/dre/brewery/utility/BUtil.java
+++ b/src/com/dre/brewery/utility/BUtil.java
@@ -137,7 +137,7 @@ public static String playerString(OfflinePlayer player) {
public static Material getMaterialSafely(String name) {
- if (name.equals("GRASS")) {
+ if (name.equalsIgnoreCase("GRASS")) {
return Material.GRASS;
}
return Material.matchMaterial(name);