Arcturus-Community/src/main/java/com/eu/habbo/habbohotel/games/GamePlayer.java

52 lines
1.5 KiB
Java
Raw Normal View History

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) {
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});
}
}
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;
}
}