mirror of
https://github.com/HibiscusMC/HibiscusCommons.git
synced 2025-12-28 19:39:26 +00:00
feat: move HMCC nms methods to Hibiscus Commons
This commit is contained in:
@@ -17,6 +17,12 @@ public final class HibiscusCommonsPlugin extends HibiscusPlugin {
|
||||
public void onStart() {
|
||||
instance = this;
|
||||
|
||||
if (!NMSHandlers.isVersionSupported()) {
|
||||
getLogger().severe("This version is not supported! Consider switching versions?");
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
// Detects if a user is running a paper server
|
||||
if (ServerUtils.hasClass("com.destroystokyo.paper.PaperConfig") || ServerUtils.hasClass("io.papermc.paper.configuration.Configuration")) {
|
||||
onPaper = true;
|
||||
@@ -24,12 +30,6 @@ public final class HibiscusCommonsPlugin extends HibiscusPlugin {
|
||||
//getServer().getPluginManager().registerEvents(new PaperPlayerGameListener(), this);
|
||||
}
|
||||
|
||||
if (!NMSHandlers.isVersionSupported()) {
|
||||
getLogger().severe("This version is not supported! Consider switching versions?");
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
// Plugin startup logic
|
||||
Hooks.setup();
|
||||
|
||||
|
||||
@@ -3,7 +3,10 @@ package me.lojosho.hibiscuscommons;
|
||||
import com.jeff_media.updatechecker.UpdateCheckSource;
|
||||
import com.jeff_media.updatechecker.UpdateChecker;
|
||||
import lombok.Getter;
|
||||
import me.lojosho.hibiscuscommons.nms.NMSHandlers;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public abstract class HibiscusPlugin extends JavaPlugin {
|
||||
@@ -36,6 +39,15 @@ public abstract class HibiscusPlugin extends JavaPlugin {
|
||||
public final void onEnable() {
|
||||
super.onEnable();
|
||||
|
||||
Plugin hibiscusCommons = Bukkit.getPluginManager().getPlugin("HibiscusCommons");
|
||||
if (hibiscusCommons == null || !hibiscusCommons.isEnabled()) {
|
||||
getLogger().severe("");
|
||||
getLogger().severe("HibiscusCommons is required to be enabled to run this plugin!");
|
||||
getLogger().severe("");
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (bstats > 0) {
|
||||
Metrics metrics = new Metrics(this, bstats);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
package me.lojosho.hibiscuscommons.nms;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public interface NMSHandler {
|
||||
|
||||
@@ -8,6 +14,29 @@ public interface NMSHandler {
|
||||
|
||||
Entity getEntity(int entityId);
|
||||
|
||||
void slotUpdate(
|
||||
Player player,
|
||||
int slot
|
||||
);
|
||||
|
||||
void equipmentSlotUpdate(
|
||||
int entityId,
|
||||
org.bukkit.inventory.EquipmentSlot slot,
|
||||
ItemStack item,
|
||||
List<Player> sendTo
|
||||
);
|
||||
|
||||
void equipmentSlotUpdate(
|
||||
int entityId,
|
||||
HashMap<EquipmentSlot, ItemStack> equipment,
|
||||
List<Player> sendTo
|
||||
);
|
||||
|
||||
void hideNPCName(
|
||||
Player player,
|
||||
String NPCName
|
||||
);
|
||||
|
||||
default boolean getSupported () {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user