mirror of
https://github.com/arcadiadevs/hubcore.git
synced 2025-02-16 18:11:18 +01:00
Updated to 1.4.0
This commit is contained in:
parent
af85dab320
commit
84d3cad940
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -27,7 +27,7 @@ public class PlayerCount extends PlaceholderExpansion {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "online";
|
||||
return "placeholders";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -42,10 +42,25 @@ public class PlayerCount extends PlaceholderExpansion {
|
||||
|
||||
@Override
|
||||
public String onRequest(OfflinePlayer p, String params) {
|
||||
DataBase db = new DataBase();
|
||||
PingUtil pu = new PingUtil();
|
||||
PingInfoStructure structure = pu.getData(Integer.parseInt(db.getPortByUUID(p.getUniqueId().toString())));
|
||||
if (params.equalsIgnoreCase("online")) {
|
||||
DataBase db = new DataBase();
|
||||
PingUtil pu = new PingUtil();
|
||||
try {
|
||||
PingInfoStructure structure = pu.getData(Integer.parseInt(db.getPortByUUID(p.getUniqueId().toString())));
|
||||
|
||||
return (structure != null) ? String.valueOf(structure.getOnline()) : "Offline";
|
||||
return (structure != null) ? String.valueOf(structure.getOnline()) : "Offline";
|
||||
} catch (Exception ex) {
|
||||
return "Offline";
|
||||
}
|
||||
} else if (params.equalsIgnoreCase("serversonline")) {
|
||||
DataBase db = new DataBase();
|
||||
PingUtil pu = new PingUtil();
|
||||
|
||||
int online = (int) db.getServersInfo().stream().filter(dbInfoStructure -> pu.isOnline("127.0.0.1", dbInfoStructure.getPort())).count();
|
||||
|
||||
return String.valueOf(online);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user