mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-22 23:10:52 +01:00
Battle Banzai nullpointers and disconnect fix
This commit is contained in:
parent
1b82658bd3
commit
7cbc8cc162
@ -203,9 +203,10 @@ public class BattleBanzaiGame extends Game {
|
||||
item.setExtradata((6 + winningTeam.teamColor.type) + "");
|
||||
this.room.updateItemState(item);
|
||||
}
|
||||
|
||||
synchronized (this.lockedTiles) {
|
||||
Emulator.getThreading().run(new BattleBanzaiTilesFlicker(this.lockedTiles.get(winningTeam.teamColor), winningTeam.teamColor, this.room));
|
||||
}
|
||||
}
|
||||
|
||||
super.onEnd();
|
||||
}
|
||||
@ -222,8 +223,10 @@ public class BattleBanzaiGame extends Game {
|
||||
this.room.updateItem(tile);
|
||||
}
|
||||
}
|
||||
synchronized (this.lockedTiles) {
|
||||
this.lockedTiles.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private synchronized void resetMap() {
|
||||
@ -249,6 +252,7 @@ public class BattleBanzaiGame extends Game {
|
||||
}
|
||||
|
||||
public void tileLocked(GameTeamColors teamColor, HabboItem item, Habbo habbo, boolean doNotCheckFill) {
|
||||
synchronized (this.lockedTiles) {
|
||||
if (item instanceof InteractionBattleBanzaiTile) {
|
||||
if (!this.lockedTiles.containsKey(teamColor)) {
|
||||
this.lockedTiles.put(teamColor, new THashSet<>());
|
||||
@ -296,6 +300,7 @@ public class BattleBanzaiGame extends Game {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private List<RoomTile> floodFill(int x, int y, THashSet<HabboItem> lockedTiles, List<RoomTile> stack, GameTeamColors color) {
|
||||
if (this.isOutOfBounds(x, y) || this.isForeignLockedTile(x, y, color)) return null;
|
||||
|
@ -110,9 +110,15 @@ public class InteractionWiredHighscore extends HabboItem {
|
||||
serverMessage.appendInt(this.clearType.type);
|
||||
|
||||
if (this.data != null) {
|
||||
serverMessage.appendInt(this.data.size());
|
||||
int size = this.data.size();
|
||||
if(size > 50) {
|
||||
size = 50;
|
||||
}
|
||||
serverMessage.appendInt(size);
|
||||
|
||||
int count = 0;
|
||||
for (WiredHighscoreRow row : this.data) {
|
||||
if(count < 50) {
|
||||
serverMessage.appendInt(row.getValue());
|
||||
|
||||
serverMessage.appendInt(row.getUsers().size());
|
||||
@ -120,6 +126,8 @@ public class InteractionWiredHighscore extends HabboItem {
|
||||
serverMessage.appendString(username);
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
} else {
|
||||
serverMessage.appendInt(0);
|
||||
}
|
||||
|
@ -52,15 +52,19 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
|
||||
if (game == null)
|
||||
return false;
|
||||
|
||||
TObjectIntIterator<Map.Entry<Integer, Integer>> iterator = this.data.iterator();
|
||||
int gameStartTime = game.getStartTime();
|
||||
|
||||
for (int i = this.data.size(); i-- > 0; ) {
|
||||
TObjectIntMap<Map.Entry<Integer, Integer>> dataClone = new TObjectIntHashMap<>(this.data);
|
||||
|
||||
TObjectIntIterator<Map.Entry<Integer, Integer>> iterator = dataClone.iterator();
|
||||
|
||||
for (int i = dataClone.size(); i-- > 0; ) {
|
||||
iterator.advance();
|
||||
|
||||
Map.Entry<Integer, Integer> map = iterator.key();
|
||||
|
||||
if (map.getValue() == habbo.getHabboInfo().getId()) {
|
||||
if (map.getKey() == game.getStartTime()) {
|
||||
if (map.getKey() == gameStartTime) {
|
||||
if (iterator.value() < this.count) {
|
||||
iterator.setValue(iterator.value() + 1);
|
||||
|
||||
@ -74,7 +78,13 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
|
||||
}
|
||||
}
|
||||
|
||||
this.data.put(new AbstractMap.SimpleEntry<>(game.getStartTime(), habbo.getHabboInfo().getId()), 1);
|
||||
try {
|
||||
this.data.put(new AbstractMap.SimpleEntry<>(gameStartTime, habbo.getHabboInfo().getId()), 1);
|
||||
}
|
||||
catch(IllegalArgumentException e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (habbo.getHabboInfo().getGamePlayer() != null) {
|
||||
habbo.getHabboInfo().getGamePlayer().addScore(this.score, true);
|
||||
|
Loading…
Reference in New Issue
Block a user