mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-30 09:50:51 +01:00
Fix exceptions
This commit is contained in:
parent
ce2e3f3eb1
commit
cb8df7ce6e
@ -23,12 +23,12 @@ public class UnmuteCommand extends Command {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_unmute.not_found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
} else {
|
||||
if (!habbo.getHabboStats().allowTalk() || habbo.getHabboInfo().getCurrentRoom().isMuted(habbo)) {
|
||||
if (!habbo.getHabboStats().allowTalk() || (habbo.getHabboInfo().getCurrentRoom() != null && habbo.getHabboInfo().getCurrentRoom().isMuted(habbo))) {
|
||||
if (!habbo.getHabboStats().allowTalk()) {
|
||||
habbo.unMute();
|
||||
}
|
||||
|
||||
if (habbo.getHabboInfo().getCurrentRoom().isMuted(habbo)) {
|
||||
if (habbo.getHabboInfo().getCurrentRoom() != null && habbo.getHabboInfo().getCurrentRoom().isMuted(habbo)) {
|
||||
habbo.getHabboInfo().getCurrentRoom().muteHabbo(habbo, 1);
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,8 @@ public class GameTeam {
|
||||
|
||||
public void clearMembers() {
|
||||
for (GamePlayer player : this.members) {
|
||||
if (player == null || player.getHabbo() == null) continue;
|
||||
|
||||
player.getHabbo().getHabboInfo().getGamePlayer().reset();
|
||||
player.getHabbo().getHabboInfo().setCurrentGame(null);
|
||||
player.getHabbo().getHabboInfo().setGamePlayer(null);
|
||||
|
@ -14,6 +14,8 @@ public class FreezeGameTeam extends GameTeam {
|
||||
|
||||
@Override
|
||||
public void removeMember(GamePlayer gamePlayer) {
|
||||
if (gamePlayer.getHabbo() == null || gamePlayer.getHabbo().getHabboInfo().getCurrentRoom() == null) return;
|
||||
|
||||
Game game = gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().getGame(FreezeGame.class);
|
||||
Room room = gamePlayer.getHabbo().getRoomUnit().getRoom();
|
||||
|
||||
|
@ -43,6 +43,8 @@ public class CrackableReward {
|
||||
if (prize.contains(":") && prize.split(":").length == 2) {
|
||||
itemId = Integer.valueOf(prize.split(":")[0]);
|
||||
chance = Integer.valueOf(prize.split(":")[1]);
|
||||
} else if (prize.contains(":")) {
|
||||
Emulator.getLogging().logErrorLine("Invalid configuration of crackable prizes (item id: " + this.itemId + "). '" + prize + "' format should be itemId:chance.");
|
||||
} else {
|
||||
itemId = Integer.valueOf(prize.replace(":", ""));
|
||||
}
|
||||
|
@ -3413,11 +3413,14 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.layout == null) continue;
|
||||
|
||||
THashSet<RoomTile> tiles = this.layout.getTilesAt(
|
||||
this.layout.getTile(habboItem.getX(), habboItem.getY()),
|
||||
habboItem.getBaseItem().getWidth(),
|
||||
habboItem.getBaseItem().getLength(),
|
||||
habboItem.getRotation());
|
||||
habboItem.getRotation()
|
||||
);
|
||||
|
||||
for (RoomTile tile : tiles) {
|
||||
if (((tile.x == x) && (tile.y == y))) {
|
||||
@ -3682,6 +3685,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
|
||||
public void sendComposer(ServerMessage message) {
|
||||
for (Habbo habbo : this.getHabbos()) {
|
||||
if (habbo.getClient() == null) {
|
||||
this.removeHabbo(habbo, true);
|
||||
}
|
||||
|
||||
habbo.getClient().sendResponse(message);
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import gnu.trove.map.hash.THashMap;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@ -110,7 +111,9 @@ public class Habbo implements Runnable {
|
||||
|
||||
public void connect() {
|
||||
if (!Emulator.getConfig().getBoolean("networking.tcp.proxy") && this.client.getChannel().remoteAddress() != null) {
|
||||
this.habboInfo.setIpLogin(((InetSocketAddress) this.client.getChannel().remoteAddress()).getAddress().getHostAddress());
|
||||
SocketAddress address = this.client.getChannel().remoteAddress();
|
||||
|
||||
if (address != null) this.habboInfo.setIpLogin(((InetSocketAddress) address).getAddress().getHostAddress());
|
||||
}
|
||||
|
||||
this.habboInfo.setMachineID(this.client.getMachineId());
|
||||
@ -199,7 +202,8 @@ public class Habbo implements Runnable {
|
||||
return;
|
||||
|
||||
this.getHabboInfo().addCredits(event.credits);
|
||||
this.client.sendResponse(new UserCreditsComposer(this.client.getHabbo()));
|
||||
|
||||
if (this.client != null) this.client.sendResponse(new UserCreditsComposer(this.client.getHabbo()));
|
||||
}
|
||||
|
||||
|
||||
@ -213,7 +217,7 @@ public class Habbo implements Runnable {
|
||||
return;
|
||||
|
||||
this.getHabboInfo().addPixels(event.points);
|
||||
this.client.sendResponse(new UserCurrencyComposer(this.client.getHabbo()));
|
||||
if (this.client != null) this.client.sendResponse(new UserCurrencyComposer(this.client.getHabbo()));
|
||||
}
|
||||
|
||||
|
||||
@ -231,7 +235,7 @@ public class Habbo implements Runnable {
|
||||
return;
|
||||
|
||||
this.getHabboInfo().addCurrencyAmount(event.type, event.points);
|
||||
this.client.sendResponse(new UserPointsComposer(this.client.getHabbo().getHabboInfo().getCurrencyAmount(type), event.points, event.type));
|
||||
if (this.client != null) this.client.sendResponse(new UserPointsComposer(this.client.getHabbo().getHabboInfo().getCurrencyAmount(type), event.points, event.type));
|
||||
}
|
||||
|
||||
|
||||
|
@ -147,9 +147,11 @@ public class HabboInventory {
|
||||
}
|
||||
|
||||
public MarketPlaceOffer getOffer(int id) {
|
||||
for (MarketPlaceOffer offer : this.items) {
|
||||
if (offer.getOfferId() == id)
|
||||
return offer;
|
||||
synchronized (this.items) {
|
||||
for (MarketPlaceOffer offer : this.items) {
|
||||
if (offer.getOfferId() == id)
|
||||
return offer;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -55,7 +55,7 @@ public class RoomUnitOnRollerComposer extends MessageComposer {
|
||||
this.response.appendString(this.oldZ + "");
|
||||
this.response.appendString(this.newZ + "");
|
||||
|
||||
if (this.roller != null) {
|
||||
if (this.roller != null && room.getLayout() != null) {
|
||||
RoomTile rollerTile = room.getLayout().getTile(this.roller.getX(), this.roller.getY());
|
||||
|
||||
Emulator.getThreading().run(() -> {
|
||||
|
@ -37,6 +37,8 @@ class TeleportActionFive implements Runnable {
|
||||
|
||||
//if (!(this.currentTeleport instanceof InteractionTeleportTile))
|
||||
|
||||
if (this.room.getLayout() == null || this.currentTeleport == null) return;
|
||||
|
||||
RoomTile currentLocation = this.room.getLayout().getTile(this.currentTeleport.getX(), this.currentTeleport.getY());
|
||||
RoomTile tile = this.room.getLayout().getTileInFront(currentLocation, this.currentTeleport.getRotation());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user