Mortar Tuner can now be cleared from linked location

master
Soper Aylamo 2021-05-26 03:14:09 -04:00
parent 4c1725a7d2
commit 65590642ba
Signed by: Soper
GPG Key ID: A27AC885ACC3BEAE
2 changed files with 11 additions and 3 deletions

View File

@ -41,9 +41,14 @@ public class MortarTuner {
if(!isTuner(tuner)){
throw new IllegalArgumentException("Tried to update an non-tuner item with tuner data");
}
List<String> lore = tuner.getItemMeta().getLore();
lore.set(0, ChatColor.GOLD + "Linked to Mortar at " + location.getBlockX() + ", " + location.getBlockY() + ", " + location.getBlockZ());
tuner.getItemMeta().setLore(lore);
ItemMeta meta = tuner.getItemMeta();
List<String> lore = meta.getLore();
if(location == null){
lore.set(0, ChatColor.GOLD + "Currently unlinked");
}
else lore.set(0, ChatColor.GOLD + "Linked to Mortar at " + location.getBlockX() + ", " + location.getBlockY() + ", " + location.getBlockZ());
meta.setLore(lore);
tuner.setItemMeta(meta);
}
// public static void updateTunerStatus(ItemStack tuner, boolean reset){

View File

@ -54,6 +54,9 @@ public class MortarHandler {
if(Mortar.isMortar(mortar) && MortarTuner.isTuner(tuner)){
MortarTuner.updateTunerLocation(tuner, mortar.getLocation());
}
else if(MortarTuner.isTuner(tuner) && mortar == null){
MortarTuner.updateTunerLocation(tuner, null);
}
}
// /**