improve code quality and logic
- use sealed/non-sealed system for Advisory -> AbstractAdvisory - remove plugin field from module manager, as this was never used - bumped version number to 0.1.1-SNAPSHOT to indicate development
This commit is contained in:
5 files changed
+9
-8
No files matched your search
+1
-1
@@ -2,7 +2,7 @@
|
||||
name = Szlaban
|
||||
description = A multi-functional security plugin for keeping your server safe.
|
||||
website = https://github.com/PiotrWey/Szlaban
|
||||
version = 0.1
|
||||
version = 0.1.1-SNAPSHOT
|
||||
|
||||
# authorship
|
||||
authors = [ PiotrWey ]
|
||||
|
||||
@@ -38,7 +38,7 @@ public final class Szlaban extends JavaPlugin {
|
||||
private final EnumSet<Capability> capabilities;
|
||||
|
||||
public Szlaban() {
|
||||
this.moduleManager = new ModuleManager(this);
|
||||
this.moduleManager = new ModuleManager(/* this */);
|
||||
this.capabilities = EnumSet.noneOf(Capability.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ package dev.piotr_weychan.szlaban.advisor.advisory;
|
||||
|
||||
import net.kyori.adventure.text.ComponentLike;
|
||||
|
||||
public abstract class AbstractAdvisory implements Advisory {
|
||||
public abstract non-sealed class AbstractAdvisory implements Advisory {
|
||||
private final String name;
|
||||
private final ComponentLike description;
|
||||
private final ComponentLike reason;
|
||||
|
||||
@@ -10,7 +10,8 @@ package dev.piotr_weychan.szlaban.advisor.advisory;
|
||||
import net.kyori.adventure.text.ComponentLike;
|
||||
|
||||
|
||||
public interface Advisory {
|
||||
public sealed interface Advisory
|
||||
permits AbstractAdvisory {
|
||||
String getName();
|
||||
ComponentLike getDescription();
|
||||
ComponentLike getReason();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
package dev.piotr_weychan.szlaban.module;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
//import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
@@ -20,10 +20,10 @@ public final class ModuleManager {
|
||||
private final Map<String, Supplier<Module>> moduleSuppliers = new HashMap<>();
|
||||
private final Map<String, Module> modules = new HashMap<>();
|
||||
|
||||
private final JavaPlugin plugin;
|
||||
// private final JavaPlugin plugin;
|
||||
|
||||
public ModuleManager(JavaPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
public ModuleManager(/* JavaPlugin plugin */) {
|
||||
// this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user