From 0e1578456fd9ec823954524dc504ef5112a5fdf3 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Sun, 9 Jun 2024 10:03:53 -0700 Subject: [PATCH] Add hasOwner method to item super class --- src/games/stendhal/server/entity/item/Item.java | 10 ++++++++++ src/games/stendhal/server/entity/item/OwnedItem.java | 8 ++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/games/stendhal/server/entity/item/Item.java b/src/games/stendhal/server/entity/item/Item.java index f262176b37b..dd5b6c28de1 100644 --- a/src/games/stendhal/server/entity/item/Item.java +++ b/src/games/stendhal/server/entity/item/Item.java @@ -561,6 +561,16 @@ public void autobind(String player) { } } + /** + * Checks if an item is marked as "owned" by a specific player. + * + * @return + * Always {@code false} in this implementation. + */ + public boolean hasOwner() { + return false; + } + /** * Get the item's itemData. The itemData contains context specific * information that is used by the implementation. diff --git a/src/games/stendhal/server/entity/item/OwnedItem.java b/src/games/stendhal/server/entity/item/OwnedItem.java index 5a843a5f46d..a99b86fea1b 100644 --- a/src/games/stendhal/server/entity/item/OwnedItem.java +++ b/src/games/stendhal/server/entity/item/OwnedItem.java @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright © 2020 - Arianne * + * Copyright © 2020-2024 - Faiumoni e. V. * *************************************************************************** *************************************************************************** * * @@ -21,6 +21,9 @@ /** * Class representing an item owned by an entity. + * + * An "owned" item is different than a bound item in that it can be used by players other than the + * owner but they do not get the same or full benefit of. */ public abstract class OwnedItem extends Item { @@ -82,8 +85,9 @@ public boolean onUsed(final RPEntity user) { * Override to check if item has owner. * * @return - * true if owned. + * {@ true} if owned. */ + @Override public boolean hasOwner() { return getOwner() != null; }