From 599cd615d118dc205d3433435a27ba3f394a6201 Mon Sep 17 00:00:00 2001 From: Rodolfo-XDR Date: Thu, 2 Jul 2020 16:01:05 -0500 Subject: [PATCH] Wired Game Fix --- .../java/com/eu/habbo/habbohotel/games/Game.java | 14 ++++++++++---- .../com/eu/habbo/habbohotel/games/GameTeam.java | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/games/Game.java b/src/main/java/com/eu/habbo/habbohotel/games/Game.java index f8aa6c37..16783eb7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/Game.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/Game.java @@ -122,6 +122,10 @@ public abstract class Game implements Runnable { for (HabboItem item : this.room.getRoomSpecialTypes().getItemsOfType(WiredBlob.class)) { ((WiredBlob) item).onGameStart(this.room); } + + for (GameTeam team : this.teams.values()) { + team.resetScores(); + } } public void onEnd() { @@ -137,9 +141,11 @@ public abstract class Game implements Runnable { } GameTeam winningTeam = null; - for (GameTeam team : this.teams.values()) { - if (winningTeam == null || team.getTotalScore() > winningTeam.getTotalScore()) { - winningTeam = team; + if(totalPointsGained > 0) { + for (GameTeam team : this.teams.values()) { + if (winningTeam == null || team.getTotalScore() > winningTeam.getTotalScore()) { + winningTeam = team; + } } } @@ -166,7 +172,7 @@ public abstract class Game implements Runnable { WiredHandler.handleCustomTrigger(WiredTriggerTeamLoses.class, player.getHabbo().getRoomUnit(), this.room, new Object[]{this}); } - if (team.getMembers().size() > 0) { + if (team.getMembers().size() > 0 && team.getTotalScore() > 0) { for (HabboItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionWiredHighscore.class)) { Emulator.getGameEnvironment().getItemManager().getHighscoreManager().addHighscoreData(new WiredHighscoreDataEntry(item.getId(), team.getMembers().stream().map(m -> m.getHabbo().getHabboInfo().getId()).collect(Collectors.toList()), team.getTotalScore(), false, Emulator.getIntUnixTimestamp())); } diff --git a/src/main/java/com/eu/habbo/habbohotel/games/GameTeam.java b/src/main/java/com/eu/habbo/habbohotel/games/GameTeam.java index aad945b1..143974dd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/GameTeam.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/GameTeam.java @@ -86,6 +86,8 @@ public class GameTeam { player.reset(); } + + this.teamScore = 0; }