mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
7c807939fe
1
sqlupdates/2_2_0-RC-1_TO_2_2_0-RC-2.sql
Normal file
1
sqlupdates/2_2_0-RC-1_TO_2_2_0-RC-2.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
INSERT INTO `emulator_texts`(`key`, `value`) VALUES ('commands.error.cmd_badge.unknown_user', 'Failed to find the given user.');
|
@ -4,6 +4,8 @@ import com.eu.habbo.Emulator;
|
|||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboInfo;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboManager;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -38,11 +40,18 @@ public class BadgeCommand extends Command {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
HabboInfo habboInfo = HabboManager.getOfflineHabboInfo(params[1]);
|
||||||
|
|
||||||
|
if (habboInfo == null) {
|
||||||
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_badge.unknown_user"), RoomChatMessageBubbles.ALERT);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
|
||||||
boolean found;
|
boolean found;
|
||||||
|
|
||||||
try (PreparedStatement statement = connection.prepareStatement("SELECT `badge_code` FROM `users_badges` INNER JOIN `users` ON `users`.`id` = `user_id` WHERE `users`.`username` = ? AND `badge_code` = ? LIMIT 1")) {
|
try (PreparedStatement statement = connection.prepareStatement("SELECT `badge_code` FROM `users_badges` WHERE `user_id` = ? AND `badge_code` = ? LIMIT 1")) {
|
||||||
statement.setString(1, params[1]);
|
statement.setInt(1, habboInfo.getId());
|
||||||
statement.setString(2, params[2]);
|
statement.setString(2, params[2]);
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
found = set.next();
|
found = set.next();
|
||||||
@ -53,8 +62,8 @@ public class BadgeCommand extends Command {
|
|||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_badge.already_owns").replace("%user%", params[1]).replace("%badge%", params[2]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_badge.already_owns").replace("%user%", params[1]).replace("%badge%", params[2]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO users_badges (`id`, `user_id`, `slot_id`, `badge_code`) VALUES (null, (SELECT `id` FROM `users` WHERE `username` = ? LIMIT 1), 0, ?)")) {
|
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO users_badges (`id`, `user_id`, `slot_id`, `badge_code`) VALUES (null, ?, 0, ?)")) {
|
||||||
statement.setString(1, params[1]);
|
statement.setInt(1, habboInfo.getId());
|
||||||
statement.setString(2, params[2]);
|
statement.setString(2, params[2]);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,14 @@ public class GameTeam {
|
|||||||
this.members.clear();
|
this.members.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetScores() {
|
||||||
|
for (GamePlayer player : this.members) {
|
||||||
|
if (player == null) continue;
|
||||||
|
|
||||||
|
player.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public THashSet<GamePlayer> getMembers() {
|
public THashSet<GamePlayer> getMembers() {
|
||||||
return this.members;
|
return this.members;
|
||||||
|
@ -14,7 +14,7 @@ public class FreezeGameTeam extends GameTeam {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeMember(GamePlayer gamePlayer) {
|
public void removeMember(GamePlayer gamePlayer) {
|
||||||
if (gamePlayer.getHabbo() == null || gamePlayer.getHabbo().getHabboInfo().getCurrentRoom() == null) return;
|
if (gamePlayer == null || gamePlayer.getHabbo() == null || gamePlayer.getHabbo().getHabboInfo().getCurrentRoom() == null) return;
|
||||||
|
|
||||||
Game game = gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().getGame(FreezeGame.class);
|
Game game = gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().getGame(FreezeGame.class);
|
||||||
Room room = gamePlayer.getHabbo().getRoomUnit().getRoom();
|
Room room = gamePlayer.getHabbo().getRoomUnit().getRoom();
|
||||||
|
@ -15,6 +15,10 @@ public class WiredGame extends Game {
|
|||||||
@Override
|
@Override
|
||||||
public void initialise() {
|
public void initialise() {
|
||||||
this.state = GameState.RUNNING;
|
this.state = GameState.RUNNING;
|
||||||
|
|
||||||
|
for (GameTeam team : this.teams.values()) {
|
||||||
|
team.resetScores();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -4160,6 +4160,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void unIdle(Habbo habbo) {
|
public void unIdle(Habbo habbo) {
|
||||||
|
if (habbo == null || habbo.getRoomUnit() == null) return;
|
||||||
habbo.getRoomUnit().resetIdleTimer();
|
habbo.getRoomUnit().resetIdleTimer();
|
||||||
this.sendComposer(new RoomUnitIdleComposer(habbo.getRoomUnit()).compose());
|
this.sendComposer(new RoomUnitIdleComposer(habbo.getRoomUnit()).compose());
|
||||||
WiredHandler.handle(WiredTriggerType.UNIDLES, habbo.getRoomUnit(), this, new Object[]{habbo});
|
WiredHandler.handle(WiredTriggerType.UNIDLES, habbo.getRoomUnit(), this, new Object[]{habbo});
|
||||||
|
@ -22,19 +22,20 @@ public class GuildRemoveAdminEvent extends MessageHandler {
|
|||||||
int userId = this.packet.readInt();
|
int userId = this.packet.readInt();
|
||||||
|
|
||||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(guild.getRoomId());
|
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(guild.getRoomId());
|
||||||
Emulator.getGameEnvironment().getGuildManager().removeAdmin(guild, userId);
|
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
||||||
|
|
||||||
Habbo habbo = room.getHabbo(userId);
|
|
||||||
GuildRemovedAdminEvent removedAdminEvent = new GuildRemovedAdminEvent(guild, userId, habbo);
|
GuildRemovedAdminEvent removedAdminEvent = new GuildRemovedAdminEvent(guild, userId, habbo);
|
||||||
Emulator.getPluginManager().fireEvent(removedAdminEvent);
|
Emulator.getPluginManager().fireEvent(removedAdminEvent);
|
||||||
|
|
||||||
if (removedAdminEvent.isCancelled())
|
if (removedAdminEvent.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Emulator.getGameEnvironment().getGuildManager().removeAdmin(guild, userId);
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
habbo.getClient().sendResponse(new GuildInfoComposer(guild, this.client, false, Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild.getId(), userId)));
|
habbo.getClient().sendResponse(new GuildInfoComposer(guild, this.client, false, Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild.getId(), userId)));
|
||||||
|
|
||||||
room.refreshRightsForHabbo(habbo);
|
if (room != null && habbo.getHabboInfo().getCurrentRoom() != null && habbo.getHabboInfo().getCurrentRoom() == room) room.refreshRightsForHabbo(habbo);
|
||||||
}
|
}
|
||||||
GuildMember guildMember = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, userId);
|
GuildMember guildMember = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, userId);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user