Skip to content

Commit

Permalink
fix: resolve elytras always unequipped by removing out-of-scope module
Browse files Browse the repository at this point in the history
Closes #725
  • Loading branch information
kernitus committed Oct 26, 2024
1 parent 556543f commit 07106e6
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ All contributions should be in the form of [pull requests](https://github.com/ke
OldCombatMechanics uses a modular system to make sure each feature is completely independent from any other, and can be toggled off and have no impact on server performance. This means each new module must extend the `Module` class, and implement a public constructor which takes an instance of the plugin and passes the module name to the superconstructor. The `Module` class also provides an overloadable `reload()` method which is called whenever the plugin is reloaded. If you are using any class-level variables they should probably be updated in here. This should also be used for any initialisation that might need to be done if the config section is changed and `ocm reload` is called. You may then call `reload()` from the constructor.

## Module naming
The name specified in the module constructor must be the same as the one used in the config.yml. The module name must meaningfully describe the purpose of the module, for example `disable-elytra` or `old-burn-delay`. The module classes should thus be respectively named `ModuleDisableElytra` and `ModuleOldBurnDelay`. As you can see, kebab case is used for the constructor and config name, while pascal case prefixed by `Module` is used for class names.
The name specified in the module constructor must be the same as the one used in the config.yml. The module name must meaningfully describe the purpose of the module, for example `disable-offhand` or `old-burn-delay`. The module classes should thus be respectively named `ModuleDisableOffhand` and `ModuleOldBurnDelay`. As you can see, kebab case is used for the constructor and config name, while pascal case prefixed by `Module` is used for class names.

## Module configuration
All module configuration is done through the Module class in a subsection of the config.yml for each module. To access config variables under the module section, you can use the methods provided by `module()`, such as `module().getBoolean("enableBlue")`. The module config section must contain an `enabled` boolean key which is used by the module system to selectively register/unregister the module, and, if applicable, a `worlds: []` list key to configure which worlds your module will work in. It is the responsibility of the module to use the `module().isEnabled(world)` to make sure this is enforced.
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ Features are grouped in `module`s as listed below, and can be individually confi
#### New feature disabling
- Item crafting
- Offhand
- Elytra
- Bow boost
- New attack sounds
- Enderpearl cooldown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ private void registerModules() {
ModuleLoader.addModule(new ModuleDisableCrafting(this));
ModuleLoader.addModule(new ModuleDisableOffHand(this));
ModuleLoader.addModule(new ModuleOldBrewingStand(this));
ModuleLoader.addModule(new ModuleDisableElytra(this));
ModuleLoader.addModule(new ModuleDisableProjectileRandomness(this));
ModuleLoader.addModule(new ModuleDisableBowBoost(this));
ModuleLoader.addModule(new ModuleProjectileKnockback(this));
Expand Down

This file was deleted.

6 changes: 1 addition & 5 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,6 @@ no-lapis-enchantments:
# Whether to only allow this for players with oldcombatmechanics.nolapis permission
usePermission: false

disable-elytra:
# Do not allow players to wear elytra
enabled: false

disable-enderpearl-cooldown:
# Disables enderpearl cooldown
enabled: true
Expand Down Expand Up @@ -580,4 +576,4 @@ debug:
enabled: false

# DO NOT CHANGE THIS NUMBER AS IT WILL RESET YOUR CONFIG
config-version: 65
config-version: 66

0 comments on commit 07106e6

Please sign in to comment.