我想使用java向服务器发送rcon命令,为此我正在使用以下库https://github.com/Kronos666/rkon-core 当我像这样运行命令时
Rcon rcon = new Rcon("127.0.0.1", 27015, "mypassword".getBytes());
// Example: On a minecraft server this will list the connected players
String result = rcon.command("list");
// Display the result in the console
System.out.println(result);
我的服务器在控制台Gc connection established from...
中显示响应,依此类推
但是在java app中我有空结果,它不是null,它只是空的
String result = rcon.command("list");
如何使用rcon协议从服务器获取响应?
答案 0 :(得分:1)
试试这个:
try {
Rcon rcon = new Rcon("127.0.0.1", 27015, "mypassword".getBytes());
String result = rcon.command("list");
System.out.println(result);
} catch (AuthenticationException e) {
String result = "Authentication failed";
}
答案 1 :(得分:0)
最后我写了自己的实现:
byte[] password
其中RconData是具有 output$loc<-renderUI({
selectInput("loc", label = h4("Choose location"),
choices = locations$location ,selected = 1
)
})
rt<-reactive({
locations$location <- gsub( " " , "+" , locations$location)
AQ<- aq_measurements(location = input$loc,date_from = as.Date(as.POSIXct(subset(locations$firstUpdated,(locations[,1]==input$loc))
,format="%Y-%m-%d %H:%M:%S"))
, date_to = as.Date(as.POSIXct(subset(locations$lastUpdated,(locations[,1]==input$loc)),format="%Y-%m-%d %H:%M:%S"))
)
met <- importNOAA(year = 2014:2018)
colnames(AQ)[9] <- "date"
merged<-merge(AQ, met, by="date")
# date output -- reports user-selected state & stop dates in UI
merged$location <- gsub( " " , "+" , merged$location)
merged$date <- gsub( " " , "+" , merged$date)
merged
})
output$dt<-renderUI({
selectInput("dt", label = h4("Choose Dates"),
choices = as.character(rt()[,1]),
selected = 1
)
})
#DT
output$merged <- shiny::renderDataTable({
subset(rt(),(rt()[,1]==input$dt))
})
属性的简单POJO,