feat: 完善稳定性并重构潜影盒安全机制
This commit is contained in:
@@ -56,6 +56,11 @@ public class NightVisionCommand extends BaseCommand {
|
||||
|
||||
private boolean isPluginNightVisionEnabled(Player player) {
|
||||
Byte value = player.getPersistentDataContainer().get(enabledKey, PersistentDataType.BYTE);
|
||||
return value != null && value == (byte) 1;
|
||||
boolean enabled = value != null && value == (byte) 1;
|
||||
if (enabled && !player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
|
||||
player.getPersistentDataContainer().remove(enabledKey);
|
||||
return false;
|
||||
}
|
||||
return enabled;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user