尝试添加1.21更新
This commit is contained in:
parent
86d40fedb2
commit
2c013e0eb4
@ -1,7 +1,7 @@
|
||||
package cn.lunadeer.dominion;
|
||||
|
||||
import cn.lunadeer.dominion.events.EnvironmentEvents;
|
||||
import cn.lunadeer.dominion.events.PlayerEvents;
|
||||
import cn.lunadeer.dominion.events.PlayerEvents_1_20_1;
|
||||
import cn.lunadeer.dominion.events.SelectPointEvents;
|
||||
import cn.lunadeer.dominion.managers.ConfigManager;
|
||||
import cn.lunadeer.dominion.managers.DatabaseTables;
|
||||
@ -41,7 +41,7 @@ public final class Dominion extends JavaPlugin {
|
||||
AutoClean.run();
|
||||
Cache.instance = new Cache();
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(new PlayerEvents(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new PlayerEvents_1_20_1(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new EnvironmentEvents(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new SelectPointEvents(), this);
|
||||
Objects.requireNonNull(Bukkit.getPluginCommand("dominion")).setExecutor(new Commands());
|
||||
|
@ -25,6 +25,7 @@ public enum Flag {
|
||||
CAKE("cake", "吃蛋糕", "是否可以吃蛋糕", false, false, true),
|
||||
CONTAINER("container", "一般容器", "包含:箱子/木桶/潜影盒/盔甲架/展示框", false, false, true),
|
||||
CRAFT("craft", "使用工作台", "是否可以使用工作台", false, false, true),
|
||||
CRAFTER("crafter", "合成器", "是否可以修改自动合成器", false, false, true),
|
||||
CREEPER_EXPLODE("creeper_explode", "实体爆炸", "包含:苦力怕/凋零头颅/末影水晶/火球", false, true, true),
|
||||
COMPARER("comparer", "比较器交互", "是否可以修改比较器状态", false, false, true),
|
||||
DOOR("door", "门交互", "是否可以使用各种材质的门(包括活板门)", false, false, true),
|
||||
|
@ -33,7 +33,7 @@ import org.spigotmc.event.entity.EntityMountEvent;
|
||||
import static cn.lunadeer.dominion.events.Apis.checkFlag;
|
||||
import static cn.lunadeer.dominion.events.Apis.getInvDominion;
|
||||
|
||||
public class PlayerEvents implements Listener {
|
||||
public class PlayerEvents_1_20_1 implements Listener {
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Player bukkitPlayer = event.getPlayer();
|
@ -0,0 +1,31 @@
|
||||
package cn.lunadeer.dominion.events;
|
||||
|
||||
import cn.lunadeer.dominion.dtos.DominionDTO;
|
||||
import cn.lunadeer.dominion.dtos.Flag;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
|
||||
import static cn.lunadeer.dominion.events.Apis.checkFlag;
|
||||
import static cn.lunadeer.dominion.events.Apis.getInvDominion;
|
||||
|
||||
public class PlayerEvents_1_21 extends PlayerEvents_1_20_1 {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST) // crafter
|
||||
public void onCrafterOpen(InventoryOpenEvent event) {
|
||||
Inventory inv = event.getInventory();
|
||||
if (inv.getType() != InventoryType.CR) {
|
||||
return;
|
||||
}
|
||||
if (!(event.getPlayer() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
Player bukkitPlayer = (Player) event.getPlayer();
|
||||
DominionDTO dom = getInvDominion(bukkitPlayer, inv);
|
||||
checkFlag(dom, Flag.CRAFTER, bukkitPlayer, event);
|
||||
}
|
||||
}
|
@ -91,7 +91,7 @@ public class ConfigManager {
|
||||
_fly_permission_nodes = _file.getStringList("FlyPermissionNodes");
|
||||
_residence_migration = _file.getBoolean("ResidenceMigration", false);
|
||||
saveAll(); // 回写文件 防止文件中的数据不完整
|
||||
Flag.loadFromJson();
|
||||
Flag.loadFromJson(); // 加载 Flag 配置
|
||||
}
|
||||
|
||||
public void saveAll() {
|
||||
|
Reference in New Issue
Block a user