Compare commits

..

2 Commits

Author SHA1 Message Date
78b6c7030f configure gradle build and java toolchain 2026-03-22 18:10:40 -04:00
1edeec957e Initial commit 2026-03-22 18:04:39 -04:00
6 changed files with 23 additions and 193 deletions

View File

@@ -1,9 +1,3 @@
# 1.0.1
## Changelog
* Tested compatibility with release version and update manifest for 2026.03.26-89796e57b
# 1.0.0 # 1.0.0
## Changelog ## Changelog

View File

@@ -17,7 +17,7 @@ includes_pack=true
# The release channel your plugin should be built and ran against. This is # The release channel your plugin should be built and ran against. This is
# usually release or pre-release. You can verify your settings in the # usually release or pre-release. You can verify your settings in the
# official launcher. # official launcher.
patchline=pre-release patchline=release
# Determines if the development server should also load mods from the user's # Determines if the development server should also load mods from the user's
# standard mods folder. This lets you test mods by installing them where a # standard mods folder. This lets you test mods by installing them where a

View File

@@ -1,63 +0,0 @@
package xyz.quickbasic.tieredrepairkits;
// This class is responsible for managing repair-kit related data for the plugin.
// It loads values from the configuration and stores them in variables that the
// rest of the plugin can access easily.
public class RepairKitManager {
// Reference to the main plugin class.
// This allows the manager to access things like config, logging, etc.
private final TieredRepairKits plugin;
// Local copies of configuration values.
// These are loaded from the config file when the manager starts.
private int someValue;
private String someString;
// Constructor for the manager.
// This runs when a new RepairKitManager is created in your main plugin.
public RepairKitManager(TieredRepairKits plugin) {
// Store the reference to the plugin
this.plugin = plugin;
// Immediately load values from the config file into local variables
loadConfig();
}
// This method loads values from the plugin configuration
// and stores them inside this manager class.
public void loadConfig() {
// Retrieve the TRKConfig object from the plugin's Config wrapper
TRKConfig config = plugin.getConfig().get();
// Copy values from the config object into this manager's variables
this.someValue = config.getSomeValue();
this.someString = config.getSomeString();
// Log information to the server console to confirm the config was loaded
TieredRepairKits.LOGGER.atInfo().log("Config Loaded");
// Print the loaded values so you can verify them during development
TieredRepairKits.LOGGER.atInfo().log("SomeValue = " + someValue);
TieredRepairKits.LOGGER.atInfo().log("SomeString = " + someString);
}
// Getter method for someValue
// Other classes can call this to retrieve the loaded value
public int getSomeValue() {
return someValue;
}
// Getter method for someString
// Provides read access to the stored config value
public String getSomeString() {
return someString;
}
}

View File

@@ -1,77 +0,0 @@
package xyz.quickbasic.tieredrepairkits;
// Hytale codec system imports used to serialize/deserialize config data
import com.hypixel.hytale.codec.Codec; // Careful to not use other Codec imports
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
// This class represents the structure of your plugin's configuration file.
// The fields in this class correspond to values stored in JSON.
public class TRKConfig {
// CODEC tells the Hytale engine how to convert between:
// Java object (TRKConfig) <-> JSON file on disk
public static final BuilderCodec<TRKConfig> CODEC = BuilderCodec.builder(TRKConfig.class, TRKConfig::new)
// Adds a config field called "SomeValue" to the JSON
// Codec.INTEGER tells Hytale the value is an integer
.append(new KeyedCodec<Integer>("SomeValue", Codec.INTEGER),
// Setter: how the JSON value gets written into this object
(config, value) -> config.someValue = value,
// Getter: how the value is read from this object when saving JSON
(config) -> config.someValue).add()
// Adds another config field called "SomeString"
// Codec.STRING tells Hytale the value type is a string
.append(new KeyedCodec<String>("SomeString", Codec.STRING),
// Setter: how JSON value updates the object field
(config, value) -> config.someString = value,
// Getter: how the value is read when saving
(config) -> config.someString).add()
// Finalizes the codec definition
.build();
// Default value for the integer config entry
// If the config file doesn't exist yet, this value will be written
private int someValue = 12;
// Default value for the string config entry
private String someString = "My default string";
// Default constructor required by the codec system
// The codec calls this when creating a new config object
public TRKConfig() {
}
// Getter for SomeValue
// Allows other classes to read the value safely
public int getSomeValue() {
return someValue;
}
// Getter for SomeString
public String getSomeString() {
return someString;
}
// Setter for SomeValue
// Allows code to change the value before saving the config
public void setSomeValue(int someValue) {
this.someValue = someValue;
}
// Setter for SomeString
public void setSomeString(String someString) {
this.someString = someString;
}
}

