Skip to content

Commit

Permalink
Module -> OCMModule to avoid ambiguity
Browse files Browse the repository at this point in the history
  • Loading branch information
kernitus committed Apr 18, 2023
1 parent 925daec commit 5c45165
Show file tree
Hide file tree
Showing 33 changed files with 41 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
package kernitus.plugin.OldCombatMechanics;

import kernitus.plugin.OldCombatMechanics.module.Module;
import kernitus.plugin.OldCombatMechanics.module.OCMModule;
import kernitus.plugin.OldCombatMechanics.utilities.EventRegistry;
import kernitus.plugin.OldCombatMechanics.utilities.Messenger;

Expand All @@ -15,7 +15,7 @@
public class ModuleLoader {

private static EventRegistry eventRegistry;
private static List<Module> modules = new ArrayList<>();
private static List<OCMModule> modules = new ArrayList<>();

public static void initialise(OCMMain plugin) {
ModuleLoader.eventRegistry = new EventRegistry(plugin);
Expand All @@ -25,7 +25,7 @@ public static void toggleModules() {
modules.forEach(module -> setState(module, module.isEnabled()));
}

private static void setState(Module module, boolean state) {
private static void setState(OCMModule module, boolean state) {
if (state) {
if (eventRegistry.registerListener(module)) {
Messenger.debug("Enabled " + module.getClass().getSimpleName());
Expand All @@ -37,11 +37,11 @@ private static void setState(Module module, boolean state) {
}
}

public static void addModule(Module module) {
public static void addModule(OCMModule module) {
modules.add(module);
}

public static List<Module> getModules() {
public static List<OCMModule> getModules() {
return modules;
}
}
4 changes: 2 additions & 2 deletions src/main/java/kernitus/plugin/OldCombatMechanics/OCMMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ public void onEnable() {
new SimpleBarChart(
"enabled_modules",
() -> ModuleLoader.getModules().stream()
.filter(Module::isEnabled)
.collect(Collectors.toMap(Module::toString, module -> 1))
.filter(OCMModule::isEnabled)
.collect(Collectors.toMap(OCMModule::toString, module -> 1))
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* Disables the attack cooldown.
*/
public class ModuleAttackCooldown extends Module {
public class ModuleAttackCooldown extends OCMModule {

public ModuleAttackCooldown(OCMMain plugin) {
super(plugin, "disable-attack-cooldown");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;

public class ModuleAttackFrequency extends Module {
public class ModuleAttackFrequency extends OCMModule {

private static final int DEFAULT_DELAY = 20;
private static int playerDelay, mobDelay;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* A module to disable the new attack sounds.
*/
public class ModuleAttackSounds extends Module {
public class ModuleAttackSounds extends OCMModule {

private final SoundListener soundListener;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* A module to control chorus fruits.
*/
public class ModuleChorusFruit extends Module {
public class ModuleChorusFruit extends OCMModule {

public ModuleChorusFruit(OCMMain plugin) {
super(plugin, "chorus-fruit");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Prevents players from propelling themselves forward by shooting themselves.
*/
public class ModuleDisableBowBoost extends Module {
public class ModuleDisableBowBoost extends OCMModule {

public ModuleDisableBowBoost(OCMMain plugin) {
super(plugin, "disable-bow-boost");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/**
* Makes the specified materials uncraftable.
*/
public class ModuleDisableCrafting extends Module {
public class ModuleDisableCrafting extends OCMModule {

private List<Material> denied;
private String message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* Prevents players from equipping an elytra.
*/
public class ModuleDisableElytra extends Module {
public class ModuleDisableElytra extends OCMModule {

private static final int CHEST_SLOT = 38;
private static final int OFFHAND_SLOT = 40;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* Allows you to throw enderpearls as often as you like, not only after a cooldown.
*/
public class ModuleDisableEnderpearlCooldown extends Module {
public class ModuleDisableEnderpearlCooldown extends OCMModule {

/**
* Contains players that threw an ender pearl. As the handler calls launchProjectile,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/**
* Disables usage of the off hand.
*/
public class ModuleDisableOffHand extends Module {
public class ModuleDisableOffHand extends OCMModule {

private static final int OFFHAND_SLOT = 40;
private List<Material> materials = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Prevents the noise introduced when shooting with a bow to make arrows go straight.
*/
public class ModuleDisableProjectileRandomness extends Module {
public class ModuleDisableProjectileRandomness extends OCMModule {

private static double EPSILON;
// Method was added in 1.14.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* Brings back the old fishing-rod knockback.
*/
public class ModuleFishingKnockback extends Module {
public class ModuleFishingKnockback extends OCMModule {

private final SpigotFunctionChooser<PlayerFishEvent, Object, Entity> getHookFunction;
private final SpigotFunctionChooser<ProjectileHitEvent, Object, Entity> getHitEntityFunction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Fishing rod gravity in 1.14+ is 0.03 while in 1.8 it is 0.04
* Launch velocity in 1.9+ is also different from the 1.8 formula
*/
public class ModuleFishingRodVelocity extends Module {
public class ModuleFishingRodVelocity extends OCMModule {

private Random random;
private boolean hasDifferentGravity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
/**
* Customise the golden apple effects.
*/
public class ModuleGoldenApple extends Module {
public class ModuleGoldenApple extends OCMModule {

private List<PotionEffect> enchantedGoldenAppleEffects, goldenAppleEffects;
private ShapedRecipe enchantedAppleRecipe;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* Allows enchanting without needing lapis.
*/
public class ModuleNoLapisEnchantments extends Module {
public class ModuleNoLapisEnchantments extends OCMModule {

private VersionedMaterial lapisLazuli;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.*;
import java.util.stream.Collectors;

public class ModuleOldArmourDurability extends Module {
public class ModuleOldArmourDurability extends OCMModule {

private final Map<UUID, List<ItemStack>> explosionDamaged = new WeakHashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* It is based on <a href="https://minecraft.gamepedia.com/index.php?title=Armor&oldid=909187">this revision</a>
* of the minecraft wiki.
*/
public class ModuleOldArmourStrength extends Module {
public class ModuleOldArmourStrength extends OCMModule {
// Defence order is armour defence points -> resistance -> armour enchants -> absorption

public ModuleOldArmourStrength(OCMMain plugin) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* Makes brewing stands not require fuel.
*/
public class ModuleOldBrewingStand extends Module {
public class ModuleOldBrewingStand extends OCMModule {

public ModuleOldBrewingStand(OCMMain plugin) {
super(plugin, "old-brewing-stand");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* Bring back old fire burning delay behaviour
*/
public class ModuleOldBurnDelay extends Module {
public class ModuleOldBurnDelay extends OCMModule {

private int fireTicks;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import kernitus.plugin.OldCombatMechanics.utilities.damage.OCMEntityDamageByEntityEvent;
import org.bukkit.event.EventHandler;

public class ModuleOldCriticalHits extends Module {
public class ModuleOldCriticalHits extends OCMModule {

public ModuleOldCriticalHits(OCMMain plugin) {
super(plugin, "old-critical-hits");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
/**
* Allows configurable potion effect durations.
*/
public class ModuleOldPotionEffects extends Module {
public class ModuleOldPotionEffects extends OCMModule {
private static final Set<PotionType> EXCLUDED_POTION_TYPES = EnumSet.of(
// This only includes 1.9 potions, others are added later for compatibility
// Instant potions have no duration that can be modified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* Restores old tool damage.
*/
public class ModuleOldToolDamage extends Module {
public class ModuleOldToolDamage extends OCMModule {

private static final String[] WEAPONS = {"sword", "axe", "pickaxe", "spade", "shovel", "hoe"};
private boolean oldSharpness;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/**
* Disables player collisions.
*/
public class ModulePlayerCollisions extends Module {
public class ModulePlayerCollisions extends OCMModule {

private final CollisionPacketListener collisionPacketListener;
private final Map<Player, TeamPacket> playerTeamMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* Reverts knockback formula to 1.8.
* Also disables netherite knockback resistance.
*/
public class ModulePlayerKnockback extends Module {
public class ModulePlayerKnockback extends OCMModule {

private double knockbackHorizontal;
private double knockbackVertical;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* Establishes custom health regeneration rules.
* Default values based on 1.8 from <a href="https://minecraft.gamepedia.com/Hunger?oldid=948685">wiki</a>
*/
public class ModulePlayerRegen extends Module {
public class ModulePlayerRegen extends OCMModule {

private final Map<UUID, Long> healTimes = new WeakHashMap<>();
private boolean spartanInstalled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Adds knockback to eggs, snowballs and ender pearls.
*/
public class ModuleProjectileKnockback extends Module {
public class ModuleProjectileKnockback extends OCMModule {

public ModuleProjectileKnockback(OCMMain plugin) {
super(plugin, "projectile-knockback");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* Allows customising the shield damage reduction percentages.
*/
public class ModuleShieldDamageReduction extends Module {
public class ModuleShieldDamageReduction extends OCMModule {

private int genericDamageReductionAmount, genericDamageReductionPercentage, projectileDamageReductionAmount, projectileDamageReductionPercentage;
private final Map<UUID, List<ItemStack>> fullyBlocked = new WeakHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import java.util.*;

public class ModuleSwordBlocking extends Module {
public class ModuleSwordBlocking extends OCMModule {

private static final ItemStack SHIELD = new ItemStack(Material.SHIELD);
// Not using WeakHashMaps here for reliability
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/**
* A module to disable the sweep attack.
*/
public class ModuleSwordSweep extends Module {
public class ModuleSwordSweep extends OCMModule {

private final List<Location> sweepLocations = new ArrayList<>();
private final ParticleListener particleListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* A module providing some specific functionality, e.g. restoring fishing rod knockback.
*/
public abstract class Module implements Listener {
public abstract class OCMModule implements Listener {

protected OCMMain plugin;

Expand All @@ -32,7 +32,7 @@ public abstract class Module implements Listener {
* @param plugin the plugin instance
* @param configName the name of the module in the config
*/
protected Module(OCMMain plugin, String configName){
protected OCMModule(OCMMain plugin, String configName){
this.plugin = plugin;
this.configName = configName;
this.moduleName = getClass().getSimpleName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import kernitus.plugin.OldCombatMechanics.OCMMain;
import kernitus.plugin.OldCombatMechanics.UpdateChecker;
import kernitus.plugin.OldCombatMechanics.module.Module;
import kernitus.plugin.OldCombatMechanics.module.OCMModule;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand All @@ -16,7 +16,7 @@

import java.io.File;

public class ModuleUpdateChecker extends Module {
public class ModuleUpdateChecker extends OCMModule {
private final File pluginFile;

public ModuleUpdateChecker(OCMMain plugin, File pluginFile){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package kernitus.plugin.OldCombatMechanics.utilities.damage;

import kernitus.plugin.OldCombatMechanics.OCMMain;
import kernitus.plugin.OldCombatMechanics.module.Module;
import kernitus.plugin.OldCombatMechanics.module.OCMModule;
import kernitus.plugin.OldCombatMechanics.utilities.Messenger;
import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
Expand All @@ -20,7 +20,7 @@
import java.util.UUID;
import java.util.WeakHashMap;

public class EntityDamageByEntityListener extends Module {
public class EntityDamageByEntityListener extends OCMModule {

private static EntityDamageByEntityListener INSTANCE;
private boolean enabled;
Expand Down

0 comments on commit 5c45165

Please sign in to comment.