Skip to content

Commit 167014b

Browse files
committed
Prevent setting a schema on already used machines
1 parent 8985232 commit 167014b

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/main/java/org/dave/compactmachines3/command/CommandSchemaSet.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args
5353
}
5454

5555
TileEntityMachine machine = (TileEntityMachine)te;
56+
if(machine.coords != -1) {
57+
throw this.getException(sender, "machine_is_already_in_use");
58+
}
5659

5760
Schema schema = SchemaRegistry.instance.getSchema(schemaName);
5861
if(machine.getSize() != schema.size) {

src/main/resources/assets/compactmachines3/lang/en_us.lang

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ commands.compactmachines3.schema.set.description=Sets the specified schema to th
8585
commands.compactmachines3.schema.set.exception.unknown_schema=No schema with that name exists!
8686
commands.compactmachines3.schema.set.exception.look_at_compact_machine=You need to look at a Compact Machine block!
8787
commands.compactmachines3.schema.set.exception.machine_size_does_not_match=The size of the machine does not match the schema!
88+
commands.compactmachines3.schema.set.exception.machine_is_already_in_use=Machine is already in use. Place a new machine!
8889
commands.compactmachines3.schema.set.machine_schema_set_to=Machine set to schema: %s
8990

9091
commands.compactmachines3.schema.reload-files.usage=/compactmachines3 schema reload-files

0 commit comments

Comments
 (0)