Arcturus-Community/src/main/java/com/eu/habbo/habbohotel/games/GamePlayer.java
2019-05-26 21:15:26 +03:00

52 lines
1.5 KiB
Java

package com.eu.habbo.habbohotel.games;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
public class GamePlayer {
private final Habbo habbo;
private GameTeamColors teamColor;
private int score;
public GamePlayer(Habbo habbo, GameTeamColors teamColor) {
this.habbo = habbo;
this.teamColor = teamColor;
}
public void reset() {
this.score = 0;
}
public synchronized void addScore(int amount) {
if (habbo.getHabboInfo().getGamePlayer() != null || this.habbo.getHabboInfo().getCurrentRoom().getGame(this.habbo.getHabboInfo().getCurrentGame()).getTeamForHabbo(this.habbo) != null) {
if (habbo.getHabboInfo().getGamePlayer() != null && this.habbo.getHabboInfo().getCurrentRoom().getGame(this.habbo.getHabboInfo().getCurrentGame()).getTeamForHabbo(this.habbo) != null) {
this.score += amount;
WiredHandler.handle(WiredTriggerType.SCORE_ACHIEVED, this.habbo.getRoomUnit(), this.habbo.getHabboInfo().getCurrentRoom(), new Object[]{this.habbo.getHabboInfo().getCurrentRoom().getGame(this.habbo.getHabboInfo().getCurrentGame()).getTeamForHabbo(this.habbo).getTotalScore(), amount});
}
}
}
public Habbo getHabbo() {
return this.habbo;
}
public GameTeamColors getTeamColor() {
return this.teamColor;
}
public int getScore() {
return this.score;
}
}