Skip to content

Commit

Permalink
Feature: option to display the team-chooser GUI to all players withou…
Browse files Browse the repository at this point in the history
…t a team when they login (after a configurable delay).

Only if the game is not started.

Closes #47.
  • Loading branch information
AmauryCarrade committed Nov 23, 2014
1 parent dc83581 commit d140869
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/me/azenet/UHPlugin/listeners/UHGameListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,17 @@ public void onPlayerLogin(PlayerLoginEvent ev) {
public void onPlayerJoin(final PlayerJoinEvent ev) {
if (!this.p.getGameManager().isGameStarted()) {
p.getGameManager().initPlayer(ev.getPlayer());

if(p.getConfig().getBoolean("teams-options.gui.auto-display")) {
p.getServer().getScheduler().runTaskLater(p, new Runnable() {
@Override
public void run() {
if(p.getTeamManager().getTeamForPlayer(ev.getPlayer()) == null) {
p.getTeamManager().displayTeamChooserChatGUI(ev.getPlayer());
}
}
}, 20l * p.getConfig().getInt("teams-options.gui.delay"));
}
}

// Mainly useful on the first join.
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ teams-options:
# Randoms colors for solo games and solo teams (i.e. all the teams generated when the game starts)?
# If false, no color (aka white) used.
randomColors: true

# Chat-based GUI to choose a team
gui:
# Display the GUI when a player login out of any team?
auto-display: true
# Delay between the login and the display? (Seconds)
delay: 4



Expand Down

0 comments on commit d140869

Please sign in to comment.