修复了在没有papi的情况下无法加载插件的bug
All checks were successful
Java CI-CD with Maven / build (push) Successful in 28m39s
All checks were successful
Java CI-CD with Maven / build (push) Successful in 28m39s
This commit is contained in:
parent
706ea9a5a5
commit
fc5f167587
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>cn.lunadeer</groupId>
|
<groupId>cn.lunadeer</groupId>
|
||||||
<artifactId>MiniPlayerTitle</artifactId>
|
<artifactId>MiniPlayerTitle</artifactId>
|
||||||
<version>4.2.2</version>
|
<version>4.2.3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>MiniPlayerTitle</name>
|
<name>MiniPlayerTitle</name>
|
||||||
|
@ -10,7 +10,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
import static cn.lunadeer.miniplayertitle.Expansion.isPapi;
|
import static cn.lunadeer.miniplayertitle.MiniPlayerTitle.usingPapi;
|
||||||
import static cn.lunadeer.miniplayertitle.commands.Apis.updateName;
|
import static cn.lunadeer.miniplayertitle.commands.Apis.updateName;
|
||||||
|
|
||||||
public class Events implements Listener {
|
public class Events implements Listener {
|
||||||
@ -39,7 +39,7 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerSendChat(AsyncChatEvent event) {
|
public void onPlayerSendChat(AsyncChatEvent event) {
|
||||||
if (isPapi()) {
|
if (usingPapi()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Component nameComponent = event.getPlayer().displayName();
|
Component nameComponent = event.getPlayer().displayName();
|
||||||
|
@ -5,12 +5,13 @@ import cn.lunadeer.miniplayertitle.dtos.PlayerInfoDTO;
|
|||||||
import cn.lunadeer.miniplayertitle.dtos.PlayerTitleDTO;
|
import cn.lunadeer.miniplayertitle.dtos.PlayerTitleDTO;
|
||||||
import cn.lunadeer.miniplayertitle.dtos.TitleDTO;
|
import cn.lunadeer.miniplayertitle.dtos.TitleDTO;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import static cn.lunadeer.miniplayertitle.MiniPlayerTitle.usingPapi;
|
||||||
|
|
||||||
public class Expansion extends PlaceholderExpansion {
|
public class Expansion extends PlaceholderExpansion {
|
||||||
|
|
||||||
private final JavaPlugin plugin;
|
private final JavaPlugin plugin;
|
||||||
@ -19,7 +20,7 @@ public class Expansion extends PlaceholderExpansion {
|
|||||||
|
|
||||||
public Expansion(JavaPlugin plugin) {
|
public Expansion(JavaPlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
if (isPapi()) {
|
if (usingPapi()) {
|
||||||
XLogger.info("PlaceholderAPI is enabled, registering expansion...");
|
XLogger.info("PlaceholderAPI is enabled, registering expansion...");
|
||||||
this.register();
|
this.register();
|
||||||
} else {
|
} else {
|
||||||
@ -65,8 +66,4 @@ public class Expansion extends PlaceholderExpansion {
|
|||||||
public @NotNull String getVersion() {
|
public @NotNull String getVersion() {
|
||||||
return plugin.getPluginMeta().getVersion();
|
return plugin.getPluginMeta().getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPapi() {
|
|
||||||
return Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,9 @@ public final class MiniPlayerTitle extends JavaPlugin {
|
|||||||
new VaultConnect(this);
|
new VaultConnect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (usingPapi()) {
|
||||||
new Expansion(this);
|
new Expansion(this);
|
||||||
|
}
|
||||||
|
|
||||||
Bukkit.getPluginManager().registerEvents(new Events(), this);
|
Bukkit.getPluginManager().registerEvents(new Events(), this);
|
||||||
Objects.requireNonNull(Bukkit.getPluginCommand("MiniPlayerTitle")).setExecutor(new Commands());
|
Objects.requireNonNull(Bukkit.getPluginCommand("MiniPlayerTitle")).setExecutor(new Commands());
|
||||||
@ -69,4 +71,8 @@ public final class MiniPlayerTitle extends JavaPlugin {
|
|||||||
public static ConfigManager config;
|
public static ConfigManager config;
|
||||||
public static DatabaseManager database;
|
public static DatabaseManager database;
|
||||||
private GiteaReleaseCheck giteaReleaseCheck;
|
private GiteaReleaseCheck giteaReleaseCheck;
|
||||||
|
|
||||||
|
public static boolean usingPapi() {
|
||||||
|
return Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,8 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import static cn.lunadeer.miniplayertitle.Expansion.isPapi;
|
import static cn.lunadeer.miniplayertitle.MiniPlayerTitle.usingPapi;
|
||||||
|
|
||||||
|
|
||||||
public class Apis {
|
public class Apis {
|
||||||
public static boolean notOpOrConsole(CommandSender sender) {
|
public static boolean notOpOrConsole(CommandSender sender) {
|
||||||
@ -23,7 +24,7 @@ public class Apis {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void updateName(Player player, @Nullable TitleDTO title) {
|
public static void updateName(Player player, @Nullable TitleDTO title) {
|
||||||
if (isPapi()) {
|
if (usingPapi()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (title == null || title.getId() == -1) {
|
if (title == null || title.getId() == -1) {
|
||||||
|
@ -6,7 +6,6 @@ import cn.lunadeer.miniplayertitle.MiniPlayerTitle;
|
|||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.TextComponent;
|
||||||
import net.kyori.adventure.text.event.HoverEvent;
|
import net.kyori.adventure.text.event.HoverEvent;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
Loading…
Reference in New Issue
Block a user