更新 api 版本至 1.21.1

This commit is contained in:
zhangyuheng 2024-08-11 02:34:39 +08:00
parent 2da5d164d7
commit 43dc8f0abc
8 changed files with 21 additions and 16 deletions

View File

@ -7,7 +7,7 @@ EssentialsX其中D代表Deer。
## 支持版本
- 1.20.1+ (Folia)
- 1.21.1+ (Folia)
## 安装方法

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId>
<artifactId>EssentialsD</artifactId>
<version>2.2.0</version>
<version>2.2.3</version>
<packaging>jar</packaging>
<name>EssentialsD</name>
@ -78,9 +78,9 @@
<dependencies>
<dependency>
<groupId>dev.folia</groupId>
<artifactId>folia-api</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -16,11 +16,11 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.entity.EntityDismountEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.util.Vector;
import org.spigotmc.event.entity.EntityDismountEvent;
public class ChairEvent implements Listener {

View File

@ -12,7 +12,7 @@ public class ChatPrefixEvent implements Listener {
@EventHandler
public void onChat(AsyncChatEvent event) {
event.setCancelled(true);
String formated = PlaceholderAPI.setPlaceholders(event.getPlayer(), EssentialsD.config.getPrefixFormat());
String formated = PlaceholderAPI.setPlaceholders(event.getPlayer(), EssentialsD.config.getPrefixChatFormat());
EssentialsD.instance.getServer().sendMessage(Component.text(formated).append(event.message()));
}

View File

@ -57,7 +57,8 @@ public class ConfigManager {
_db_user = _file.getString("Database.User", "postgres");
_db_pass = _file.getString("Database.Pass", "postgres");
_prefix_enable = _file.getBoolean("Prefix.Enable", true);
_prefix_format = _file.getString("Prefix.Format", "<%player_name%> ");
_prefix_chat_format = _file.getString("Prefix.ChatFormat", "<%player_name%> ");
_prefix_tab_format = _file.getString("Prefix.TabFormat", "%player_name%");
saveAll(); // save all to make sure all values are valid
}
@ -92,7 +93,8 @@ public class ConfigManager {
_file.set("Database.User", _db_user);
_file.set("Database.Pass", _db_pass);
_file.set("Prefix.Enable", _prefix_enable);
_file.set("Prefix.Format", _prefix_format);
_file.set("Prefix.ChatFormat", _prefix_chat_format);
_file.set("Prefix.TabFormat", _prefix_tab_format);
_plugin.saveConfig();
}
@ -323,12 +325,12 @@ public class ConfigManager {
_plugin.saveConfig();
}
public String getPrefixFormat() {
return _prefix_format;
public String getPrefixChatFormat() {
return _prefix_chat_format;
}
public void setPrefixFormat(String format) {
_prefix_format = format;
public void setPrefixChatFormat(String format) {
_prefix_chat_format = format;
_file.set("Prefix.Format", format);
_plugin.saveConfig();
}
@ -373,5 +375,6 @@ public class ConfigManager {
// prefix
private Boolean _prefix_enable;
private String _prefix_format;
private String _prefix_chat_format;
private String _prefix_tab_format;
}

View File

@ -1,6 +1,7 @@
package cn.lunadeer.essentialsd.recipes;
import cn.lunadeer.essentialsd.EssentialsD;
import cn.lunadeer.minecraftpluginutils.XLogger;
import net.kyori.adventure.text.Component;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;

View File

@ -58,7 +58,8 @@ HomeLimit:
# prefix (需要 PlaceholderAPI 支持)
Prefix:
Enable: false
Format: '<%player_name%> '
ChatFormat: '<%player_name%> '
TabFormat: '%player_name%'
Debug: false

View File

@ -1,7 +1,7 @@
name: EssentialsD
version: '${project.version}'
main: cn.lunadeer.essentialsd.EssentialsD
api-version: '1.20'
api-version: '1.21'
description: Deer's Essentials
website: https://lunadeer.cn
load: STARTUP