2018-07-06 15:30:00 +02:00
|
|
|
package com.eu.habbo.habbohotel.items.interactions;
|
|
|
|
|
|
|
|
import com.eu.habbo.Emulator;
|
|
|
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
|
|
|
import com.eu.habbo.habbohotel.items.Item;
|
|
|
|
import com.eu.habbo.habbohotel.rooms.Room;
|
|
|
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
|
|
|
import com.eu.habbo.habbohotel.users.Habbo;
|
|
|
|
import com.eu.habbo.messages.outgoing.generic.alerts.CustomNotificationComposer;
|
|
|
|
import com.eu.habbo.threading.runnables.CloseGate;
|
|
|
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
|
|
|
public class InteractionHabboClubGate extends InteractionGate
|
|
|
|
{
|
|
|
|
public InteractionHabboClubGate(ResultSet set, Item baseItem) throws SQLException
|
|
|
|
{
|
|
|
|
super(set, baseItem);
|
2019-05-24 12:51:41 +02:00
|
|
|
this.setExtradata("0");
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public InteractionHabboClubGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
|
|
|
|
{
|
|
|
|
super(id, userId, item, extradata, limitedStack, limitedSells);
|
2019-05-24 12:51:41 +02:00
|
|
|
this.setExtradata("0");
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects)
|
|
|
|
{
|
|
|
|
Habbo habbo = room.getHabbo(roomUnit);
|
|
|
|
|
|
|
|
if(habbo != null)
|
|
|
|
{
|
|
|
|
return habbo.getHabboStats().hasActiveClub();
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isWalkable()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
|
|
|
|
{
|
|
|
|
super.onWalkOn(roomUnit, room, objects);
|
|
|
|
|
|
|
|
if(this.canWalkOn(roomUnit, room, objects))
|
|
|
|
{
|
|
|
|
this.setExtradata("1");
|
|
|
|
room.updateItemState(this);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Habbo habbo = room.getHabbo(roomUnit);
|
|
|
|
|
|
|
|
if(habbo != null)
|
|
|
|
{
|
|
|
|
habbo.getClient().sendResponse(new CustomNotificationComposer(CustomNotificationComposer.GATE_NO_HC));
|
|
|
|
}
|
|
|
|
|
|
|
|
roomUnit.setGoalLocation(roomUnit.getCurrentLocation());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(GameClient client, Room room, Object[] objects) throws Exception
|
|
|
|
{
|
2019-03-18 02:22:00 +01:00
|
|
|
if (client != null)
|
2018-07-06 15:30:00 +02:00
|
|
|
{
|
2019-03-18 02:22:00 +01:00
|
|
|
if (this.canWalkOn(client.getHabbo().getRoomUnit(), room, null))
|
|
|
|
{
|
|
|
|
super.onClick(client, room, objects);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
client.sendResponse(new CustomNotificationComposer(CustomNotificationComposer.GATE_NO_HC));
|
|
|
|
}
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
|
|
|
|
{
|
|
|
|
super.onWalkOff(roomUnit, room, objects);
|
|
|
|
|
|
|
|
Emulator.getThreading().run(new CloseGate(this, room), 500);
|
|
|
|
}
|
|
|
|
}
|