geforkt von SteamWar/BungeeCore
PollSystem
Dieser Commit ist enthalten in:
Ursprung
757f2439eb
Commit
72ea55a7f2
@ -33,7 +33,7 @@ public class PollCommand extends BasicCommand {
|
||||
int answer;
|
||||
try {
|
||||
answer = Integer.parseUnsignedInt(args[0]);
|
||||
if(answer < 1 || answer >= PollSystem.answers())
|
||||
if(answer < 1 || answer > PollSystem.answers())
|
||||
throw new NumberFormatException();
|
||||
}catch(NumberFormatException e){
|
||||
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDas ist keine Antwortmöglichkeit!");
|
||||
|
@ -127,6 +127,6 @@ public class ConnectionListener extends BasicListener {
|
||||
ProxiedPlayer player = e.getPlayer();
|
||||
Collection<ProxiedPlayer> players = server.getPlayers();
|
||||
if(players.isEmpty() || (players.size() == 1 && players.contains(player)))
|
||||
subserver.stop();
|
||||
ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), subserver::stop);
|
||||
}
|
||||
}
|
||||
|
@ -41,15 +41,15 @@ public class PollSystem extends BasicListener {
|
||||
BungeeCore.send(player, "§7Klicke die Antwort an, die dir gefällt!");
|
||||
BungeeCore.send(player, "§e" + question);
|
||||
|
||||
for(int i = 0; i < answers.size(); i++){
|
||||
BungeeCore.send(player, "§7" + answers.get(i),
|
||||
"§eDiese Antwort wählen",
|
||||
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/poll " + (i+1)));
|
||||
for(int i = 1; i <= answers.size(); i++){
|
||||
BungeeCore.send(player, "§7" + answers.get(i-1),
|
||||
"§e" + answers.get(i-1) + " §ewählen",
|
||||
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/poll " + i));
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean noCurrentPoll(){
|
||||
return question != null && !question.equals("");
|
||||
return question == null || question.equals("");
|
||||
}
|
||||
|
||||
public static String getQuestion() {
|
||||
|
@ -19,6 +19,7 @@ public class PollAnswer {
|
||||
private PollAnswer(int userID, String question){
|
||||
this.userID = userID;
|
||||
this.question = question;
|
||||
answer = 0;
|
||||
}
|
||||
|
||||
public static PollAnswer get(int userID){
|
||||
@ -34,7 +35,7 @@ public class PollAnswer {
|
||||
}
|
||||
|
||||
public boolean hasAnswered(){
|
||||
return answer == 0;
|
||||
return answer != 0;
|
||||
}
|
||||
|
||||
public void setAnswer(int answer){
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren