tweaks724/src/main/java/eu/m724/tweaks/TweaksPlugin.java
Minecon724 740fab869e
Some checks failed
/ deploy (push) Failing after 1m5s
add license
2024-11-27 20:46:13 +01:00

83 lines
2.7 KiB
Java

/*
* Copyright (C) 2024 Minecon724
* Tweaks724 is licensed under the GNU General Public License. See the LICENSE.md file
* in the project root for the full license text.
*/
package eu.m724.tweaks;
import eu.m724.tweaks.chat.ChatCommands;
import eu.m724.tweaks.chat.ChatManager;
import eu.m724.tweaks.door.DoorManager;
import eu.m724.tweaks.motd.MotdListener;
import eu.m724.tweaks.ping.F3NameListener;
import eu.m724.tweaks.ping.PingChecker;
import eu.m724.tweaks.ping.PingCommands;
import eu.m724.tweaks.pomodoro.PomodoroCommands;
import eu.m724.tweaks.pomodoro.PomodoroManager;
import eu.m724.tweaks.updater.UpdaterManager;
import eu.m724.tweaks.worldborder.WorldBorderManager;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.IOException;
import java.util.Objects;
public class TweaksPlugin extends JavaPlugin {
@Override
public void onEnable() {
TweaksConfig config = TweaksConfig.load(this);
if (config.chatEnabled()) {
ChatManager chatManager = new ChatManager(this);
chatManager.init();
ChatCommands chatCommands = new ChatCommands(chatManager);
Objects.requireNonNull(getCommand("chat")).setExecutor(chatCommands);
Objects.requireNonNull(getCommand("chatmanage")).setExecutor(chatCommands);
}
if (config.doorEnabled()) {
new DoorManager().init(this);
}
if (config.brandEnabled()) {
new F3NameListener(this).init();
}
new PingChecker(this).init();
Objects.requireNonNull(getCommand("ping")).setExecutor(new PingCommands());
Objects.requireNonNull(getCommand("dkick")).setExecutor(new PingCommands());
/*if (getServer().getPluginManager().getPlugin("voicechat") != null) {
new MusicPlayer(this).init();
} else {
getLogger().warning("To use voice extensions, install \"Simple Voice Chat\"");
}*/
if (config.motdEnabled()) {
try {
new MotdListener(this).init();
} catch (IOException e) {
getLogger().severe("Failed to initialize MOTD extension");
throw new RuntimeException(e);
}
}
if (config.worldborderHide()) {
new WorldBorderManager().init(this);
}
if (config.pomodoroEnabled()) {
new PomodoroManager(this).init();
getCommand("pomodoro").setExecutor(new PomodoroCommands());
}
if (config.updaterEnabled()) {
try {
new UpdaterManager(this).init();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}