Arcturus-Community/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTradeUser.java

98 lines
1.7 KiB
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.habbohotel.rooms;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import gnu.trove.set.hash.THashSet;
public class RoomTradeUser
{
2018-10-07 00:28:00 +02:00
private int userId;
2018-07-06 15:30:00 +02:00
private final Habbo habbo;
private boolean accepted;
private boolean confirmed;
private final THashSet<HabboItem> items;
public RoomTradeUser(Habbo habbo)
{
this.habbo = habbo;
2018-10-07 00:28:00 +02:00
if (this.habbo != null)
{
this.userId = this.habbo.getHabboInfo().getId();
}
2018-07-06 15:30:00 +02:00
this.accepted = false;
this.confirmed = false;
2018-09-28 21:25:00 +02:00
this.items = new THashSet<>();
2018-07-06 15:30:00 +02:00
}
2018-10-07 00:28:00 +02:00
public int getUserId()
{
return this.userId;
}
public void setUserId(int userId)
{
this.userId = userId;
}
2018-07-06 15:30:00 +02:00
public Habbo getHabbo()
{
return this.habbo;
}
public boolean getAccepted()
{
return this.accepted;
}
public boolean getConfirmed()
{
return this.confirmed;
}
public void setAccepted(boolean value)
{
this.accepted = value;
}
public void confirm()
{
this.confirmed = true;
}
public void addItem(HabboItem item)
{
this.items.add(item);
}
2018-10-07 00:28:00 +02:00
public HabboItem getItem(int itemId)
{
for (HabboItem item : this.items)
{
if (item.getId() == itemId)
{
return item;
}
}
return null;
}
2018-07-06 15:30:00 +02:00
public THashSet<HabboItem> getItems()
{
return this.items;
}
2018-10-07 00:28:00 +02:00
public void putItemsIntoInventory()
{
this.habbo.getInventory().getItemsComponent().addItems(this.items);
}
2018-07-06 15:30:00 +02:00
public void clearItems()
{
this.items.clear();
}
}