Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package io.github.hyscript7.ascendancy.api;

import org.bukkit.Bukkit;
import org.bukkit.plugin.ServicePriority;
import java.util.Optional;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.github.hyscript7.ascendancy.api.events;

import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

public class AscendancyDisabledEvent extends Event{
private static final HandlerList HANDLER_LIST = new HandlerList();

public static HandlerList getHandlerList() {
return HANDLER_LIST;
}

@Override
public HandlerList getHandlers() {
return HANDLER_LIST;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package io.github.hyscript7.ascendancy.api.events;

import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

import io.github.hyscript7.ascendancy.api.AscendancyAPI;

public class AscendancyEnabledEvent extends Event {

private static final HandlerList HANDLER_LIST = new HandlerList();
private final AscendancyAPI api;

public AscendancyEnabledEvent(AscendancyAPI api) {
this.api = api;
}

public AscendancyAPI getApi() {
return api;
}


public static HandlerList getHandlerList() {
return HANDLER_LIST;
}

@Override
public HandlerList getHandlers() {
return HANDLER_LIST;
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
package io.github.hyscript7.ascendancy;

import io.github.hyscript7.ascendancy.api.AscendancyAPI;
import io.github.hyscript7.ascendancy.api.events.AscendancyDisabledEvent;
import io.github.hyscript7.ascendancy.api.events.AscendancyEnabledEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.Bukkit;

public class AscendancyPlugin extends JavaPlugin {
@Override
public void onEnable() {
// All remaining code goes above enable event, event is called when plugin is completely ready
AscendancyAPI api = new AscendancyAPI(){

};
AscendancyAPI.set(api, this);
Bukkit.getPluginManager().callEvent(new AscendancyEnabledEvent(api));
}

@Override
public void onDisable() {
Bukkit.getPluginManager().callEvent(new AscendancyDisabledEvent());
// All remaining code goes under disable event, event is called when plugin starts shutting down
}
}