Archiviert
1
0
Dieser Commit ist enthalten in:
Lixfel 2019-09-06 18:08:58 +02:00
Ursprung 757f2439eb
Commit 72ea55a7f2
4 geänderte Dateien mit 9 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -33,7 +33,7 @@ public class PollCommand extends BasicCommand {
int answer; int answer;
try { try {
answer = Integer.parseUnsignedInt(args[0]); answer = Integer.parseUnsignedInt(args[0]);
if(answer < 1 || answer >= PollSystem.answers()) if(answer < 1 || answer > PollSystem.answers())
throw new NumberFormatException(); throw new NumberFormatException();
}catch(NumberFormatException e){ }catch(NumberFormatException e){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDas ist keine Antwortmöglichkeit!"); BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDas ist keine Antwortmöglichkeit!");

Datei anzeigen

@ -127,6 +127,6 @@ public class ConnectionListener extends BasicListener {
ProxiedPlayer player = e.getPlayer(); ProxiedPlayer player = e.getPlayer();
Collection<ProxiedPlayer> players = server.getPlayers(); Collection<ProxiedPlayer> players = server.getPlayers();
if(players.isEmpty() || (players.size() == 1 && players.contains(player))) if(players.isEmpty() || (players.size() == 1 && players.contains(player)))
subserver.stop(); ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), subserver::stop);
} }
} }

Datei anzeigen

@ -41,15 +41,15 @@ public class PollSystem extends BasicListener {
BungeeCore.send(player, "§7Klicke die Antwort an, die dir gefällt!"); BungeeCore.send(player, "§7Klicke die Antwort an, die dir gefällt!");
BungeeCore.send(player, "§e" + question); BungeeCore.send(player, "§e" + question);
for(int i = 0; i < answers.size(); i++){ for(int i = 1; i <= answers.size(); i++){
BungeeCore.send(player, "§7" + answers.get(i), BungeeCore.send(player, "§7" + answers.get(i-1),
"§eDiese Antwort wählen", "§e" + answers.get(i-1) + " §ewählen",
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/poll " + (i+1))); new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/poll " + i));
} }
} }
public static boolean noCurrentPoll(){ public static boolean noCurrentPoll(){
return question != null && !question.equals(""); return question == null || question.equals("");
} }
public static String getQuestion() { public static String getQuestion() {

Datei anzeigen

@ -19,6 +19,7 @@ public class PollAnswer {
private PollAnswer(int userID, String question){ private PollAnswer(int userID, String question){
this.userID = userID; this.userID = userID;
this.question = question; this.question = question;
answer = 0;
} }
public static PollAnswer get(int userID){ public static PollAnswer get(int userID){
@ -34,7 +35,7 @@ public class PollAnswer {
} }
public boolean hasAnswered(){ public boolean hasAnswered(){
return answer == 0; return answer != 0;
} }
public void setAnswer(int answer){ public void setAnswer(int answer){