Files
src
build.gradle
settings.gradle
Code
8 339
src/main/java/com/example/rtp/RTPPlugin.java
package com.example.rtp;
import com.example.rtp.commands.MVTPCommand;
import com.example.rtp.commands.RTP4Command;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
public class RTPPlugin extends JavaPlugin {
private static RTPPlugin instance;
private String centerWorld;
private int centerX;
private int centerZ;
private int minRadius;
private int maxRadius;
private int cooldownSeconds;
private int warmupSeconds;
private int maxAttempts;
@Override
public void onEnable() {
instance = this;
saveDefaultConfig();
loadConfig();
getCommand("rtp4").setExecutor(new RTP4Command(this));
getCommand("mvtp").setExecutor(new MVTPCommand(this));
getLogger().info("RTPPlugin enabled.");
}
@Override
public void onDisable() {
getLogger().info("RTPPlugin disabled.");
}
public void loadConfig() {
reloadConfig();
FileConfiguration cfg = getConfig();
centerWorld = cfg.getString("rtp.center.world", "world");
centerX = cfg.getInt("rtp.center.x", 0);
centerZ = cfg.getInt("rtp.center.z", 0);
minRadius = cfg.getInt("rtp.min-radius", 500);
maxRadius = cfg.getInt("rtp.max-radius", 2000);
cooldownSeconds = cfg.getInt("rtp.cooldown-seconds", 60);
warmupSeconds = cfg.getInt("rtp.warmup-seconds", 5);
maxAttempts = cfg.getInt("rtp.max-attempts", 50);
}
public String message(String key) {
return getConfig().getString("messages." + key, "&cMessage not found: " + key);
}
public static RTPPlugin getInstance() {
return instance;
}
public String getCenterWorld() { return centerWorld; }
public int getCenterX() { return centerX; }
public int getCenterZ() { return centerZ; }
public int getMinRadius() { return minRadius; }
public int getMaxRadius() { return maxRadius; }
public int getCooldownSeconds() { return cooldownSeconds; }
public int getWarmupSeconds() { return warmupSeconds; }
public int getMaxAttempts() { return maxAttempts; }
}