1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-23 09:57:39 +00:00

Fix counts in /computercraft {turn-on,shutdown}

We were using the size of the selectors (which is normally 1) rather
than the number of computers.
This commit is contained in:
Jonathan Coates
2022-05-07 20:15:29 +01:00
parent f5f0c7990a
commit 78334c4cb1

View File

@@ -141,9 +141,10 @@ public final class CommandComputerCraft
.then( command( "shutdown" )
.requires( UserLevel.OWNER_OP )
.argManyValue( "computers", manyComputers(), s -> ComputerCraft.serverComputerRegistry.getComputers() )
.executes( ( context, computers ) -> {
.executes( ( context, computerSelectors ) -> {
int shutdown = 0;
for( ServerComputer computer : unwrap( context.getSource(), computers ) )
Set<ServerComputer> computers = unwrap( context.getSource(), computerSelectors );
for( ServerComputer computer : computers )
{
if( computer.isOn() ) shutdown++;
computer.shutdown();
@@ -155,9 +156,10 @@ public final class CommandComputerCraft
.then( command( "turn-on" )
.requires( UserLevel.OWNER_OP )
.argManyValue( "computers", manyComputers(), s -> ComputerCraft.serverComputerRegistry.getComputers() )
.executes( ( context, computers ) -> {
.executes( ( context, computerSelectors ) -> {
int on = 0;
for( ServerComputer computer : unwrap( context.getSource(), computers ) )
Set<ServerComputer> computers = unwrap( context.getSource(), computerSelectors );
for( ServerComputer computer : computers )
{
if( !computer.isOn() ) on++;
computer.turnOn();