1package com.osroyale.game.world.items.ground;
3import com.osroyale.game.event.impl.PickupItemEvent;
4import com.osroyale.game.event.impl.log.DropItemLogEvent;
5import com.osroyale.game.plugin.PluginManager;
6import com.osroyale.game.world.World;
7import com.osroyale.game.world.entity.Entity;
8import com.osroyale.game.world.entity.EntityType;
9import com.osroyale.game.world.entity.mob.player.Player;
10import com.osroyale.game.world.entity.mob.player.PlayerRight;
11import com.osroyale.game.world.items.Item;
12import com.osroyale.game.world.position.Position;
13import com.osroyale.game.world.region.Region;
14import com.osroyale.net.packet.out.SendGroundItem;
15import com.osroyale.net.packet.out.SendMessage;
16import com.osroyale.net.packet.out.SendRemoveGroundItem;
18import java.util.Objects;
65public final class GroundItem
extends Entity {
79 public boolean canIronMenPickThisItemUp =
true;
85 groundItem.instance =
player.instance;
92 GroundItem groundItem =
new GroundItem(
player,
item, position);
94 groundItem.instance =
player.instance;
102 groundItem.instance =
player.instance;
110 GroundItem groundItem =
new GroundItem(
player,
item, position);
112 groundItem.instance =
player.instance;
122 this.instance =
player.instance;
125 public boolean canSee(
Player other) {
126 if (
item.isTradeable() &&
policy.equals(GroundItemPolicy.GLOBAL) && instance == other.instance) {
129 return player.usernameLong == other.usernameLong;
134 GroundItem result = position.getRegion().getGroundItem(
item.getId(), position);
136 if (result ==
null) {
157 if (isRegistered()) {
167 if (!isRegistered()) {
171 setRegistered(
false);
177 if (
item.getId() == 11283) {
179 player.dragonfireCharges = 0;
183 GroundItem groundItem = region.getGroundItem(
item.getId(),
getPosition());
184 if (groundItem !=
null && groundItem.
item.isStackable()
187 item.incrementAmountBy(groundItem.
item.getAmount());
190 for (
Region reg : regions) {
205 for (
Region reg : regions) {
217 return item.getName();
226 public boolean equals(Object obj) {
227 if (obj ==
this)
return true;
232 && player.usernameLong == other.
player.usernameLong;
238 public int hashCode() {
243 public String toString() {
244 return "GroundItem[owner=" +
player.getUsername() +
", position=" +
getPosition() +
", index=" + getIndex() +
", item=" +
item.getName() +
"]";
void publish(Event event)
synchronized final void cancel()
static void schedule(Task task)
static void pickup(Player player, Item item, Position position)
final GroundItemEvent event
static GroundItem create(Player player, Item item, Position position)
void addToRegion(Region region)
void removeFromRegion(Region region)
static void createGlobal(Player player, Item item)
static void createGlobal(Player player, Item item, Position position)
static GroundItem create(Player player, Item item)
void addGroundItem(GroundItem item)
void removeGroundItem(GroundItem item)
Region[] getSurroundingRegions(Position position)
static boolean isIronman(Player player)