Skip to content

Commit

Permalink
Fix PAPIExpansion + Bump to 3.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Intybyte committed Dec 4, 2024
1 parent fdf0628 commit 4ebd17f
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import at.pavlov.cannons.container.ItemHolder;
import at.pavlov.cannons.dao.PersistenceDatabase;
import at.pavlov.cannons.hooks.movecraft.MovecraftHook;
import at.pavlov.cannons.hooks.PlaceholderAPIHook;
import at.pavlov.cannons.hooks.papi.PlaceholderAPIHook;
import at.pavlov.cannons.hooks.VaultHook;
import at.pavlov.cannons.hooks.movecraft.type.MaxCannonsProperty;
import at.pavlov.cannons.hooks.movecraftcombat.MovecraftCombatHook;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import at.pavlov.cannons.hooks.movecraft.listener.CraftDetectListener;
import at.pavlov.cannons.hooks.movecraft.listener.RotationListener;
import at.pavlov.cannons.hooks.movecraft.listener.TranslationListener;
import at.pavlov.cannons.hooks.movecraft.type.MaxCannonsProperty;
import at.pavlov.internal.Hook;
import net.countercraft.movecraft.Movecraft;
import org.bukkit.ChatColor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,51 +1,18 @@
package at.pavlov.cannons.hooks;
package at.pavlov.cannons.hooks.papi;

import at.pavlov.cannons.Cannons;
import at.pavlov.cannons.container.ItemHolder;
import at.pavlov.internal.Hook;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;

import java.util.Locale;

public class PlaceholderAPIHook extends PlaceholderExpansion implements Hook<Void> {
public class CannonsPAPIExpansion extends PlaceholderExpansion {
private final Cannons plugin;
private boolean working = false;

public PlaceholderAPIHook(Cannons plugin) {
this.plugin = plugin;
}

@Override
public Void hook() {
return null;
}

@Override
public void onEnable() {
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
this.register();
working = true;
plugin.logInfo(ChatColor.GREEN + enabledMessage());
}
}

@Override
public void onDisable() {

}

@Override
public boolean active() {
return working;
}

@Override
public Class<? extends Hook<?>> getTypeClass() {
return PlaceholderAPIHook.class;
public CannonsPAPIExpansion(Cannons cannons) {
this.plugin = cannons;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package at.pavlov.cannons.hooks.papi;

import at.pavlov.cannons.Cannons;
import at.pavlov.cannons.hooks.BukkitHook;
import at.pavlov.internal.Hook;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;

public class PlaceholderAPIHook extends BukkitHook<Void> {
private boolean working = false;

public PlaceholderAPIHook(Cannons plugin) {
super(plugin);
}

@Override
public Void hook() {
return null;
}

@Override
public void onEnable() {
if (!Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
return;
}

new CannonsPAPIExpansion(plugin).register();
working = true;
plugin.logInfo(ChatColor.GREEN + enabledMessage());
}

@Override
public void onDisable() {

}

@Override
public boolean active() {
return working;
}

@Override
public Class<? extends Hook<?>> getTypeClass() {
return PlaceholderAPIHook.class;
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>

<properties>
<cannon.version>3.1.2</cannon.version>
<cannon.version>3.2.1</cannon.version>
<java.target>17</java.target>
<java.source>17</java.source>
</properties>
Expand Down

0 comments on commit 4ebd17f

Please sign in to comment.