Skip to content

Commit

Permalink
misc: 使FlyAbility每隔一段时间检查一次玩家飞行速度是否正确
Browse files Browse the repository at this point in the history
  • Loading branch information
MATRIX-feather committed Oct 22, 2023
1 parent 2c67284 commit 0699c9b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/xiamomc/morph/abilities/impl/FlyAbility.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import xiamomc.morph.config.ConfigOption;
import xiamomc.morph.config.MorphConfigManager;
import xiamomc.morph.misc.DisguiseState;
import xiamomc.morph.misc.NmsRecord;
import xiamomc.pluginbase.Annotations.Initializer;
import xiamomc.pluginbase.Annotations.Resolved;
import xiamomc.pluginbase.Bindables.Bindable;
Expand Down Expand Up @@ -90,6 +91,14 @@ public boolean handle(Player player, DisguiseState state)

double delta;

// 检查玩家飞行速度是否正确
if (plugin.getCurrentTick() % 10 == 0)
{
var configSpeed = config.getFlyingSpeed();
if (player.getFlySpeed() != configSpeed && NmsRecord.ofPlayer(player).gameMode.isSurvival())
player.setFlySpeed(configSpeed);
}

// 当玩家骑乘实体时不要计算位移
if (player.getVehicle() == null)
{
Expand Down

0 comments on commit 0699c9b

Please sign in to comment.