mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-31 05:33:00 +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:
		| @@ -141,9 +141,10 @@ public final class CommandComputerCraft | |||||||
|             .then( command( "shutdown" ) |             .then( command( "shutdown" ) | ||||||
|                 .requires( UserLevel.OWNER_OP ) |                 .requires( UserLevel.OWNER_OP ) | ||||||
|                 .argManyValue( "computers", manyComputers(), s -> ComputerCraft.serverComputerRegistry.getComputers() ) |                 .argManyValue( "computers", manyComputers(), s -> ComputerCraft.serverComputerRegistry.getComputers() ) | ||||||
|                 .executes( ( context, computers ) -> { |                 .executes( ( context, computerSelectors ) -> { | ||||||
|                     int shutdown = 0; |                     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++; |                         if( computer.isOn() ) shutdown++; | ||||||
|                         computer.shutdown(); |                         computer.shutdown(); | ||||||
| @@ -155,9 +156,10 @@ public final class CommandComputerCraft | |||||||
|             .then( command( "turn-on" ) |             .then( command( "turn-on" ) | ||||||
|                 .requires( UserLevel.OWNER_OP ) |                 .requires( UserLevel.OWNER_OP ) | ||||||
|                 .argManyValue( "computers", manyComputers(), s -> ComputerCraft.serverComputerRegistry.getComputers() ) |                 .argManyValue( "computers", manyComputers(), s -> ComputerCraft.serverComputerRegistry.getComputers() ) | ||||||
|                 .executes( ( context, computers ) -> { |                 .executes( ( context, computerSelectors ) -> { | ||||||
|                     int on = 0; |                     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++; |                         if( !computer.isOn() ) on++; | ||||||
|                         computer.turnOn(); |                         computer.turnOn(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jonathan Coates
					Jonathan Coates