diff --git a/pom.xml b/pom.xml
index 9a2fa77c..490265bb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,6 +10,7 @@
UTF-8
+ true
@@ -39,6 +40,7 @@
1.8
1.8
+ ${skipTests}
diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/ArmorStandEditorPlugin.java b/src/main/java/io/github/rypofalem/armorstandeditor/ArmorStandEditorPlugin.java
index c7ee9efc..9eddafeb 100644
--- a/src/main/java/io/github/rypofalem/armorstandeditor/ArmorStandEditorPlugin.java
+++ b/src/main/java/io/github/rypofalem/armorstandeditor/ArmorStandEditorPlugin.java
@@ -25,6 +25,7 @@
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
+import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
@@ -34,16 +35,19 @@
public class ArmorStandEditorPlugin extends JavaPlugin{
private NamespacedKey iconKey;
private static ArmorStandEditorPlugin instance;
+ public final PersistentDataType editToolKeyType = PersistentDataType.BYTE;
+ public final NamespacedKey editToolKey = new NamespacedKey(this, "ASE");
private CommandEx execute;
private Language lang;
public boolean hasSpigot;
public PlayerEditorManager editorManager;
public Material editTool = Material.FLINT;
- boolean requireToolData = false;
- boolean sendToActionBar = true;
- int editToolData = Integer.MIN_VALUE;
- boolean requireToolLore = false;
- String editToolLore = null;
+ public boolean requireToolData = false;
+ public boolean sendToActionBar = true;
+ public int editToolData = Integer.MIN_VALUE;
+ public boolean requireToolLore = false;
+ public String editToolLore = null;
+ public boolean requireToolKey = false; // Not configurable through config, since it's up to plugin to hook into
boolean debug = false; //weather or not to broadcast messages via print(String message)
double coarseRot;
double fineRot;
@@ -76,7 +80,7 @@ public void onEnable(){
if(requireToolData) editToolData = getConfig().getInt("toolData", Integer.MIN_VALUE);
requireToolLore = getConfig().getBoolean("requireToolLore", false);
if(requireToolLore) editToolLore= getConfig().getString("toolLore", null);
- debug = getConfig().getBoolean("debug", true);
+ debug = getConfig().getBoolean("debug", false);
sendToActionBar = getConfig().getBoolean("sendMessagesToActionBar", true);
editorManager = new PlayerEditorManager(this);
@@ -145,6 +149,10 @@ public boolean isEditTool(ItemStack item){
if(item.getItemMeta().getLore().isEmpty()) return false;
if(!item.getItemMeta().getLore().get(0).equals(editToolLore)) return false;
}
+ if(requireToolKey) {
+ if(!item.hasItemMeta()) return false;
+ if(item.getItemMeta().getPersistentDataContainer().get(editToolKey, editToolKeyType) == null) return false;
+ }
return true;
}
@@ -155,4 +163,4 @@ public NamespacedKey getIconKey() {
}
//todo:
//Access to "DisabledSlots" data (probably simplified just a toggle enable/disable)
-//Access to the "Marker" switch (so you can make the hitbox super small)
\ No newline at end of file
+//Access to the "Marker" switch (so you can make the hitbox super small)
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 56a6f773..2a9c3579 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -22,4 +22,4 @@ lang: en_US.yml
sendMessagesToActionBar: true
#Don't set to true unless you want players to see random messages or other undesirable behavior
-debug: false
\ No newline at end of file
+debug: false