mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 19:25:20 -04:00
Added getter for players online as well as registered dimensions to debug card. Closes #1122.
This commit is contained in:
parent
48b4bed67a
commit
5b0e896f6f
@ -98,10 +98,17 @@ class DebugCard(host: EnvironmentHost) extends prefab.ManagedEnvironment {
|
||||
result(host.zPosition)
|
||||
}
|
||||
|
||||
@Callback(doc = """function():userdata -- Get the container's world object.""")
|
||||
@Callback(doc = """function([id:number]):userdata -- Get the world object for the specified dimension ID, or the container's.""")
|
||||
def getWorld(context: Context, args: Arguments): Array[AnyRef] = {
|
||||
checkEnabled()
|
||||
result(new DebugCard.WorldValue(host.world))
|
||||
if (args.count() > 0) result(new DebugCard.WorldValue(DimensionManager.getWorld(args.checkInteger(0))))
|
||||
else result(new DebugCard.WorldValue(host.world))
|
||||
}
|
||||
|
||||
@Callback(doc = """function():table -- Get a list of all world IDs, loaded and unloaded.""")
|
||||
def getWorlds(context: Context, args: Arguments): Array[AnyRef] = {
|
||||
checkEnabled()
|
||||
result(DimensionManager.getStaticDimensionIDs)
|
||||
}
|
||||
|
||||
@Callback(doc = """function(name:string):userdata -- Get the entity of a player.""")
|
||||
@ -110,6 +117,12 @@ class DebugCard(host: EnvironmentHost) extends prefab.ManagedEnvironment {
|
||||
result(new DebugCard.PlayerValue(args.checkString(0)))
|
||||
}
|
||||
|
||||
@Callback(doc = """function():table -- Get a list of currently logged-in players.""")
|
||||
def getPlayers(context: Context, args: Arguments): Array[AnyRef] = {
|
||||
checkEnabled()
|
||||
result(MinecraftServer.getServer.getAllUsernames)
|
||||
}
|
||||
|
||||
@Callback(doc = """function(name:string):boolean -- Get whether a mod or API is loaded.""")
|
||||
def isModLoaded(context: Context, args: Arguments): Array[AnyRef] = {
|
||||
checkEnabled()
|
||||
@ -122,7 +135,7 @@ class DebugCard(host: EnvironmentHost) extends prefab.ManagedEnvironment {
|
||||
checkEnabled()
|
||||
val commands =
|
||||
if (args.isTable(0)) collectionAsScalaIterable(args.checkTable(0).values())
|
||||
else Iterable (args.checkString(0))
|
||||
else Iterable(args.checkString(0))
|
||||
|
||||
CommandSender.synchronized {
|
||||
CommandSender.prepare()
|
||||
|
Loading…
x
Reference in New Issue
Block a user