Search in sources :

Example 1 with Scoreboard

use of com.voxelgameslib.voxelgameslib.components.scoreboard.Scoreboard in project VoxelGamesLibv2 by VoxelGamesLib.

the class MapInfoFeature method enable.

@Override
public void enable() {
    MapFeature mapFeature = getPhase().getFeature(MapFeature.class);
    Map map = mapFeature.getMap();
    ScoreboardFeature scoreboardFeature = getPhase().getFeature(ScoreboardFeature.class);
    Scoreboard scoreboard = scoreboardFeature.getScoreboard();
    for (String mode : map.getInfo().getGamemodes()) {
        scoreboard.createAndAddLine(mode);
    }
    scoreboard.createAndAddLine(ChatColor.YELLOW + "" + ChatColor.BOLD + "Gamemodes: ");
    scoreboard.createAndAddLine(map.getInfo().getAuthor());
    scoreboard.createAndAddLine(ChatColor.YELLOW + "" + ChatColor.BOLD + "Author: ");
    scoreboard.createAndAddLine(map.getInfo().getName());
    scoreboard.createAndAddLine(ChatColor.YELLOW + "" + ChatColor.BOLD + "Map: ");
}
Also used : Scoreboard(com.voxelgameslib.voxelgameslib.components.scoreboard.Scoreboard) Map(com.voxelgameslib.voxelgameslib.map.Map)

Example 2 with Scoreboard

use of com.voxelgameslib.voxelgameslib.components.scoreboard.Scoreboard in project VoxelGamesLibv2 by VoxelGamesLib.

the class PersonalScoreboardFeature method onQuit.

@GameEvent
public void onQuit(@Nonnull GameLeaveEvent event) {
    Scoreboard scoreboard = scoreboards.get(event.getUser());
    scoreboard.removeAllLines();
    scoreboard.removeAllUsers();
    scoreboards.remove(event.getUser());
}
Also used : AbstractScoreboard(com.voxelgameslib.voxelgameslib.components.scoreboard.AbstractScoreboard) Scoreboard(com.voxelgameslib.voxelgameslib.components.scoreboard.Scoreboard) GameEvent(com.voxelgameslib.voxelgameslib.event.GameEvent)

Example 3 with Scoreboard

use of com.voxelgameslib.voxelgameslib.components.scoreboard.Scoreboard in project VoxelGamesLibv2 by VoxelGamesLib.

the class PersonalScoreboardFeature method enable.

@Override
public void enable() {
    globalScoreboard = new GlobalScoreboard(scoreboards.values());
    getPhase().getGame().getAllUsers().forEach(user -> {
        Scoreboard scoreboard = scoreboardHandler.createScoreboard(getPhase().getGame().getGameMode().getName());
        scoreboard.addUser(user);
        scoreboards.put(user, scoreboard);
    });
}
Also used : AbstractScoreboard(com.voxelgameslib.voxelgameslib.components.scoreboard.AbstractScoreboard) Scoreboard(com.voxelgameslib.voxelgameslib.components.scoreboard.Scoreboard)

Example 4 with Scoreboard

use of com.voxelgameslib.voxelgameslib.components.scoreboard.Scoreboard in project VoxelGamesLibv2 by VoxelGamesLib.

the class PersonalScoreboardFeature method onJoin.

@GameEvent
public void onJoin(@Nonnull GameJoinEvent event) {
    Scoreboard scoreboard = scoreboardHandler.createScoreboard(getPhase().getGame().getGameMode().getName());
    scoreboard.addUser(event.getUser());
    scoreboards.put(event.getUser(), scoreboard);
}
Also used : AbstractScoreboard(com.voxelgameslib.voxelgameslib.components.scoreboard.AbstractScoreboard) Scoreboard(com.voxelgameslib.voxelgameslib.components.scoreboard.Scoreboard) GameEvent(com.voxelgameslib.voxelgameslib.event.GameEvent)

Aggregations

Scoreboard (com.voxelgameslib.voxelgameslib.components.scoreboard.Scoreboard)4 AbstractScoreboard (com.voxelgameslib.voxelgameslib.components.scoreboard.AbstractScoreboard)3 GameEvent (com.voxelgameslib.voxelgameslib.event.GameEvent)2 Map (com.voxelgameslib.voxelgameslib.map.Map)1