Skip to content

Commit

Permalink
Fix menu system on Folia.
Browse files Browse the repository at this point in the history
  • Loading branch information
creatorfromhell committed Aug 4, 2024
1 parent fe89c89 commit dace112
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 6 deletions.
40 changes: 40 additions & 0 deletions Folia/src/net/tnemc/folia/FoliaCore.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package net.tnemc.folia;
/*
* The New Economy
* Copyright (C) 2022 - 2024 Daniel "creatorfromhell" Vidmar
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import net.tnemc.menu.folia.FoliaMenuHandler;
import net.tnemc.paper.PaperCore;
import org.bukkit.plugin.java.JavaPlugin;

/**
* FoliaCore
*
* @author creatorfromhell
* @since 0.1.3.2
*/
public class FoliaCore extends PaperCore {

public FoliaCore(JavaPlugin plugin) {
super(plugin);
}

@Override
public void registerMenuHandler() {
this.menuHandler = new FoliaMenuHandler(plugin, true);
}
}
3 changes: 2 additions & 1 deletion Folia/src/net/tnemc/folia/TNE.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

import net.tnemc.folia.impl.FoliaServerProvider;
import net.tnemc.menu.folia.FoliaMenuHandler;
import net.tnemc.paper.PaperPlugin;
import org.bukkit.plugin.java.JavaPlugin;

Expand All @@ -34,7 +35,7 @@ public class TNE extends JavaPlugin {

@Override
public void onLoad() {
this.paper.load(this, new FoliaServerProvider());
this.paper.load(this, new FoliaCore(this), new FoliaServerProvider());
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion PaperCore/src/net/tnemc/paper/PaperCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.tnemc.bukkit.depend.towny.TownyHandler;
import net.tnemc.core.TNECore;
import net.tnemc.core.api.callback.TNECallbacks;
import net.tnemc.menu.core.MenuHandler;
import net.tnemc.menu.paper.PaperMenuHandler;
import net.tnemc.paper.command.AdminCommand;
import net.tnemc.paper.command.ModuleCommand;
Expand All @@ -45,7 +46,7 @@
*/
public class PaperCore extends TNECore {

private final JavaPlugin plugin;
protected final JavaPlugin plugin;

private BukkitConfig bukkitConfig;

Expand Down
11 changes: 7 additions & 4 deletions PaperCore/src/net/tnemc/paper/PaperPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
import net.tnemc.bukkit.listeners.player.PlayerQuitListener;
import net.tnemc.bukkit.listeners.server.PluginEnableListener;
import net.tnemc.bukkit.listeners.world.WorldLoadListener;
import net.tnemc.core.TNECore;
import net.tnemc.core.api.callback.TNECallbackProvider;
import net.tnemc.core.io.message.BaseTranslationProvider;
import net.tnemc.item.paper.PaperCalculationsProvider;
import net.tnemc.menu.core.MenuHandler;
import net.tnemc.menu.paper.PaperMenuHandler;
import net.tnemc.paper.hook.economy.VaultHook;
import net.tnemc.paper.hook.economy.VaultUnlockedHook;
import net.tnemc.paper.hook.misc.PAPIHook;
Expand All @@ -50,21 +53,21 @@
public class PaperPlugin {

private PaperPluginCore pluginCore;
private PaperCore core;
private TNECore core;
private boolean papiHooked = false;

public void load(final JavaPlugin plugin) {
load(plugin, new PaperServerProvider(new PaperCalculationsProvider()));
load(plugin, new PaperCore(plugin), new PaperServerProvider(new PaperCalculationsProvider()));
}

/**
* Called when the plugin is loaded by the Bukkit plugin manager.
* This method should be used to initialize any necessary resources or data.
*/
public void load(final JavaPlugin plugin, ServerConnector provider) {
public void load(final JavaPlugin plugin, TNECore core, ServerConnector provider) {

//Initialize our TNE Core Class
this.core = new PaperCore(plugin);
this.core = core;
this.pluginCore = new PaperPluginCore(plugin, core, provider, new BaseTranslationProvider(), new TNECallbackProvider());

//Vault
Expand Down

0 comments on commit dace112

Please sign in to comment.