Minecraft Server Konsole Live auslesen

  • VB.NET

Es gibt 70 Antworten in diesem Thema. Der letzte Beitrag () ist von Luca.

    Minecraft Server Konsole Live auslesen

    Hallo Community,


    Ich hab schon seit Monaten ein Problem was ich einfach nicht hinbekomme :(

    Also ich habe ein Programm programmiert mitdem man einen Minecraft-Server verwalten kann und verschiedene Dinge machen kann

    Bild:



    Bei dem Programm funktioniert alles bis auf die Server Konsole :(

    Ich habe schon nachgeforscht wie das geht (Mit StandardInput und StandardOutput) doch ich bin ratlos ich bekomme das einfach nicht hin

    Bitte könnt ihr mir helfen :(

    Hier ein Bild von der Server Konsole:




    Danke für jede hilfe :)

    PS: Wenn ihr noch was wissen müsst oder ich irgendwelche Infos vergessen habe einfach sagen :)

    PS2: Bevor jetzt wieder welche kommen mit "So ein Programm gibt es schon" oder anderes sage ich gleich "Ich weiß das es das schon gibt aber ich darf es ja wohl machen oder nicht ?"

    Mit Freundlichen Grüßen

    joscha999 schrieb:

    Könntest du mir einen Kleinen Tipp geben wo ich bei den Vielen Kategorien schauen soll ? :D

    joscha999 schrieb:

    2: warum haßt du google :( ?
    Ich hasse Google ned Google ist mein Freund :D Ich hab schon in google gesucht aber nichts gefunden was mir hilft

    joscha999 schrieb:

    3: stimt schon dass es die dinger in maßßen gibt aber deins is das erste was ich sehe wat nen schönen GUI hat
    Danke :)

    joscha999 schrieb:

    4: gib deinem projekt Option Strict On falls es noch nicht drin is
    1. Wo sehe ich ob es drinnen is oder ned ? ^^

    2. Was ist das genau ?
    Also es kommt nicht direkt ein Fehler sondern eher eine Warnung aber ich probiers nochmal :D

    Die Warnung ist aber:


    Die Klasse Form1 kann entworfen werden, ist aber nicht die erste Klasse in der Datei. Visual Studio erfordert, dass Designer die erste Klasse in der Datei verwenden. Verschieben Sie den Klassencode, sodass die Klasse an erste Stelle in der Datei rückt, und versuchen Sie, den Designer erneut zu laden.

    Und das was da steht hab ich schon gemacht Ohne Erfolg :(


    EDIT: Also der Fehler ist weg :whistling:
    Diesen Code verwende ich gerade:

    VB.NET-Quellcode

    1. Imports System
    2. Imports System.IO
    3. Imports System.Diagnostics
    4. Imports System.ComponentModel
    5. Imports Microsoft.VisualBasic
    6. Public Class Form1
    7. End Class
    8. Namespace KonsolenInput
    9. Class StandardInput
    10. Shared Sub Input()
    11. Dim myProcess As New Process()
    12. myProcess.StartInfo.FileName = Application.StartupPath & "\Start.bat"
    13. myProcess.StartInfo.UseShellExecute = False
    14. myProcess.StartInfo.RedirectStandardInput = True
    15. myProcess.Start()
    16. Dim myStreamWriter As StreamWriter = myProcess.StandardInput
    17. Dim inputText As String
    18. Dim numLines As Integer = 0
    19. Do
    20. inputText = Console.ReadLine()
    21. If inputText.Length > 0 Then
    22. numLines += 1
    23. myStreamWriter.WriteLine(inputText)
    24. End If
    25. Loop While inputText.Length <> 0
    26. If numLines > 0 Then
    27. Else
    28. End If
    29. myStreamWriter.Close()
    30. myProcess.WaitForExit()
    31. myProcess.Close()
    32. End Sub
    33. End Class
    34. End Namespace


    Der Fehler ist zwar weg doch ich weiß nicht Weiter ?
    1. deklarier den process global um von überall drauf zuzugreifen können
    2.

    soltest du den process so starten:

    VB.NET-Quellcode

    1. Private Sub SetProcess()
    2. p.StartInfo.FileName = "cmd"
    3. p.StartInfo.Arguments = "/k"
    4. p.StartInfo.RedirectStandardError = True
    5. p.StartInfo.RedirectStandardInput = True
    6. p.StartInfo.RedirectStandardOutput = True
    7. p.StartInfo.CreateNoWindow = True
    8. p.StartInfo.UseShellExecute = False
    9. p.Start()
    10. End Sub

    (bzw. ham wir das bei uns so gemacht ist aber die schlauste methode)
    3.p.StandardInput.WriteLine
    benutzte zum schreiben !

    PS: p is der process

    VB.NET-Quellcode

    1. Private Sub SetProcess()
    2. p.StartInfo.FileName = "cmd"
    3. p.StartInfo.Arguments = "/k"
    4. p.StartInfo.RedirectStandardError = True
    5. p.StartInfo.RedirectStandardInput = True
    6. p.StartInfo.RedirectStandardOutput = True
    7. p.StartInfo.CreateNoWindow = True
    8. p.StartInfo.UseShellExecute = False
    9. p.Start()
    10. End Sub


    Muss ich bei

    VB.NET-Quellcode

    1. p.StartInfo.Arguments = "/k"


    "%ProgramFiles(x86)%\Java\jre7\bin\java.exe" -Xmx1024M -Xms1024M -jar craftbukkit.jar reinschreiben oder muss ich das "/k" drinnen stehen lassen ?
    Hahahaha, schöne GUI? *hust

    VB.NET-Quellcode

    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2. StartConsolenAnwendung()
    3. End Sub
    4. ' startet Konsolenanwendung mit Output Redirect
    5. Sub StartConsolenAnwendung()
    6. Dim p As New Process()
    7. ' Anwendungspfad setzen -> hier liegt es im Anwendungsordner
    8. p.StartInfo.FileName = "KonsolenAnwendung.exe"
    9. ' Arbeitsverzeichnis setzen falls nötig
    10. p.StartInfo.WorkingDirectory = ""
    11. ' kein Window erzeugen
    12. p.StartInfo.CreateNoWindow = True
    13. ' UseShellExecute auf falsch setzen
    14. p.StartInfo.UseShellExecute = False
    15. ' StandardOutput von Console umleiten
    16. p.StartInfo.RedirectStandardOutput = True
    17. ' Eventhandler für Redirection definieren
    18. AddHandler p.OutputDataReceived, AddressOf WriteProcessOutput
    19. ' Prozess starten
    20. p.Start()
    21. ' Asynchrones Lesen starten
    22. p.BeginOutputReadLine()
    23. End Sub
    24. ' EventHandler Routine für umgeleiteten Output
    25. Private Sub WriteProcessOutput(ByVal sendingProcess As Object, ByVal outLine As DataReceivedEventArgs)
    26. ' Daten kommen nicht auf GUI Thread -> per anonymer Methode Invoken
    27. If outLine.Data IsNot Nothing Then
    28. Me.Invoke(Sub() TextBox1.AppendText(outLine.Data & Environment.NewLine))
    29. End If
    30. End Sub


    Lesen und verstehen, SuFu hätte geholfen

    Habs btw. gerade mit den Argumenten "/c taskkill.exe" getestet, es funktioniert wunderbar.
    "Life isn't about winning the race. Life is about finishing the race and how many people we can help finish the race." ~Marc Mero

    Nun bin ich also auch soweit: Keine VB-Fragen per PM! Es gibt hier ein Forum, verdammt!

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Nikx“ ()

    VB.NET-Quellcode

    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2. StartConsolenAnwendung()
    3. End Sub
    4. ' startet Konsolenanwendung mit Output Redirect
    5. Sub StartConsolenAnwendung()
    6. Dim p As New Process()
    7. ' Anwendungspfad setzen -> hier liegt es im Anwendungsordner
    8. p.StartInfo.FileName = "KonsolenAnwendung.exe"
    9. ' Arbeitsverzeichnis setzen falls nötig
    10. p.StartInfo.WorkingDirectory = ""
    11. ' kein Window erzeugen
    12. p.StartInfo.CreateNoWindow = True
    13. ' UseShellExecute auf falsch setzen
    14. p.StartInfo.UseShellExecute = False
    15. ' StandardOutput von Console umleiten
    16. p.StartInfo.RedirectStandardOutput = True
    17. ' Eventhandler für Redirection definieren
    18. AddHandler p.OutputDataReceived, AddressOf WriteProcessOutput
    19. ' Prozess starten
    20. p.Start()
    21. ' Asynchrones Lesen starten
    22. p.BeginOutputReadLine()
    23. End Sub
    24. ' EventHandler Routine für umgeleiteten Output
    25. Private Sub WriteProcessOutput(ByVal sendingProcess As Object, ByVal outLine As DataReceivedEventArgs)
    26. ' Daten kommen nicht auf GUI Thread -> per anonymer Methode Invoken
    27. If outLine.Data IsNot Nothing Then
    28. Me.Invoke(Sub() TextBox1.AppendText(outLine.Data & Environment.NewLine))
    29. End If
    30. End Sub



    Wenn ich das mache Funktioniert es zwar doch es kommt folgendes:




    ?(
    Wie startest du den Server?
    "Life isn't about winning the race. Life is about finishing the race and how many people we can help finish the race." ~Marc Mero

    Nun bin ich also auch soweit: Keine VB-Fragen per PM! Es gibt hier ein Forum, verdammt!
    Haha.
    Process.StartInfo.FileName = "????"
    Process.StartInfo.Arguments = "????"

    Was zeigt die OriginalConsole denn bei CreateNoWindow = False ?
    "Life isn't about winning the race. Life is about finishing the race and how many people we can help finish the race." ~Marc Mero

    Nun bin ich also auch soweit: Keine VB-Fragen per PM! Es gibt hier ein Forum, verdammt!
    Die müsste bei NoWindow = False angezeigt werden.
    Ob das btw. bei net bat geht. kP
    "Life isn't about winning the race. Life is about finishing the race and how many people we can help finish the race." ~Marc Mero

    Nun bin ich also auch soweit: Keine VB-Fragen per PM! Es gibt hier ein Forum, verdammt!

    Nikx schrieb:

    Die müsste bei NoWindow = False angezeigt werden.
    Ob das btw. bei net bat geht. kP
    Ah sry hab mich verlesen :D

    Der Server Startet ganz normal wenn ich NoWindow auf False setze hier:

    Brainfuck-Quellcode

    1. 2012-08-31 02:23:44 [INFO] Starting minecraft server version 1.3.2
    2. 2012-08-31 02:23:44 [INFO] Loading properties
    3. 2012-08-31 02:23:44 [INFO] Default game type: SURVIVAL
    4. 2012-08-31 02:23:44 [INFO] Generating keypair
    5. 2012-08-31 02:23:45 [INFO] Starting Minecraft server on localhost:25565
    6. 2012-08-31 02:23:45 [WARNING] **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
    7. 2012-08-31 02:23:45 [WARNING] The server will make no attempt to authenticate usernames. Beware.
    8. 2012-08-31 02:23:45 [WARNING] While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
    9. 2012-08-31 02:23:45 [WARNING] To change this, set "online-mode" to "true" in the server.properties file.
    10. 2012-08-31 02:23:45 [INFO] This server is running CraftBukkit version git-Bukkit-1.3.2-R0.1-2-gb02da27-b2355jnks (MC: 1.3.2) (Implementing API version 1.3.2-R0.2-SNAPSHOT)
    11. 2012-08-31 02:23:45 [INFO] Preparing level "world"
    12. 2012-08-31 02:23:45 [INFO] Preparing start region for level 0 (Seed: -4728550517212274359)
    13. 2012-08-31 02:23:46 [INFO] Preparing start region for level 1 (Seed: -4728550517212274359)
    14. 2012-08-31 02:23:46 [INFO] Preparing spawn area: 97%
    15. 2012-08-31 02:23:46 [INFO] Preparing start region for level 2 (Seed: -4728550517212274359)
    16. 2012-08-31 02:23:47 [INFO] Server permissions file permissions.yml is empty, ignoring it
    17. 2012-08-31 02:23:47 [INFO] Done (1,568s)! For help, type "help" or "?"
    18. 2012-08-31 02:23:47 [INFO] ----- Bukkit Auto Updater -----
    19. 2012-08-31 02:23:47 [INFO] It appears that you're running a Development Build, when you've specified in bukkit.yml that you prefer to run Recommended Builds.
    20. 2012-08-31 02:23:47 [INFO] If you would like to be kept informed about new Development Build releases, it is recommended that you change 'preferred-channel' in your bukkit.yml to 'dev'.
    21. 2012-08-31 02:23:47 [INFO] With that set, you will be told whenever a new version is available for download, so that you can always keep up to date and secure with the latest fixes.
    22. 2012-08-31 02:23:47 [INFO] If you would like to disable this warning, simply set 'suggest-channels' to false in bukkit.yml.
    23. 2012-08-31 02:23:47 [INFO] ----- ------------------- -----
    24. 2012-08-31 02:23:52 [INFO] CONSOLE: Stopping the server..
    25. 2012-08-31 02:23:52 [INFO] Stopping server
    26. 2012-08-31 02:23:52 [WARNING] DSCT: socket closed
    27. 2012-08-31 02:23:52 [INFO] Saving players
    28. 2012-08-31 02:23:52 [INFO] Closing listening thread
    29. 2012-08-31 02:23:52 [INFO] Saving worlds
    30. 2012-08-31 02:23:52 [INFO] Saving chunks for level 'world'/Overworld
    31. 2012-08-31 02:23:53 [INFO] Saving chunks for level 'world_nether'/Nether
    32. 2012-08-31 02:23:53 [INFO] Saving chunks for level 'world_the_end'/The End


    Doch wenn ich einen befehl eingebe wird er angezeigt also wenn ich noWindow auf False habe und in der Originalkonsole stop eingebe wird es in der Richtextbox angezeigt sonst wir nix angezeigt :( es kommen immer die ">"
    Bei mir kommen nichtmal die. Dann weiß ichs auch net, sry. Immerhin soweit ^^
    "Life isn't about winning the race. Life is about finishing the race and how many people we can help finish the race." ~Marc Mero

    Nun bin ich also auch soweit: Keine VB-Fragen per PM! Es gibt hier ein Forum, verdammt!