View File

@@ -3,45 +3,20 @@ package xyz.quickbasic.tieredrepairkits;
import com.hypixel.hytale.logger.HytaleLogger; import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.server.core.plugin.JavaPlugin; import com.hypixel.hytale.server.core.plugin.JavaPlugin;
import com.hypixel.hytale.server.core.plugin.JavaPluginInit; import com.hypixel.hytale.server.core.plugin.JavaPluginInit;
import com.hypixel.hytale.server.core.util.Config;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
// Main plugin class. All Hytale Java plugins extend JavaPlugin.
public class TieredRepairKits extends JavaPlugin { public class TieredRepairKits extends JavaPlugin {
// Logger instance for writing messages to the server console/logs
public static final HytaleLogger LOGGER = HytaleLogger.forEnclosingClass(); public static final HytaleLogger LOGGER = HytaleLogger.forEnclosingClass();
// Manager class that will contain the logic related to repair kits
private RepairKitManager repairKitManager;
// Config wrapper provided by the Hytale server API.
// This links the config file name ("MyConfig") with the codec defined in TRKConfig.
private final Config<TRKConfig> config = this.withConfig("MyConfig", TRKConfig.CODEC);
// Public getter so other classes (like managers) can access the plugin config
public Config<TRKConfig> getConfig() {
return config;
}
// Constructor called by the Hytale server when the plugin is created
public TieredRepairKits(@Nonnull JavaPluginInit init) { public TieredRepairKits(@Nonnull JavaPluginInit init) {
super(init); super(init);
} }
// Called by the server when the plugin is being set up
@Override @Override
protected void setup() { protected void setup() {
// Register event listeners here - try using the "Hytale Devtools: Add new event listener" command
// Create the RepairKitManager and pass the plugin instance to it
// This allows the manager to access config, logger, etc.
repairKitManager = new RepairKitManager(this);
// Save the config file if it does not exist yet
// This ensures defaults from TRKConfig are written to disk
config.save();
} }
} }

View File

@@ -1,21 +1,22 @@
{ {
"Group": "QuickBASIC", "Group": "xyz.quickbasic",
"Name": "QuickBASIC.TieredRepairKits", "Name": "TieredRepairKits",
"Version": "1.0.1", "Version": "1.1.0",
"ServerVersion": "2026.03.26-89796e57b", "Description": "Repair Kits for each mineral tier that can keep or increase the maximum durability of items ",
"Description": "Balanced tiered Repair Kits that can increase the maximum durability of items", "Authors": [
"Authors": [ {
{ "Name": "QuickBASIC"
"Name": "QuickBASIC", }
"Email": "quickbasic@quickbasic.xyz", ],
"Url": "https://git.quickbasic.xyz/hytale-modding" "Website": "https://git.quickbasic.xyz/hytale-modding",
} "ServerVersion": "2026.03.20-db226053c",
], "Dependencies": {
"Website": "https://git.quickbasic.xyz/hytale-modding/TieredRepairKits",
"Dependencies": {}, },
"OptionalDependencies": {}, "OptionalDependencies": {
"LoadBefore": {},
"DisabledByDefault": false, },
"IncludesAssetPack": false, "DisabledByDefault": false,
"SubPlugins": [] "Main": "xyz.quickbasic.tieredrepairkits.TieredRepairKits",
} "IncludesAssetPack": true
}