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

81 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;
2019-05-26 20:14:53 +02:00
public class RoomTradeUser {
2018-07-06 15:30:00 +02:00
private final Habbo habbo;
2019-05-26 20:14:53 +02:00
private final THashSet<HabboItem> items;
private int userId;
2018-07-06 15:30:00 +02:00
private boolean accepted;
private boolean confirmed;
2019-05-26 20:14:53 +02:00
public RoomTradeUser(Habbo habbo) {
2018-07-06 15:30:00 +02:00
this.habbo = habbo;
2018-10-07 00:28:00 +02:00
2019-05-26 20:14:53 +02:00
if (this.habbo != null) {
2018-10-07 00:28:00 +02:00
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
}
2019-05-26 20:14:53 +02:00
public int getUserId() {
2018-10-07 00:28:00 +02:00
return this.userId;
}
2019-05-26 20:14:53 +02:00
public void setUserId(int userId) {
2018-10-07 00:28:00 +02:00
this.userId = userId;
}
2019-05-26 20:14:53 +02:00
public Habbo getHabbo() {
2018-07-06 15:30:00 +02:00
return this.habbo;
}
2019-05-26 20:14:53 +02:00
public boolean getAccepted() {
2018-07-06 15:30:00 +02:00
return this.accepted;
}
2019-05-26 20:14:53 +02:00
public void setAccepted(boolean value) {
this.accepted = value;
2018-07-06 15:30:00 +02:00
}
2019-05-26 20:14:53 +02:00
public boolean getConfirmed() {
return this.confirmed;
2018-07-06 15:30:00 +02:00
}
2019-05-26 20:14:53 +02:00
public void confirm() {
2018-07-06 15:30:00 +02:00
this.confirmed = true;
}
2019-05-26 20:14:53 +02:00
public void addItem(HabboItem item) {
2018-07-06 15:30:00 +02:00
this.items.add(item);
}
2019-05-26 20:14:53 +02:00
public HabboItem getItem(int itemId) {
for (HabboItem item : this.items) {
if (item.getId() == itemId) {
2018-10-07 00:28:00 +02:00
return item;
}
}
return null;
}
2019-05-26 20:14:53 +02:00
public THashSet<HabboItem> getItems() {
2018-07-06 15:30:00 +02:00
return this.items;
}
2019-05-26 20:14:53 +02:00
public void putItemsIntoInventory() {
2018-10-07 00:28:00 +02:00
this.habbo.getInventory().getItemsComponent().addItems(this.items);
}
2019-05-26 20:14:53 +02:00
public void clearItems() {
2018-07-06 15:30:00 +02:00
this.items.clear();
}
}