extras/src/main/java/pw/kaboom/extras/Main.java

111 lines
5.2 KiB
Java
Raw Normal View History

2018-04-24 16:47:51 +00:00
package pw.kaboom.extras;
2019-07-24 01:50:19 +00:00
import java.util.Collections;
2018-05-04 13:59:39 +00:00
2021-10-23 00:51:21 +00:00
import org.bukkit.WorldCreator;
import org.bukkit.WorldType;
2020-02-27 15:08:10 +00:00
import org.bukkit.block.BlockFace;
import org.bukkit.plugin.java.JavaPlugin;
import pw.kaboom.extras.commands.CommandBroadcastVanilla;
import pw.kaboom.extras.commands.CommandClearChat;
import pw.kaboom.extras.commands.CommandConsole;
import pw.kaboom.extras.commands.CommandDestroyEntities;
import pw.kaboom.extras.commands.CommandEnchantAll;
import pw.kaboom.extras.commands.CommandJumpscare;
import pw.kaboom.extras.commands.CommandKaboom;
import pw.kaboom.extras.commands.CommandPing;
2020-02-27 15:08:10 +00:00
import pw.kaboom.extras.commands.CommandPrefix;
import pw.kaboom.extras.commands.CommandPumpkin;
import pw.kaboom.extras.commands.CommandServerInfo;
import pw.kaboom.extras.commands.CommandSkin;
import pw.kaboom.extras.commands.CommandSpawn;
import pw.kaboom.extras.commands.CommandSpidey;
import pw.kaboom.extras.commands.CommandTellraw;
import pw.kaboom.extras.commands.CommandUsername;
2019-12-17 18:23:24 +00:00
import pw.kaboom.extras.modules.block.BlockCheck;
import pw.kaboom.extras.modules.block.BlockPhysics;
import pw.kaboom.extras.modules.entity.EntityExplosion;
import pw.kaboom.extras.modules.entity.EntityKnockback;
import pw.kaboom.extras.modules.entity.EntitySpawn;
import pw.kaboom.extras.modules.entity.EntityTeleport;
import pw.kaboom.extras.modules.player.PlayerChat;
import pw.kaboom.extras.modules.player.PlayerCommand;
import pw.kaboom.extras.modules.player.PlayerConnection;
import pw.kaboom.extras.modules.player.PlayerDamage;
import pw.kaboom.extras.modules.player.PlayerInteract;
import pw.kaboom.extras.modules.player.PlayerRecipe;
2019-12-17 18:23:24 +00:00
import pw.kaboom.extras.modules.player.PlayerTeleport;
import pw.kaboom.extras.modules.server.ServerCommand;
import pw.kaboom.extras.modules.server.ServerTabComplete;
import pw.kaboom.extras.modules.server.ServerTick;
2019-12-21 14:12:26 +00:00
public final class Main extends JavaPlugin {
2022-05-20 02:35:48 +00:00
@Override
public void onLoad() {
/* Fill lists */
Collections.addAll(
BlockPhysics.getBlockFaces(),
BlockFace.NORTH,
BlockFace.SOUTH,
BlockFace.WEST,
BlockFace.EAST,
BlockFace.UP
);
2019-12-14 21:31:28 +00:00
2022-05-20 02:35:48 +00:00
/* Load missing config.yml defaults */
getConfig().options().copyDefaults(true);
saveConfig();
}
2018-12-19 20:10:03 +00:00
2022-05-20 02:35:48 +00:00
@Override
public void onEnable() {
/* Commands */
this.getCommand("broadcastvanilla").setExecutor(new CommandBroadcastVanilla());
this.getCommand("clearchat").setExecutor(new CommandClearChat());
this.getCommand("console").setExecutor(new CommandConsole());
this.getCommand("destroyentities").setExecutor(new CommandDestroyEntities());
this.getCommand("enchantall").setExecutor(new CommandEnchantAll());
this.getCommand("jumpscare").setExecutor(new CommandJumpscare());
this.getCommand("kaboom").setExecutor(new CommandKaboom());
this.getCommand("ping").setExecutor(new CommandPing());
this.getCommand("prefix").setExecutor(new CommandPrefix());
this.getCommand("pumpkin").setExecutor(new CommandPumpkin());
this.getCommand("serverinfo").setExecutor(new CommandServerInfo());
this.getCommand("skin").setExecutor(new CommandSkin());
this.getCommand("spawn").setExecutor(new CommandSpawn());
this.getCommand("spidey").setExecutor(new CommandSpidey());
this.getCommand("tellraw").setExecutor(new CommandTellraw());
this.getCommand("username").setExecutor(new CommandUsername());
2018-04-24 16:47:51 +00:00
2022-05-20 02:35:48 +00:00
/* Block-related modules */
this.getServer().getPluginManager().registerEvents(new BlockCheck(), this);
this.getServer().getPluginManager().registerEvents(new BlockPhysics(), this);
2019-07-30 17:14:24 +00:00
2022-05-20 02:35:48 +00:00
/* Entity-related modules */
this.getServer().getPluginManager().registerEvents(new EntityExplosion(), this);
this.getServer().getPluginManager().registerEvents(new EntityKnockback(), this);
this.getServer().getPluginManager().registerEvents(new EntitySpawn(), this);
this.getServer().getPluginManager().registerEvents(new EntityTeleport(), this);
2019-07-30 17:14:24 +00:00
2022-05-20 02:35:48 +00:00
/* Player-related modules */
this.getServer().getPluginManager().registerEvents(new PlayerChat(), this);
this.getServer().getPluginManager().registerEvents(new PlayerCommand(), this);
this.getServer().getPluginManager().registerEvents(new PlayerConnection(), this);
this.getServer().getPluginManager().registerEvents(new PlayerDamage(), this);
this.getServer().getPluginManager().registerEvents(new PlayerInteract(), this);
this.getServer().getPluginManager().registerEvents(new PlayerRecipe(), this);
this.getServer().getPluginManager().registerEvents(new PlayerTeleport(), this);
2019-07-30 17:14:24 +00:00
2022-05-20 02:35:48 +00:00
/* Server-related modules */
this.getServer().getPluginManager().registerEvents(new ServerCommand(), this);
this.getServer().getPluginManager().registerEvents(new ServerTabComplete(), this);
this.getServer().getPluginManager().registerEvents(new ServerTick(), this);
2021-10-23 00:51:21 +00:00
2022-05-20 02:35:48 +00:00
/* Custom worlds */
this.getServer().createWorld(
new WorldCreator("world_flatlands").generateStructures(false).type(WorldType.FLAT)
);
}
2018-04-24 16:47:51 +00:00
}