Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ The config file can be found in `<server>/config/htm_config.json`.

(is set to true by default, meaning copper golems can take items from or put items into locked containers)

`auto_locking_containers`: List of containers which will be set to PRIVATE by default
`auto_locking_containers`: Map of containers which will be automatically locked

(add or remove blocks to the list to lock them by default, or not, block tags can also be used).
(add or remove blocks to the map to lock them by default, or not, block tags can also be used).

An example config file, with custom flag overrides for copper golems:

Expand All @@ -124,16 +124,16 @@ An example config file, with custom flag overrides for copper golems:
"copper_golems": false
}
},
"auto_locking_containers": [
"minecraft:chest",
"minecraft:trapped_chest",
"minecraft:barrel",
"minecraft:furnace",
"minecraft:blast_furnace",
"minecraft:smoker",
"#minecraft:shulker_boxes",
"#minecraft:copper_chests"
]
"auto_locking_containers": {
"minecraft:chest": "private",
"minecraft:trapped_chest": "private",
"minecraft:blast_furnace": "private",
"minecraft:barrel": "private",
"minecraft:smoker": "private",
"minecraft:furnace": "private",
"#minecraft:copper_chests": "public",
"#minecraft:shulker_boxes": "public"
}
}
```

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ minecraft_version=1.21.11
loader_version=0.18.2

# Mod Properties
mod_version=1.2.1
mod_version=1.2.2
maven_group=us.potatoboy
archives_base_name=htm

Expand Down
19 changes: 2 additions & 17 deletions src/main/java/com/github/fabricservertools/htm/HTM.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

import com.github.fabricservertools.htm.api.Lock;
import com.github.fabricservertools.htm.command.HTMCommand;
import com.github.fabricservertools.htm.command.subcommands.*;
import com.github.fabricservertools.htm.config.HTMConfig;
import com.github.fabricservertools.htm.interactions.InteractionManager;
import com.github.fabricservertools.htm.listeners.PlayerEventListener;
import com.github.fabricservertools.htm.listeners.LevelEventListener;
import com.mojang.brigadier.CommandDispatcher;
import eu.pb4.common.protection.api.CommonProtection;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.resources.Identifier;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -26,23 +23,11 @@ public void onInitialize() {
Lock.bootstrap();
HTMConfig.load();

CommandRegistrationCallback.EVENT.register(((dispatcher, environment, registryAccess) -> registerCommands(dispatcher)));
HTMCommand.bootstrap();
CommandRegistrationCallback.EVENT.register(((dispatcher, buildContext, selection) -> HTMCommand.register(dispatcher)));
CommonProtection.register(Identifier.fromNamespaceAndPath("htm", "containers"), new InteractionManager());

PlayerEventListener.init();
LevelEventListener.init();
}

private void registerCommands(CommandDispatcher<CommandSourceStack> dispatcher) {
HTMCommand.registerSubCommand(new SetCommand());
HTMCommand.registerSubCommand(new RemoveCommand());
HTMCommand.registerSubCommand(new TrustCommand());
HTMCommand.registerSubCommand(new UntrustCommand());
HTMCommand.registerSubCommand(new InfoCommand());
HTMCommand.registerSubCommand(new TransferCommand());
HTMCommand.registerSubCommand(new FlagCommand());
HTMCommand.registerSubCommand(new PersistCommand());
HTMCommand.registerSubCommand(new QuietCommand());
HTMCommand.register(dispatcher);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
package com.github.fabricservertools.htm.command;

import com.github.fabricservertools.htm.command.subcommands.FlagCommand;
import com.github.fabricservertools.htm.command.subcommands.InfoCommand;
import com.github.fabricservertools.htm.command.subcommands.PersistCommand;
import com.github.fabricservertools.htm.command.subcommands.QuietCommand;
import com.github.fabricservertools.htm.command.subcommands.RemoveCommand;
import com.github.fabricservertools.htm.command.subcommands.SetCommand;
import com.github.fabricservertools.htm.command.subcommands.TransferCommand;
import com.github.fabricservertools.htm.command.subcommands.TrustCommand;
import com.github.fabricservertools.htm.command.subcommands.UntrustCommand;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import me.lucko.fabric.api.permissions.v0.Permissions;
Expand Down Expand Up @@ -29,4 +38,16 @@ public static void registerSubCommand(SubCommand subCommand) {
}
SUB_COMMANDS.add(subCommand);
}

public static void bootstrap() {
registerSubCommand(new SetCommand());
registerSubCommand(new RemoveCommand());
registerSubCommand(new TrustCommand());
registerSubCommand(new UntrustCommand());
registerSubCommand(new InfoCommand());
registerSubCommand(new TransferCommand());
registerSubCommand(new FlagCommand());
registerSubCommand(new PersistCommand());
registerSubCommand(new QuietCommand());
}
}