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)){ if(!isTuner(tuner)){
throw new IllegalArgumentException("Tried to update an non-tuner item with tuner data"); throw new IllegalArgumentException("Tried to update an non-tuner item with tuner data");
} }
List<String> lore = tuner.getItemMeta().getLore(); ItemMeta meta = tuner.getItemMeta();
lore.set(0, ChatColor.GOLD + "Linked to Mortar at " + location.getBlockX() + ", " + location.getBlockY() + ", " + location.getBlockZ()); List<String> lore = meta.getLore();
tuner.getItemMeta().setLore(lore); 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){ // public static void updateTunerStatus(ItemStack tuner, boolean reset){

View File

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