SimpleHomes v2.0.0#5
Draft
Peashooter101 wants to merge 2 commits intomasterfrom
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SimpleHomes v2.0.0 Design Specifications
Overview
User facing design changes have been reflected on the README.md file, including permission reworks and configuration changes.
Anything that is less obvious or technical will be in this document.
Note
This is likely to change as decisions are made and this is refined.
Warning
We will be breaking things for this update to ultimately provide a more sensible experience in the long run. Although, part of the goal is to ensure that the only things we break is configuration / permission nodes that currently exist and we offer documentation to help Server Administrators swap over from v1.3.1 to v2.0.0.
There should be no technical aspect (SQL, Brigadier, etc) that breaks and requires manual fixing by Server Administrators.
Important
Sections marked with this Alert are parts where design is not fleshed out and needs additional review or consideration.
Brigadier
Commands are being moved to the Brigadier system.
Permissions are being reworked as commands are being moved around. Permissions can be viewed on the README.md.
homes.countwill be removed as a result of this update. We will utilize a similar system to SimpleChat, which utilizes a permission registration system on reload.simplehomes.count.<rank>.homes.count.bypasswill ignore whatever homes permission is applied.10,20,15>20.An example of this configuration would look something like:
There is also a configuration option that currently exists with a default number of homes. This will be kept in the event that no permission is specified.
Command Layout
The primary commands will be:
/home/home home
/home bed (if enabled)
or your only home if just one exists.
/home <home_name>/sethome <home_name>/delhome <home_name>/homes/homes admin/homes adminsubcommands./homes admin list <player>/homes admin tp <player> <home_name>/homes admin reload/homes admin import all <plugin>Imports all players' homes from another plugin.
/homes admin import <player> <plugin>Imports homes for a specific player from another plugin.
Command overrides with
-owill be kept on/sethomeand/homeallowing users to overwrite an existing home (/sethome) and teleport to a home that may fail it's safety checks (/home).Command Validation
Currently homes are not validated against any RegEx. Homes should be alphanumeric with underscores and dashes only.
This validation should only be applied when a home is being set.
Imported homes will contain a colon delimiter.
This setting is not configurable.
Home Routing Order
/homehas a default routing order. If a home is not specified:home.So for example...
home,bedhomehome,basehomebase,bedbasebase,farm,bedbedbase,farmnullSQL
Currently the SQL table is:
Propose to have it changed into
Because:
COLLATE NOCASEallows for comparisons to be done case-insensitive, including on insert and select without specifyingCOLLATE NOCASEin the query.COLLATE NOCASEonly works on ASCII only characters. Unicode will fail to be case-insensitive on this. Is this important?world_nameis not necessary. If a world gets deleted, assume that the home is invalid.world_nameis needed for any reason (like a message), generally retrieving the world fromworld_uuidwill yield the world alongside the name information.player_uuid + home_name(and consequentlyplayer_uuid) won't have performance impacts when searching on them since Primary Key creates the index.home_nameis not indexed on it's own so a separate index needs to be defined.world_uuid,x,y, andzare all marked asNOT NULLas well. These should never be null.yawandpitchshould never be null arguably but I am not sure that really matters. EnforceNOT NULLif there really isn't a reason they should be null so we don't insert invalid data, but we can still teleport when only given the world, x, y, and z.To do this:
There should be an additional table keeping track of the table version.
Table existence (for Version 1) can be checked using
Any subsequent version should check the version number which can be done with
This should always return a single row (or empty for version 1).
When migrating, drop the row and insert a new one with the new migration number.
Important
Do we want to add additional logging such as when migrations ran instead of just keeping the current version in there?
Bear in mind that these instructions are for SQLite. MySQL utilizes
utf8mb4_unicode_ciinstead of SQLite'sCOLLATE NOCASE.Homes Table Migration Strategy (v1 > v2)
Approach: Create > Copy > Drop > Rename
SQLite does not support dropping columns or redefining primary keys via
ALTER TABLE, so both backends use the same approach for consistency.Steps (run on startup if
schema_version= 1 or no version table exists):homestohomes_v1homestable with the v2 schema (composite PK,COLLATE NOCASE, noworld_name,NOT NULLconstraints, index)For MySQL, it is
INSERT IGNOREinstead ofINSERT OR IGNOREhomes_v1schema_versionto 2Edge Case: Case-Insensitive Duplicates
A player could have both
Homeandhomein v1, valid under the old schema, but a PK collision underCOLLATE NOCASE. Rather than skipping duplicates, conflicting homes are renamed by appending an incrementing number until a unique name is found (e.g.,home>home_1>home_2).Log every rename using the import-log format:
This ensures no homes are lost during migration.
Failure Handling
If any step fails mid-migration:
homes_v1still exists, so no data is losthomes_v1exists during startup, assume migration failed and reattempt migration, regardless of the state ofhomes.Existing Features
The following features will be kept, but the internal code / logic may change.
/home./sethomealready prevents you from oversetting homes./delhomeshould be allowed so you can delete homes to remove lockout.Migration
Overview
Migration from another plugin should not ultimately cause destruction to existing data.
Currently, it appears it may overwrite existing data if the plugin we are importing data from has the same home name.
Solution
We will use a special delimiter that generally would not be accepted by
/sethometo indicate the plugin name and home name, similar to how Essentials handles homes from another player.So for an Essentials home named jared, it may import into SimpleHomes with the name:
essentials:jared.This should prevent any data overwrite unless a home already exists in SimpleHomes with the name
essentials:jared, which would usually mean it was already imported prior and is likely the same data.This should also bypass any sethome limitations as it should only invoke the save homes directly (it does not need to go through any validation checks). There should be no corruption that happens even if a player is online.
Import Logging
Import logging should go to a .log file instead of to the console to allow for someone to go through the errors more concisely. Console spam would not be helpful. Logging should go to
./plugins/SimpleHomes/import-logs/{timestamp}{_player}{_plugin}.logwhere{_player}is populated if only a specific player was imported.Example file names are
2026-01-31_13-55-55_Peashooter101_Essentials.logand2026-01-31_13-55-55_Essentials.log.It should log every success and failure consistently at the start of a line. For example:
Import Logging Methodology
We should always import by player. So, we can retrieve all the homes of a player first that start with our plugin name.
This will simplify our search by allowing us to match names from the home names in a plugin.
If two names match, log it as skipped and move on.
Otherwise attempt import and log success or failure.
This will also have no negative impact on users who already have homes with a colon in the name as it will skip over those names that match, rather than overwriting it. Users who realize that imported homes they have were not imported can rename their homes and then contact a Server Admin to have their player specifically imported again.
Metrics
We should use both bStats and FastStats.
bStats allows for the general tracking of usage.
FastStats allows for reporting on errors.
Separation of Logic and Code Cleanup
Code needs to be separated based on their uses (ie: Home methods into a HomeHandler, Teleport methods in a TeleportHandler, etc).
We will follow coding standards as closely as we can to our CONTRIBUTING.md as well as from well established development projects such as SimpleNicks.