Files
src
build.gradle
Code
11 1,083
src/main/java/com/kodari/planes/PlanePlugin.java
package com.kodari.planes;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class PlanePlugin extends JavaPlugin {
@Getter private static PlanePlugin instance;
@Getter private PlaneManager planeManager;
@Getter private PlaneMenuGUI planeMenuGUI;
@Getter private final Map<UUID, Boolean> forwardInput = new HashMap<>();
@Getter private boolean paperInputAvailable = false;
@Override
public void onEnable() {
instance = this;
planeManager = new PlaneManager(this);
planeMenuGUI = new PlaneMenuGUI(this);
getServer().getPluginManager().registerEvents(new PlaneListener(this), this);
getServer().getPluginManager().registerEvents(planeMenuGUI, this);
getCommand("plane").setExecutor(new PlaneCommand(this));
try {
Class.forName("io.papermc.paper.event.player.PlayerInputEvent");
new PlaneInputListener(this).register(this);
paperInputAvailable = true;
getLogger().info("Paper input detection enabled — W key controls flight.");
} catch (ClassNotFoundException ignored) {
getLogger().info("Paper input unavailable — plane moves automatically while piloted.");
}
new PlaneMovementTask(this).runTaskTimer(this, 0L, 1L);
getLogger().info("PlanesPlugin enabled.");
}
@Override
public void onDisable() {
if (planeManager != null) {
planeManager.removeAllPlanes();
}
}
}