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
22 changes: 10 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,22 @@ jobs:
build:
strategy:
matrix:
# and run on both Linux, Windows, and Mac
# and run on both Linux and Windows
os: [ubuntu-24.04, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: validate gradle wrapper
uses: gradle/actions/wrapper-validation@v3
- name: setup jdk 21
uses: actions/setup-java@v1
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build artifacts
run: ./gradlew build
- name: capture build artifacts
- name: Capture build artifacts
if: ${{ runner.os == 'Linux' }} # Only upload artifacts built from LTS java on one OS
uses: actions/upload-artifact@v4
with:
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,17 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up JDK 21
uses: actions/setup-java@v3
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup JDK 21
uses: actions/setup-java@v34
with:
distribution: temurin
java-version: 21

- name: Make gradlew executable
run: chmod +x ./gradlew

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build artifacts
run: ./gradlew clean build

- name: Upload assets to GitHub, Modrinth and CurseForge
uses: Kir-Antipov/mc-publish@v3.3
with:
Expand Down
80 changes: 62 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# HeyThatsMine

[![build](https://img.shields.io/github/workflow/status/fabricservertools/HeyThatsMine/build)](https://github.com/fabricservertools/HeyThatsMine/actions)

[![build]( https://img.shields.io/github/actions/workflow/status/QuiltServerTools/HeyThatsMine/main.yml?branch=master)](https://github.com/fabricservertools/HeyThatsMine/actions)
[![discord](https://img.shields.io/discord/764543203772334100?label=Fabric%20Server%20Tools%20Discord)](https://discord.gg/jydqZzkyEa)

[![discord](https://img.shields.io/discord/776126068024410135?label=Potatos%20Place)](https://discord.gg/ByaVuebAPb)

HTM is a fabric mod for protecting your containers and trusting people with access to them
Expand All @@ -14,17 +12,19 @@ HTM is a fabric mod for protecting your containers and trusting people with acce

HTM requires no additional setup apart from placing it in your mods folder. All new containers will automatically be set to private.

HTM also supports the luckperms API, which allows you to manage permissions. Permission nodes are listed in the relevant section. All nodes except admin are enabled for all users by default
HTM also supports the LuckPerms API, which allows you to manage permissions. Permission nodes are listed in the relevant section. All nodes except admin are enabled for all users by default

## Using HTM

The mod has multiple commands which you can use on your containers

### Flag

`/htm flag`: Checks the flags of a specific container. Left click on the container after running this command to check
`/htm flag`: Checks the flags of a specific container. Left-click on the container after running this command to check

`/htm flag <type> <value>`: Left click a container to set the flag
`/htm flag <type> <value>`: Left-click a container to set the flag

`/htm flag <type>`: Left-click a container to reset the flag to the default value defined in the config file

Permission node: `htm.command.flag`

Expand Down Expand Up @@ -79,23 +79,67 @@ Toggles no message mode, which hides non-command messages like automatic protect
Permission node: `htm.command.quiet`

### Config
`canTrustedPlayersBreakChests`: Toggles whether players trusted to a locked container can break the container

(set to false by default meaning only the owner can break a locked container).
The config file can be found in `<server>/config/htm_config.json`.

`can_trusted_players_break_chests`: Toggles whether players trusted to a locked container can break the container

(is set to false by default, meaning only the owner can break a locked container).

`defaultFlags`:
`default_flags`:

- `hoppers`: Toggles whether hoppers can pull from locked containers by default

(true by default meaning hoppers can pull from locked containers).



`autolockingContainers`: List of containers which will be set to PRIVATE by default

(remove items in the list to make them set to public by default).
- `overrides`: Overrides for default flags for containers.

(a map of blocks or block tags to a map of flag overrides, overrides do not need to contain all flags. Empty by default)

- `defaults`: The default flags, applicable to all blocks when no overrides are present.

- `hoppers`: Toggles whether hoppers can pull from locked containers by default

(is set to true by default, meaning hoppers can pull from locked containers).
- `copper_golems`: Toggles whether copper golems can take items from or put items into locked containers by default

(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

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

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

```json
{
"can_trusted_players_break_chests": false,
"default_flags": {
"overrides": {
"chest": {
"copper_golems": true
},
"#copper_chests": {
"copper_golems": true
}
},
"default": {
"hoppers": true,
"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"
]
}
```

The file above disables copper golem access to all locked containers except copper chests and normal chests. Flag overrides
can also be used to only have a specific set of locked containers allow hoppers by default. Flags can always be overridden
by players on a per-locked container instance basis.

### Additional permissions

Expand Down
64 changes: 33 additions & 31 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,55 +1,57 @@
plugins {
id 'fabric-loom' version '1.10.+'
id 'maven-publish'
id "fabric-loom" version "1.11.+"
}

repositories {
maven { url = "https://maven.nucleoid.xyz/" }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url "https://maven.nucleoid.xyz/" }
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

dependencies {
//to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
base {
archivesName = project.archives_base_name
}

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
repositories {
mavenCentral()

// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them.
maven{
url = "https://maven.nucleoid.xyz/"
}
}

modImplementation include("xyz.nucleoid:server-translations-api:${project.translation_version}")
dependencies {
//to change the versions see the gradle.properties file
minecraft("com.mojang:minecraft:${project.minecraft_version}")
mappings("net.fabricmc:yarn:${project.yarn_mappings}:v2")
modImplementation("net.fabricmc:fabric-loader:${project.loader_version}")

modImplementation include("me.lucko:fabric-permissions-api:${project.permissions_api_version}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")

modImplementation include("eu.pb4:common-protection-api:1.0.0")
modImplementation(include("xyz.nucleoid:server-translations-api:${project.translation_version}"))
modImplementation(include("me.lucko:fabric-permissions-api:${project.permissions_api_version}"))
modImplementation(include("eu.pb4:common-protection-api:${project.protection_api_version}"))
}

processResources {
inputs.property "version", project.version
inputs.property("version", project.version)

filesMatching("fabric.mod.json") {
expand "version": project.version
expand("version": project.version)
}
}

// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile) {
def targetJavaVersion = 21
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
options.encoding = "UTF-8"

if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}

jar {
from "LICENSE"
from("LICENSE") {
rename { "${it}_${project.archives_base_name}"}
}
}
15 changes: 8 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21.6
yarn_mappings=1.21.6+build.1
loader_version=0.16.14
minecraft_version=1.21.9
yarn_mappings=1.21.9+build.1
loader_version=0.17.2
# Mod Properties
mod_version=1.1.17
mod_version=1.2.0
maven_group=us.potatoboy
archives_base_name=htm
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.127.1+1.21.6
translation_version=2.5.1+1.21.5
permissions_api_version=0.4.0-SNAPSHOT
fabric_version=0.133.14+1.21.9
translation_version=2.5.2+1.21.9-pre3
permissions_api_version=0.4.1
protection_api_version=1.0.0
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 2 additions & 5 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pluginManagement {
repositories {
jcenter()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
Expand Down
9 changes: 1 addition & 8 deletions src/main/java/com/github/fabricservertools/htm/HTM.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.fabricservertools.htm;

import com.github.fabricservertools.htm.api.LockType;
import com.github.fabricservertools.htm.command.HTMCommand;
import com.github.fabricservertools.htm.command.subcommands.*;
import com.github.fabricservertools.htm.config.HTMConfig;
Expand All @@ -11,23 +10,17 @@
import eu.pb4.common.protection.api.CommonProtection;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.util.Identifier;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.io.File;

public class HTM implements ModInitializer {
public static final Logger LOGGER = LogManager.getLogger("HTM");
public static HTMConfig config;

@Override
public void onInitialize() {
LockType.init();

config = HTMConfig.loadConfig(new File(FabricLoader.getInstance().getConfigDir() + "/htm_config.json"));
HTMConfig.load();

CommandRegistrationCallback.EVENT.register(((dispatcher, environment, registryAccess) -> registerCommands(dispatcher)));
CommonProtection.register(Identifier.of("htm", "containers"), new InteractionManager());
Expand Down
Loading