Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Plugin: remove useless objects from modules
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFaser committed Nov 8, 2023
1 parent 2a9af95 commit fc9c9b6
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 85 deletions.
34 changes: 11 additions & 23 deletions src/main/java/net/flectone/chat/manager/FModuleManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,6 @@ public class FModuleManager {

private static final HashMap<Class<?>, FModule> F_MODULE_MAP = new HashMap<>();

private CommandsModule commandsModule;
private ExtraModule extraModule;
private PlayerModule playerModule;
private SoundsModule soundsModule;
private ServerModule serverModule;
private IntegrationsModule integrationsModule;
private ChatBubbleModule chatBubbleModule;
private AutoMessageModule autoMessageModule;
private ServerMessageModule serverMessageModule;
private PlayerMessageModule playerMessageModule;
private ColorModule colorModule;

public Collection<FModule> getModules() {
return F_MODULE_MAP.values();
}
Expand All @@ -45,17 +33,17 @@ public void put(FModule fModule) {
}

public void init() {
commandsModule = new CommandsModule("commands");
extraModule = new ExtraModule("extra");
playerModule = new PlayerModule("player");
soundsModule = new SoundsModule("sounds");
serverModule = new ServerModule("server");
integrationsModule = new IntegrationsModule("integrations");
chatBubbleModule = new ChatBubbleModule("chat-bubble");
autoMessageModule = new AutoMessageModule("auto-message");
serverMessageModule = new ServerMessageModule("server-message");
playerMessageModule = new PlayerMessageModule("player-message");
colorModule = new ColorModule("color");
new CommandsModule("commands");
new ExtraModule("extra");
new PlayerModule("player");
new SoundsModule("sounds");
new ServerModule("server");
new IntegrationsModule("integrations");
new ChatBubbleModule("chat-bubble");
new AutoMessageModule("auto-message");
new ServerMessageModule("server-message");
new PlayerMessageModule("player-message");
new ColorModule("color");

FActionManager.add(new FPlayerActionListener(null));
FActionManager.add(new MarkSpawnListener(null));
Expand Down
15 changes: 4 additions & 11 deletions src/main/java/net/flectone/chat/module/extra/ExtraModule.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
package net.flectone.chat.module.extra;

import lombok.Getter;
import net.flectone.chat.module.FModule;
import net.flectone.chat.module.extra.itemSign.ItemSignModule;
import net.flectone.chat.module.extra.knocking.KnockingModule;
import net.flectone.chat.module.extra.mark.MarkModule;
import net.flectone.chat.module.extra.spit.SpitModule;

@Getter
public class ExtraModule extends FModule {

private KnockingModule knockingModule;
private SpitModule spitModule;
private MarkModule markModule;
private ItemSignModule itemSignModule;

public ExtraModule(String name) {
super(name);
init();
Expand All @@ -25,9 +18,9 @@ public void init() {
if (!isEnabled()) return;
register();

knockingModule = new KnockingModule(this, "knocking");
spitModule = new SpitModule(this, "spit");
markModule = new MarkModule(this, "mark");
itemSignModule = new ItemSignModule(this, "item-sign");
new KnockingModule(this, "knocking");
new SpitModule(this, "spit");
new MarkModule(this, "mark");
new ItemSignModule(this, "item-sign");
}
}
21 changes: 6 additions & 15 deletions src/main/java/net/flectone/chat/module/player/PlayerModule.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.flectone.chat.module.player;

import lombok.Getter;
import net.flectone.chat.module.FModule;
import net.flectone.chat.module.player.afkTimeout.AfkTimeoutModule;
import net.flectone.chat.module.player.hover.HoverModule;
Expand All @@ -9,16 +8,8 @@
import net.flectone.chat.module.player.rightClick.RightClickModule;
import net.flectone.chat.module.player.world.WorldModule;

@Getter
public class PlayerModule extends FModule {

private NameTagModule nameTagModule;
private RightClickModule rightClickModule;
private HoverModule hoverModule;
private NameModule nameModule;
private WorldModule worldModule;
private AfkTimeoutModule afkTimeoutModule;

public PlayerModule(String name) {
super(name);
init();
Expand All @@ -29,11 +20,11 @@ public void init() {
if (!isEnabled()) return;
register();

nameTagModule = new NameTagModule(this, "name-tag");
rightClickModule = new RightClickModule(this, "right-click");
hoverModule = new HoverModule(this, "hover");
nameModule = new NameModule(this, "name");
worldModule = new WorldModule(this, "world");
afkTimeoutModule = new AfkTimeoutModule(this, "afk-timeout");
new NameTagModule(this, "name-tag");
new RightClickModule(this, "right-click");
new HoverModule(this, "hover");
new NameModule(this, "name");
new WorldModule(this, "world");
new AfkTimeoutModule(this, "afk-timeout");
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.flectone.chat.module.playerMessage;

import lombok.Getter;
import net.flectone.chat.module.FModule;
import net.flectone.chat.module.playerMessage.anvil.AnvilModule;
import net.flectone.chat.module.playerMessage.book.BookModule;
Expand All @@ -10,15 +9,7 @@
import net.flectone.chat.module.playerMessage.sign.SignModule;
import net.flectone.chat.module.playerMessage.swearProtection.SwearProtectionModule;

@Getter
public class PlayerMessageModule extends FModule {
private PatternsModule patternsModule;
private SwearProtectionModule swearProtectionModule;
private FormattingModule formattingModule;
private ChatModule chatModule;
private SignModule signModule;
private BookModule bookModule;
private AnvilModule anvilModule;

public PlayerMessageModule(String name) {
super(name);
Expand All @@ -30,12 +21,12 @@ public void init() {
if (!isEnabled()) return;
register();

patternsModule = new PatternsModule(this, "patterns");
swearProtectionModule = new SwearProtectionModule(this, "swear-protection");
formattingModule = new FormattingModule(this, "formatting");
chatModule = new ChatModule(this, "chat");
signModule = new SignModule(this, "sign");
bookModule = new BookModule(this, "book");
anvilModule = new AnvilModule(this, "anvil");
new PatternsModule(this, "patterns");
new SwearProtectionModule(this, "swear-protection");
new FormattingModule(this, "formatting");
new ChatModule(this, "chat");
new SignModule(this, "sign");
new BookModule(this, "book");
new AnvilModule(this, "anvil");
}
}
12 changes: 3 additions & 9 deletions src/main/java/net/flectone/chat/module/server/ServerModule.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
package net.flectone.chat.module.server;

import lombok.Getter;
import net.flectone.chat.module.FModule;
import net.flectone.chat.module.server.brand.BrandModule;
import net.flectone.chat.module.server.status.StatusModule;
import net.flectone.chat.module.server.tab.TabModule;

@Getter
public class ServerModule extends FModule {

private BrandModule brandModule;
private StatusModule statusModule;
private TabModule tabModule;

public ServerModule(String name) {
super(name);
init();
Expand All @@ -23,8 +17,8 @@ public void init() {
if (!isEnabled()) return;
register();

brandModule = new BrandModule(this, "brand");
statusModule = new StatusModule(this, "status");
tabModule = new TabModule(this, "tab");
new BrandModule(this, "brand");
new StatusModule(this, "status");
new TabModule(this, "tab");
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
package net.flectone.chat.module.serverMessage;

import lombok.Getter;
import net.flectone.chat.module.FModule;
import net.flectone.chat.module.serverMessage.advancement.AdvancementModule;
import net.flectone.chat.module.serverMessage.death.DeathModule;
import net.flectone.chat.module.serverMessage.join.JoinModule;
import net.flectone.chat.module.serverMessage.quit.QuitModule;

@Getter
public class ServerMessageModule extends FModule {

private JoinModule joinModule;
private QuitModule quitModule;
private AdvancementModule advancementModule;
private DeathModule deathModule;

public ServerMessageModule(String name) {
super(name);
init();
Expand All @@ -25,9 +18,9 @@ public void init() {
if (!isEnabled()) return;
register();

joinModule = new JoinModule(this, "join");
quitModule = new QuitModule(this, "quit");
advancementModule = new AdvancementModule(this, "advancement");
deathModule = new DeathModule(this, "death");
new JoinModule(this, "join");
new QuitModule(this, "quit");
new AdvancementModule(this, "advancement");
new DeathModule(this, "death");
}
}

0 comments on commit fc9c9b6

Please sign in to comment.