Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change all core config paths to use CorePath enums #39

Closed
Rumsfield opened this issue Jan 8, 2023 · 1 comment · Fixed by #49
Closed

Change all core config paths to use CorePath enums #39

Rumsfield opened this issue Jan 8, 2023 · 1 comment · Fixed by #49
Assignees
Labels
good first issue Good for newcomers optimize An improvement to existing code

Comments

@Rumsfield
Copy link
Owner

The hard-coded String paths must be replaced with their counterpart enums in CorePath. Throughout the code, core.yml options are fetched using this common approach:

refreshTimeSeconds = konquest.getConfigManager().getConfig("core").getLong("core.monuments.loot_refresh",(long)0.0);

Most major classes have a reference to the main Konquest instance, konquest, either directly or via a superclass method getKonquest(). Core.yml settings are loaded into memory on plugin enable, and are accessed via the ConfigManager class, which can access the core config. Because this is so common, there is a convenience method, Konquest#getCore().

So, there are two changes for every occurrence of this core config access:

  1. Replace konquest.getConfigManager().getConfig("core") with konquest.getCore().
  2. Replace the String path with its corresponding enum, e.g. "core.monuments.loot_refresh" with CorePath.MONUMENTS_LOOT_REFRESH.getPath().

Search for all occurrences of getConfigManager().getConfig("core") to find most of these areas. If any String paths do not have a matching CorePath enum, leave it alone and record its location in this issue.

@Rumsfield Rumsfield added good first issue Good for newcomers optimize An improvement to existing code labels Jan 8, 2023
@Rumsfield Rumsfield self-assigned this Jan 16, 2023
@Rumsfield
Copy link
Owner Author

I'm going to do this in branch #35.

Rumsfield added a commit that referenced this issue Apr 30, 2023
* Feature/35 kingdom rework (#44)

* Initial territory updates.

* Added initial properties files.

* Added config files and templates to sanctuaries.

* Updated template blanking timers in sanctuaries.

* Pre territory mods.

* Added territory manager.

* Updated kingdom methods from guilds.

* Added CorePath enums.

* Added kingdom payments.

* Added kingdom membership methods.

* Updated kingdom management, player assignment methods.

* Finished first cut of KingdomManager.

* Added relationship logic, fixed errors.

* Moved icon classes. Added reltaion roles.

* Added kingdom menu.

* Updated info menus, removed some guild classes.

* Added join and leave to town command.

* Updated kingdom assign exile logic.

* Updated admin command classes.

* Updated admin flag command.

* Updated existing admin commands.

* Updated admin commands.

* Updated list commands.

* Updated block listener.

* Updated entity listener.

* Updated inventory, hanging listeners.

* Updated all listeners.

* Updated version, 1.19.3 support.

* Fixed data file loads, saves.

* Misc fixes, manager clean up.

* Misc fixes.

* Updated API and JDBC lib.

* Added town management menu.

* Updated admin town command.

* Updated kingdom template refresh.

* Removed guild classes.

* Transferred to Gradle Kotlin DSL (#45)

* Transferred to gradle kotlin dsl
Move api & core to its own subproject
Implemented interface KonquestUpgradable.java and moved KonquestUpgrade to core

* Remove Icon from .gitignore due to causing icon folder not to be committed
Commit files in `com.github.rumsfield.konquest.display.icon`
Rename KonquestUpgrade to KonUpgrade
Rename KonquestUpgradable to KonquestUpgrade

* Core: Change archiveBaseName to use rootProject name
API: Change archiveBaseName to user rootProject followed by api

* Code cleanup (#46)

* Code cleanup
added final where necessary
removed public accessor on interface methods
grammar and spelling fixes
replaced comment `This could be null!!` with @org.jetbrains.annotations.NotNull
removed commented out code

* fix missing return in ClaimCommand.java

* revert switch back to if, to remain consistent in commands

* fixed invalid sending to player.

* Reverted symbols to unicode strings to fix build errors.

* Updated plugin details, fixed main path.

* Fixed NPE

* Replaced core config string paths with CorePath enum #39

* Updated travel command with sanctuary and flags.

* Implemented all flags but neutral.

* Added exception for breaking critical blocks.

* Added properties to ruins.

* Added town trade specialization.

* Play testing fixes.

* Added chest property.

* Fixed build errors.

* Added monument template cost and reset sub-command.

* Added template info menu.

* Added kingdom membership save, load, check.

* Kingdom master cannot give lord of capital.

* Condensed kingdom info menu icons.

* Play test fixes.

* Template, menu fixes.

* Playtest fixes.

* Playtest fixes: travel, nametag colors, membership notices.

* Minor playtest fixes, remove kingdom updates, villager interact.

* Added town menu.

* Added town management state menu.

* Updated menus to extend StateMenu.

* Update town command execution.

* Updated admin town command, fixed build errors.

* Updated display formats, icon indexes.

* Updated icon formats to be more uniform.

* Changed menu layouts, formats, include capitals.

* More menu polish.

* Playtest fixes, enhancements 3-4-23.

* Updated diplomacy logic

* Updated all colors from config

* Updated diplomacy types and logic

* Some more updates

* Added diplomacy lists to kingdom info menu

* Updated default colors

* Play test clean up

* Added kingdom diplomacy save and load

* Updated message paths

* Pruned unused message paths

* Added defense pact, kingdom directive, cleanup

* Added kingdom join condition checking

* Added more costs for shield and armor

* Updated royalty stats with kingdoms and conquests

* Added kingdom admin only config option

* Updated defaults, fixed error messaging

* Play test updates

* Updated API

* Fixed konquest trade api methods

* Updated config files, version update checks

* Updated spigot api to 1.19.4

* Play test improvements

* Fixed config archive and no version updates.

* Play test fixes, messages.

* Added checks, claim config options.

* Added help pages.

* Added help menu admin and tips.

* Play test updates, more fixes.

* Added legacy kingdom load.

* Play test fixes, polishing, messages.

* Play test message updates, bar titles.

* Updated API javadoc.

* Added sanctuary to dynmap handler.

* Admin command fixes.

* Near-final play test fixes, polishing.

* Updated hanging protections, boat usage.

* Added protection for all hangings.

* Updated respawn event handler to fix territory updates.

* Added respawn config option, highest priority.

* Updated depricated effect.

* Open testing fixes, dynmap, defaults, minor bugs.

* Added listener protections from open testing.

* Updated monument paste for sign, beacon, banner, and TNT explosions by non-enemies.

* Added friendly redstone town option.

* Open test fixes, tweaks.

* Updated travel wild to use sync task.

* Fixed pressure plates, monument loot placement.

* Updated admin permissions.

* Updated helpful messages when setting up kingdoms.

* Fixed help tip messages.

---------

Co-authored-by: TropicalShadow <52831503+TropicalShadow@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers optimize An improvement to existing code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant