Fix replay command enabled while another replay is running.
Dieser Commit ist enthalten in:
Ursprung
618390def1
Commit
43fc4ecd65
@ -35,7 +35,7 @@ public class FightfileConnection extends PacketSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean isClosed() {
|
public boolean isClosed() {
|
||||||
try{
|
try{
|
||||||
return inputStream.available() == 0;
|
return inputStream.available() == 0;
|
||||||
}catch (IOException e){
|
}catch (IOException e){
|
||||||
|
@ -29,6 +29,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -37,6 +38,7 @@ import java.util.logging.Level;
|
|||||||
public class ReplayCommand implements CommandExecutor {
|
public class ReplayCommand implements CommandExecutor {
|
||||||
|
|
||||||
private static final Set<UserGroup> allowedGroups = EnumSet.of(UserGroup.Admin, UserGroup.Developer, UserGroup.Moderator);
|
private static final Set<UserGroup> allowedGroups = EnumSet.of(UserGroup.Admin, UserGroup.Developer, UserGroup.Moderator);
|
||||||
|
private static FightfileConnection fightfileConnection;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
@ -49,13 +51,22 @@ public class ReplayCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fightfileConnection != null && fightfileConnection.isClosed()) {
|
||||||
|
sender.sendMessage("§eSteam§8War» §cBitte warte bis kein Replay gezeigt wird.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(args.length != 1){
|
if(args.length != 1){
|
||||||
sender.sendMessage("§eSteam§8War» §c/replay [Dateipfad]");
|
sender.sendMessage("§eSteam§8War» §c/replay [Dateipfad]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
new FightfileConnection(new File(args[0] + ".recording"));
|
fightfileConnection = new FightfileConnection(new File(args[0] + (args[0].endsWith(".recording") ? "" : ".recording")));
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
Bukkit.getLogger().log(Level.WARNING, "Could not start reading file", e);
|
||||||
|
sender.sendMessage("§eSteam§8War» §cReplay konnte nicht gefunden werden.");
|
||||||
|
return false;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Could not start reading file", e);
|
Bukkit.getLogger().log(Level.WARNING, "Could not start reading file", e);
|
||||||
sender.sendMessage("§eSteam§8War» §cReplay konnte nicht gestartet werden.");
|
sender.sendMessage("§eSteam§8War» §cReplay konnte nicht gestartet werden.");
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren