From acef46e0042e53b3ef2a8e1c407048933af8e3aa Mon Sep 17 00:00:00 2001 From: Beny Date: Sat, 31 Oct 2020 13:32:56 +0100 Subject: [PATCH] WiredEffectGiveScoreToTeam now executes without a player --- .../effects/WiredEffectGiveScoreToTeam.java | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java index 74387b2a..8761d7d9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java @@ -3,13 +3,13 @@ package com.eu.habbo.habbohotel.items.interactions.wired.effects; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.games.Game; +import com.eu.habbo.habbohotel.games.GameState; import com.eu.habbo.habbohotel.games.GameTeam; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; @@ -38,33 +38,23 @@ public class WiredEffectGiveScoreToTeam extends InteractionWiredEffect { @Override public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); + for (Game game : room.getGames()) { + if (game != null && game.state.equals(GameState.RUNNING)) { + int c = this.startTimes.get(game.getStartTime()); - if (habbo != null) { - Class game = habbo.getHabboInfo().getCurrentGame(); + if (c < this.count) { + GameTeam team = game.getTeam(this.teamColor); - if (game != null) { - Game g = room.getGame(game); + if (team != null) { + team.addTeamScore(this.points); - if (g != null) { - int c = this.startTimes.get(g.getStartTime()); - - if (c < this.count) { - GameTeam team = g.getTeam(this.teamColor); - - if (team != null) { - team.addTeamScore(this.points); - - this.startTimes.put(g.getStartTime(), c++); - - return true; - } + this.startTimes.put(game.getStartTime(), c + 1); } } } } - return false; + return true; } @Override