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

[Feature] Add the option to restore vanilla portal view. #80

Merged
merged 22 commits into from
Oct 11, 2021
Merged

[Feature] Add the option to restore vanilla portal view. #80

merged 22 commits into from
Oct 11, 2021

Conversation

Cloudate9
Copy link
Contributor

I first proposed a PR on this in #63, added the feature requested in #37 and #50. Back then, I was not as advanced and did not understand some parts of the code. It was really garbage looking back. After more experience, I hope this code is good enough. Please note that all checks will fail on my side, as I cannot publish Jar to webhook (required to pass Java CI).

I created a player data file for each player, located at "plugins/BetterPortals/playerData/" + player#getUniqueId() + ".yml". The data file holds one piece of data by default, which is "seeThroughPortal: true". A command called "/bp setSeeThroughPortal" has also been added so that players can toggle this setting in game. The command edits the value in their data file. The command requires the permission "betterportals.see" to be used (not that a player can view a portal without this permission anyway), and will send a success message on use.

To stop players from viewing a portal when they indicate that they want vanilla behaviour, I added a new class that implements PortalPredicate, which checks for their preference.

I hope that this PR will finally get Github to think that I did more than Dependabot!

dependabot bot and others added 20 commits September 24, 2021 22:15
Bumps [MockBukkit-v1.16](https://github.com/MockBukkit/MockBukkit) from 1.5.0 to 1.5.2.
- [Release notes](https://github.com/MockBukkit/MockBukkit/releases)
- [Commits](https://github.com/MockBukkit/MockBukkit/commits)

---
updated-dependencies:
- dependency-name: com.github.seeseemelk:MockBukkit-v1.16
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps com.github.johnrengelman.shadow from 7.0.0 to 7.1.0.

---
updated-dependencies:
- dependency-name: com.github.johnrengelman.shadow
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps com.github.johnrengelman.shadow from 7.0.0 to 7.1.0.

---
updated-dependencies:
- dependency-name: com.github.johnrengelman.shadow
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [junit-vintage-engine](https://github.com/junit-team/junit5) from 5.7.2 to 5.8.1.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](junit-team/junit5@r5.7.2...r5.8.1)

---
updated-dependencies:
- dependency-name: org.junit.vintage:junit-vintage-engine
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
…hub.johnrengelman.shadow-7.1.0

Bump com.github.johnrengelman.shadow from 7.0.0 to 7.1.0
…om.github.johnrengelman.shadow-7.1.0

Bump com.github.johnrengelman.shadow from 7.0.0 to 7.1.0 in /final
Bumps [lombok](https://github.com/projectlombok/lombok) from 1.18.20 to 1.18.22.
- [Release notes](https://github.com/projectlombok/lombok/releases)
- [Changelog](https://github.com/projectlombok/lombok/blob/master/doc/changelog.markdown)
- [Commits](projectlombok/lombok@v1.18.20...v1.18.22)

---
updated-dependencies:
- dependency-name: org.projectlombok:lombok
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
…com.github.seeseemelk-MockBukkit-v1.16-1.5.2

Bump MockBukkit-v1.16 from 1.5.0 to 1.5.2 in /bukkit
…jectlombok-lombok-1.18.22

Bump lombok from 1.18.20 to 1.18.22
…it.vintage-junit-vintage-engine-5.8.1

Bump junit-vintage-engine from 5.7.2 to 5.8.1
Bumps [junit-jupiter-api](https://github.com/junit-team/junit5) from 5.3.1 to 5.8.1.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](junit-team/junit5@r5.3.1...r5.8.1)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
…it.jupiter-junit-jupiter-api-5.8.1

Bump junit-jupiter-api from 5.3.1 to 5.8.1
@Cloudate9
Copy link
Contributor Author

Please also note that I updated all the dependencies Dependabot proposed, and changed the version in build.gradle, plugin.yml, and bungee.yml to 0.10.0 (from 0.9.0).

Copy link
Owner

@Lauriethefish Lauriethefish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning null if an error is found doesn't seem like ideal behavior here, as we'll get NPEs later.
It'd be better to try {} catch{} the loading/saving parts of loadPermanentDataYml, and returning the default configuration if loading fails for example.

Of course, the error should still be logged as to explain why the player's options haven't been saved.

@Lauriethefish
Copy link
Owner

Oops, looked like I made a mistake with reviewing. To clarify, the problems here are in PlayerData.java, within the loadPermanentDataYml function.

@Lauriethefish Lauriethefish added the enhancement New feature or request label Oct 11, 2021
@Cloudate9
Copy link
Contributor Author

Should be fixed now. I agree, probably not the best thing to have put a return null there.

@Lauriethefish Lauriethefish merged commit be9feef into Lauriethefish:master Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants