no idea why i need to do this

This commit is contained in:
Telesphoreo 2022-03-04 18:05:41 -06:00
parent e617d94b8f
commit f61be8897e
2 changed files with 13 additions and 2 deletions

View file

@ -3,6 +3,7 @@ package dev.plex;
import dev.plex.listener.PlayerListener; import dev.plex.listener.PlayerListener;
import dev.plex.packet.PacketManager; import dev.plex.packet.PacketManager;
import dev.plex.packet.impl.*; import dev.plex.packet.impl.*;
import java.util.List;
import lombok.Getter; import lombok.Getter;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
@ -10,6 +11,7 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import net.minecraft.network.protocol.game.ClientboundUpdateMobEffectPacket; import net.minecraft.network.protocol.game.ClientboundUpdateMobEffectPacket;
import net.minecraft.network.protocol.game.ServerboundSetCreativeModeSlotPacket; import net.minecraft.network.protocol.game.ServerboundSetCreativeModeSlotPacket;
import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket; import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -40,12 +42,12 @@ public class Blackout extends JavaPlugin
plugin = this; plugin = this;
config = this.getConfig(); config = this.getConfig();
debugEnabled = config.getBoolean("debug"); debugEnabled = config.getBoolean("debug");
debug("Loading");
} }
@Override @Override
public void onEnable() public void onEnable()
{ {
loadConfig();
this.packetManager = new PacketManager(); this.packetManager = new PacketManager();
this.packetManager.registerListener(ServerboundUseItemOnPacket.class, new PaintingPatch()); this.packetManager.registerListener(ServerboundUseItemOnPacket.class, new PaintingPatch());
this.packetManager.registerListener(ServerboundUseItemOnPacket.class, new LecternPatch()); this.packetManager.registerListener(ServerboundUseItemOnPacket.class, new LecternPatch());
@ -54,4 +56,13 @@ public class Blackout extends JavaPlugin
this.packetManager.registerListener(ClientboundUpdateMobEffectPacket.class, new EndermanPotionPatch()); this.packetManager.registerListener(ClientboundUpdateMobEffectPacket.class, new EndermanPotionPatch());
this.getServer().getPluginManager().registerEvents(new PlayerListener(), this); this.getServer().getPluginManager().registerEvents(new PlayerListener(), this);
} }
private void loadConfig()
{
config.options().setHeader(List.of("Blackout Configuration"));
config.addDefault("debug", false);
config.options().copyDefaults(true);
saveConfig();
Bukkit.getLogger().info("Loaded configuration file");
}
} }

View file

@ -1,3 +1,3 @@
# Blackout configuration file # Blackout Configuration
debug: false debug: false