diff --git a/plugin/src/main/java/com/lishid/openinv/internal/OpenInventoryView.java b/plugin/src/main/java/com/lishid/openinv/internal/OpenInventoryView.java index ea7c438e..c5743a77 100644 --- a/plugin/src/main/java/com/lishid/openinv/internal/OpenInventoryView.java +++ b/plugin/src/main/java/com/lishid/openinv/internal/OpenInventoryView.java @@ -18,7 +18,6 @@ import com.lishid.openinv.OpenInv; import com.lishid.openinv.util.lang.Replacement; -import java.util.Objects; import org.bukkit.entity.HumanEntity; import org.bukkit.entity.Player; import org.bukkit.event.inventory.InventoryType; @@ -26,6 +25,8 @@ import org.bukkit.inventory.InventoryView; import org.jetbrains.annotations.NotNull; +import java.util.Objects; + public class OpenInventoryView extends InventoryView { private final @NotNull Player player; @@ -68,17 +69,28 @@ public OpenInventoryView( @Override public @NotNull String getTitle() { if (title == null) { - HumanEntity owner = inventory.getPlayer(); - - String localTitle = OpenInv.getPlugin(OpenInv.class) - .getLocalizedMessage( - player, - titleKey, - new Replacement("%player%", owner.getName())); - title = Objects.requireNonNullElseGet(localTitle, () -> owner.getName() + titleDefaultSuffix); + title = getOriginalTitle(); } return title; } + @NotNull + @Override + public String getOriginalTitle() { + HumanEntity owner = inventory.getPlayer(); + + String localTitle = OpenInv.getPlugin(OpenInv.class) + .getLocalizedMessage( + player, + titleKey, + new Replacement("%player%", owner.getName())); + return Objects.requireNonNullElseGet(localTitle, () -> owner.getName() + titleDefaultSuffix); + } + + @Override + public void setTitle(@NotNull String title) { + this.title = title; + } + }