Files
src
build.gradle
settings.gradle
Code
8 326
src/main/java/com/kodari/rapidcrossbow/RapidCrossbowPlugin.java
package com.kodari.rapidcrossbow;
import com.kodari.rapidcrossbow.command.GiveCrossbowCommand;
import com.kodari.rapidcrossbow.listener.RapidCrossbowListener;
import org.bukkit.NamespacedKey;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
public class RapidCrossbowPlugin extends JavaPlugin {
private NamespacedKey rapidCrossbowKey;
private NamespacedKey shotgunCrossbowKey;
private NamespacedKey shotgunArrowKey;
@Override
public void onEnable() {
saveDefaultConfig();
rapidCrossbowKey = new NamespacedKey(this, "rapid_crossbow");
shotgunCrossbowKey = new NamespacedKey(this, "shotgun_crossbow");
shotgunArrowKey = new NamespacedKey(this, "shotgun_arrow");
PluginCommand giveCrossbowCommand = getCommand("givec");
if (giveCrossbowCommand != null) {
giveCrossbowCommand.setExecutor(new GiveCrossbowCommand(this));
}
getServer().getPluginManager().registerEvents(new RapidCrossbowListener(this), this);
}
public NamespacedKey getRapidCrossbowKey() {
return rapidCrossbowKey;
}
public NamespacedKey getShotgunCrossbowKey() {
return shotgunCrossbowKey;
}
public NamespacedKey getShotgunArrowKey() {
return shotgunArrowKey;
}
public double getArrowSpeed() {
return Math.max(0.1D, getConfig().getDouble("crossbow.arrow-speed", 5.0D));
}
public int getFiringCooldownTicks() {
return Math.max(0, (int) Math.min(Integer.MAX_VALUE,
getConfig().getLong("crossbow.firing-cooldown-seconds", 1L) * 20L));
}
public int getShotgunProjectileCount() {
return Math.max(1, Math.min(1000, getConfig().getInt("shotgun.projectile-count", 100)));
}
public double getShotgunSpread() {
return Math.max(0.0D, getConfig().getDouble("shotgun.spread", 0.15D));
}
}