Add group score

This commit is contained in:
Daniel Saukel 2016-08-03 15:35:20 +02:00
parent 95e4b30e6a
commit d5715298fd
5 changed files with 51 additions and 1 deletions

View File

@ -263,6 +263,8 @@ public class GroupCommand extends BRCommand {
MessageUtil.sendMessage(sender, "&bPlayers: &e" + players);
MessageUtil.sendMessage(sender, "&bDungeon: &e" + (dGroup.getDungeonName() == null ? "N/A" : dGroup.getDungeonName()));
MessageUtil.sendMessage(sender, "&bMap: &e" + (dGroup.getMapName() == null ? "N/A" : dGroup.getMapName()));
MessageUtil.sendMessage(sender, "&bScore: &e" + (dGroup.getScore() == 0 ? "N/A" : dGroup.getScore()));
MessageUtil.sendMessage(sender, "&bLives: &e" + (dGroup.getLives() == -1 ? "N/A" : dGroup.getLives()));
}
public void showHelp(String page) {

View File

@ -82,6 +82,7 @@ public enum DMessages implements Messages {
ERROR_NO_SUCH_GROUP("Error_NoSuchGroup", "&4The group &6&v1&4 does not exist!"),
ERROR_NO_SUCH_MAP("Error_NoSuchMap", "&4The world &6&v1&4 does not exist!"),
ERROR_NO_SUCH_PLAYER("Error_NoSuchPlayer", "&4The player &6&v1&4 does not exist!"),
ERROR_NO_SUCH_SHOP("Error_NoSuchShop", "&4Shop &v1 &4not found..."),
ERROR_NOT_CAPTAIN("Error_NotCaptain", "&4You are not the captain of your group!"),
ERROR_NOT_IN_DUNGEON("Error_NotInDungeon", "&4You are not in a dungeon!"),
ERROR_NOT_IN_GAME("Error_NotInGame", "&4The group &6&v1&4 is not member of a game."),
@ -136,7 +137,8 @@ public enum DMessages implements Messages {
GROUP_CONGRATS_SUB("Group_CongratsSub", "&l&4Your group &v1 &4won the match!"),
GROUP_CREATED("Group_Created", "&4&v1&6 created the group &4&v2&6!"),
GROUP_DEATH("Group_Death", "&4&v1 &6died. &4&v2 have &4&v3 &6lives left."),
GROUP_DEATH_KICK("Group_DeathKick", "&2&v1 &6was kicked because &4&v2 &6have no lives left."),
GROUP_DEATH_KICK("Group_DeathKick", "&4&v1 &6was kicked because &4&v2 &6have no lives left."),
GROUP_DEFEATED("Group_Defeated", "&4The group &4v1 &6is defeated because it lost its last score point."),
GROUP_DISBANDED("Group_Disbanded", "&4&v1&6 disbanded the group &4&v2&6."),
GROUP_FLAG_CAPTURED("Group_FlagCaptured", "&4&v1&6 has captured the flag of the group &4&v2&6!"),
GROUP_FLAG_LOST("Group_FlagLost", "&4&v1&6 died and lost &4&v2&6's flag."),

View File

@ -66,6 +66,7 @@ public class Game {
fetchRules();
dGroup.setInitialLives(rules.getInitialGroupLives());
dGroup.setLives(rules.getInitialGroupLives());
dGroup.setScore(rules.getInitialScore());
}
public Game(DGroup dGroup, DGameWorld world) {
@ -79,6 +80,7 @@ public class Game {
fetchRules();
dGroup.setInitialLives(rules.getInitialGroupLives());
dGroup.setLives(rules.getInitialGroupLives());
dGroup.setScore(rules.getInitialScore());
}
public Game(DGroup dGroup, String worldName) {
@ -95,6 +97,7 @@ public class Game {
fetchRules();
dGroup.setInitialLives(rules.getInitialGroupLives());
dGroup.setLives(rules.getInitialGroupLives());
dGroup.setScore(rules.getInitialScore());
}
public Game(DGroup dGroup, GameType type, DGameWorld world) {
@ -114,6 +117,7 @@ public class Game {
fetchRules();
dGroup.setInitialLives(rules.getInitialGroupLives());
dGroup.setLives(rules.getInitialGroupLives());
dGroup.setScore(rules.getInitialScore());
}
}

View File

@ -56,6 +56,8 @@ public class GameRules {
DEFAULT_VALUES.friendlyFire = false;
DEFAULT_VALUES.initialLives = -1;
DEFAULT_VALUES.initialGroupLives = -1;
DEFAULT_VALUES.initialScore = 3;
DEFAULT_VALUES.scoreGoal = -1;
/* Timer */
DEFAULT_VALUES.timeLastPlayed = 0;
@ -100,6 +102,8 @@ public class GameRules {
protected Boolean friendlyFire;
protected Integer initialLives;
protected Integer initialGroupLives;
protected Integer initialScore;
protected Integer scoreGoal;
/* Timer */
protected Integer timeLastPlayed;
@ -232,6 +236,20 @@ public class GameRules {
return initialGroupLives;
}
/**
* @return the initial score
*/
public int getInitialScore() {
return initialScore;
}
/**
* @return the score goal
*/
public int getScoreGoal() {
return scoreGoal;
}
// Timer
/**
* @return the timeLastPlayed
@ -496,6 +514,14 @@ public class GameRules {
initialGroupLives = defaultValues.initialGroupLives;
}
if (initialScore == null) {
initialScore = defaultValues.initialScore;
}
if (scoreGoal == null) {
scoreGoal = defaultValues.scoreGoal;
}
/* Timer */
if (timeLastPlayed == null) {
timeLastPlayed = defaultValues.timeLastPlayed;

View File

@ -66,6 +66,7 @@ public class DGroup {
private BukkitTask timeIsRunningTask;
private DResourceWorld nextFloor;
private DColor color;
private int score = 0;
private int initialLives = -1;
private int lives = -1;
@ -585,6 +586,21 @@ public class DGroup {
this.color = color;
}
/**
* @return the current score
*/
public int getScore() {
return score;
}
/**
* @param score
* the score to set
*/
public void setScore(int score) {
this.score = score;
}
/**
* @return the initial group lives
*/