Files
godhood plugin
skyfall plugin
build.gradle
settings.gradle
Code
58 9,297
skyfall plugin/main/java/com/skyfall/SkyfallPlugin.java
package com.skyfall;
import com.skyfall.grimoire.GrimoireCommands;
import com.skyfall.grimoire.GrimoireListener;
import com.skyfall.grimoire.HelpingHands;
import com.skyfall.grimoire.HuntersHourGui;
import com.skyfall.grimoire.SpellManager;
import com.skyfall.items.DeterminationRecipe;
import com.skyfall.items.Items;
import com.skyfall.swordsman.SwordsmanCommands;
import com.skyfall.swordsman.SwordsmanListener;
import com.skyfall.swordsman.SwordsmanManager;
import com.skyfall.util.Cooldowns;
import com.skyfall.util.Keys;
import org.bukkit.command.PluginCommand;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
/**
* SkyfallGrimoire - the Swordsman's Determination and the Ancient Grimoire.
*/
public class SkyfallPlugin extends JavaPlugin {
private static SkyfallPlugin instance;
private Cooldowns cooldowns;
private SwordsmanManager swordsman;
private SpellManager spells;
private HelpingHands helpingHands;
private HuntersHourGui huntersHour;
private DeterminationRecipe recipe;
public static SkyfallPlugin get() {
return instance;
}
@Override
public void onEnable() {
instance = this;
saveDefaultConfig();
Keys.init(this);
cooldowns = new Cooldowns();
swordsman = new SwordsmanManager(this);
helpingHands = new HelpingHands(this);
huntersHour = new HuntersHourGui(this);
spells = new SpellManager(this);
recipe = new DeterminationRecipe(this);
register(new SwordsmanListener(this));
register(new GrimoireListener(this));
register(recipe);
register(helpingHands);
register(huntersHour);
SwordsmanCommands swordsmanCommands = new SwordsmanCommands(this);
bind("skyfall", swordsmanCommands);
bind("skyrise", swordsmanCommands);
GrimoireCommands grimoireCommands = new GrimoireCommands(this);
bind("grimoire", grimoireCommands);
bind("grimoirecast", grimoireCommands);
swordsman.start();
helpingHands.start();
getLogger().info("Skyfall enabled - the Swordsman in the Skies is waiting.");
}
@Override
public void onDisable() {
if (swordsman != null) {
swordsman.shutdown();
}
instance = null;
}
private void register(Listener listener) {
getServer().getPluginManager().registerEvents(listener, this);
}
private void bind(String name, TabExecutor executor) {
PluginCommand command = getCommand(name);
if (command == null) {
getLogger().warning("Command /" + name + " is missing from plugin.yml");
return;
}
command.setExecutor(executor);
command.setTabCompleter(executor);
}
/* ------------------------------------------------------------- accessors */
public Cooldowns skyfallCooldowns() {
return cooldowns;
}
public SwordsmanManager swordsman() {
return swordsman;
}
public SpellManager spells() {
return spells;
}
public HelpingHands helpingHands() {
return helpingHands;
}
public HuntersHourGui huntersHour() {
return huntersHour;
}
public DeterminationRecipe recipe() {
return recipe;
}
public String message(String path, String fallback) {
return getConfig().getString("messages." + path, fallback);
}
/**
* Public helper for other plugins: is this player protected by the Grimoire?
* (freezing / tick manipulation immunity)
*/
public boolean isWarded(Player player) {
return player != null && Items.isHoldingGrimoire(player);
}
}