修复了飞行权限逻辑错误问题、修复了玩家特权更新失效问题

This commit is contained in:
zhangyuheng 2024-05-23 21:31:56 +08:00
parent efebd24467
commit cd9e3856a1
5 changed files with 9 additions and 16 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId>
<artifactId>Dominion</artifactId>
<version>1.26.0-beta</version>
<version>1.26.2-beta</version>
<packaging>jar</packaging>
<name>Dominion</name>
@ -96,10 +96,5 @@
<version>1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>2.0.31</version>
</dependency>
</dependencies>
</project>

View File

@ -16,8 +16,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import static cn.lunadeer.dominion.events.Apis.checkFlag;
public class Cache {
public Cache() {
@ -203,6 +201,12 @@ public class Cache {
if (!Flag.FLY.getEnable()) {
return;
}
if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) {
return;
}
if (player.isOp() && Dominion.config.getLimitOpBypass()) {
return;
}
if (dominion == null) {
player.setAllowFlight(false);
return;

View File

@ -2,11 +2,9 @@ package cn.lunadeer.dominion.dtos;
import cn.lunadeer.dominion.Dominion;
import cn.lunadeer.minecraftpluginutils.JsonFile;
import cn.lunadeer.minecraftpluginutils.XLogger;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import java.io.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

View File

@ -148,7 +148,7 @@ public class PlayerPrivilegeDTO {
sql += f.getFlagName() + " = " + player.getFlagValue(f) + ", ";
}
sql = sql.substring(0, sql.length() - 2);
sql += "WHERE id = " + player.getId() + " " +
sql += " WHERE id = " + player.getId() + " " +
"RETURNING *;";
List<PlayerPrivilegeDTO> players = query(sql);
if (players.size() == 0) return null;

View File

@ -1,16 +1,13 @@
package cn.lunadeer.dominion.events;
import cn.lunadeer.dominion.Cache;
import cn.lunadeer.dominion.Dominion;
import cn.lunadeer.dominion.dtos.DominionDTO;
import cn.lunadeer.dominion.dtos.Flag;
import cn.lunadeer.dominion.dtos.PlayerDTO;
import cn.lunadeer.dominion.dtos.PlayerPrivilegeDTO;
import io.papermc.paper.event.entity.EntityDyeEvent;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -28,7 +25,6 @@ import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.*;
import org.bukkit.event.vehicle.VehicleDestroyEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.material.Button;
import org.spigotmc.event.entity.EntityMountEvent;
import static cn.lunadeer.dominion.events.Apis.checkFlag;