Fixed Bot Deploy

This commit is contained in:
Rodolfo-XDR 2020-10-08 11:55:07 -05:00
parent ae5589d068
commit ebc51eefe8

View File

@ -12,6 +12,7 @@ import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
import com.eu.habbo.messages.outgoing.inventory.AddBotComposer; import com.eu.habbo.messages.outgoing.inventory.AddBotComposer;
import com.eu.habbo.messages.outgoing.inventory.RemoveBotComposer; import com.eu.habbo.messages.outgoing.inventory.RemoveBotComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUsersComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUsersComposer;
import com.eu.habbo.plugin.events.bots.BotPickUpEvent; import com.eu.habbo.plugin.events.bots.BotPickUpEvent;
import com.eu.habbo.plugin.events.bots.BotPlacedEvent; import com.eu.habbo.plugin.events.bots.BotPlacedEvent;
@ -48,14 +49,9 @@ public class BotManager {
} }
public static void addBotDefinition(String type, Class<? extends Bot> botClazz) throws Exception { public static void addBotDefinition(String type, Class<? extends Bot> botClazz) throws Exception {
if (botClazz.getDeclaredConstructor(ResultSet.class) == null) {
throw new Exception("Missing Bot(ResultSet) constructor!");
} else {
botClazz.getDeclaredConstructor(ResultSet.class).setAccessible(true); botClazz.getDeclaredConstructor(ResultSet.class).setAccessible(true);
botDefenitions.put(type, botClazz); botDefenitions.put(type, botClazz);
} }
}
public boolean reload() { public boolean reload() {
for (Map.Entry<String, Class<? extends Bot>> set : botDefenitions.entrySet()) { for (Map.Entry<String, Class<? extends Bot>> set : botDefenitions.entrySet()) {
@ -144,6 +140,7 @@ public class BotManager {
room.addBot(bot); room.addBot(bot);
Emulator.getThreading().run(bot); Emulator.getThreading().run(bot);
room.sendComposer(new RoomUsersComposer(bot).compose()); room.sendComposer(new RoomUsersComposer(bot).compose());
room.sendComposer(new RoomUserStatusComposer(bot.getRoomUnit()).compose());
habbo.getInventory().getBotsComponent().removeBot(bot); habbo.getInventory().getBotsComponent().removeBot(bot);
habbo.getClient().sendResponse(new RemoveBotComposer(bot)); habbo.getClient().sendResponse(new RemoveBotComposer(bot));
bot.onPlace(habbo, room); bot.onPlace(habbo, room);