2018-07-06 15:30:00 +02:00
|
|
|
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;
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public class GamePlayer {
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2019-03-18 02:22:00 +01:00
|
|
|
private final Habbo habbo;
|
2018-07-06 15:30:00 +02:00
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private GameTeamColors teamColor;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private int score;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public GamePlayer(Habbo habbo, GameTeamColors teamColor) {
|
2018-07-06 15:30:00 +02:00
|
|
|
this.habbo = habbo;
|
|
|
|
this.teamColor = teamColor;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public void reset() {
|
2018-07-06 15:30:00 +02:00
|
|
|
this.score = 0;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public synchronized void addScore(int amount) {
|
|
|
|
if (habbo.getHabboInfo().getGamePlayer() != null || this.habbo.getHabboInfo().getCurrentRoom().getGame(this.habbo.getHabboInfo().getCurrentGame()).getTeamForHabbo(this.habbo) != null) {
|
2019-05-01 03:02:51 +02:00
|
|
|
if (habbo.getHabboInfo().getGamePlayer() != null && this.habbo.getHabboInfo().getCurrentRoom().getGame(this.habbo.getHabboInfo().getCurrentGame()).getTeamForHabbo(this.habbo) != null) {
|
|
|
|
this.score += amount;
|
2019-05-26 20:14:53 +02:00
|
|
|
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});
|
|
|
|
}
|
2019-05-01 03:02:51 +02:00
|
|
|
}
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public Habbo getHabbo() {
|
2018-07-06 15:30:00 +02:00
|
|
|
return this.habbo;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public GameTeamColors getTeamColor() {
|
2018-07-06 15:30:00 +02:00
|
|
|
return this.teamColor;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public int getScore() {
|
2018-07-06 15:30:00 +02:00
|
|
|
return this.score;
|
|
|
|
}
|
|
|
|
}
|