Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix keeping flight ability after respawn #307

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ jobs:

steps:
- name: ✨ Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: 🛂 Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/actions/wrapper-validation@v3

- name: 🏗 Set up JDK 21
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
java-version: 21
distribution: adopt

- name: 📷 Begin Gradle cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
Expand All @@ -59,14 +59,14 @@ jobs:
run: gradle clean build

- name: 📦 Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: artifacts
path: '**/build/libs/'

- name: 📝 Upload reports
if: ${{ always() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: reports
path: '**/build/reports/'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,9 @@ public boolean removeHome(String homeName) {

@Override
public void updatePlayerEntity(ServerPlayerEntity serverPlayerEntity) {
boolean couldFly = VanillaAbilities.ALLOW_FLYING.getTracker(this.player).isGrantedBy(ECAbilitySources.FLY_COMMAND);
this.player = serverPlayerEntity;

// This is to fix a bug with ability to fly being lost upon being teleported to a new dim via /execute...tp.
PlayerDataManager.getInstance().scheduleTask(this::updateFlight);
setFlight(couldFly);
}

private void updateFlight() {
Expand All @@ -428,7 +427,9 @@ public void setFlight(boolean canFly, boolean flyImmediately) {
} else {
Pal.revokeAbility(this.player, VanillaAbilities.ALLOW_FLYING, ECAbilitySources.FLY_COMMAND);
}
this.player.sendAbilitiesUpdate();

// This is to fix a bug with ability to fly being lost upon being teleported to a new dim via /execute...tp.
PlayerDataManager.getInstance().scheduleTask(this::updateFlight);
}

public void clearAbilitiesWithoutPermisisons() {
Expand Down