-
-
Notifications
You must be signed in to change notification settings - Fork 703
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
add client setting for cooldown type, refactor show-coordinates #2193
Conversation
connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java
Outdated
Show resolved
Hide resolved
connector/src/main/java/org/geysermc/connector/utils/SettingsUtils.java
Outdated
Show resolved
Hide resolved
connector/src/main/java/org/geysermc/connector/utils/SettingsUtils.java
Outdated
Show resolved
Hide resolved
…ting # Conflicts: # connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java
- note, i accidentally removed the line that set it null on close when I merged master into this branch
Should have pushed at once to avoid the extra builds... whoops. Also I think I just borked my languages submodule? I'll replace the dropdown text with the proper locale getter once we think this is good to go |
Also I forgot to mention, |
import org.geysermc.connector.utils.CooldownUtils; | ||
|
||
@Getter | ||
public class PreferencesCache { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this name should be changed, but I'm not sure to what. I'm going to have a PR after OptionalPack is merged that allows a plugin to change if a client can Bedrock godbridge or not, so the boolean for that might as well be stuck here. Open to suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it would stop all connected geyser players from god-bridging, why would the boolean be stored in every session instance?
Do you mean the PR would allow plugins to change an allowGodbridging value that geyser uses to prevent god-bridging, or it would allow an extension plugin to do the work of preventing god-bridging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it would stop all connected geyser players from god-bridging, why would the boolean be stored in every session instance?
We can't do that because of GeyserConnect, or if server owners only wanted to block per-world for example. The plugin would be separate and use plugin messages to communicate to Geyser.
Tested successfully on bungeecord (For the button text, the key names are shown instead of their values since the translation strings haven't been added to the languages submodule yet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think that, if the Geyser instance disables the cooldown type, that should prevent Geyser from doing so as well? Knowing now that Java Edition has a toggle for it is making me think that's unnecessary - though right now we also allow the blocking of coordinates.
@@ -1226,7 +1228,7 @@ public void sendDownstreamPacket(Packet packet) { | |||
public void setReducedDebugInfo(boolean value) { | |||
reducedDebugInfo = value; | |||
// Set the showCoordinates data. This is done because updateShowCoordinates() uses this gamerule as a variable. | |||
getWorldCache().updateShowCoordinates(); | |||
getPreferencesCache().updateShowCoordinates(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need to be the Lombok call, and can just be preferencesCache.updateShowCoordinates()
} | ||
|
||
if (CooldownUtils.getDefaultShowCooldown() != CooldownUtils.CooldownType.DISABLED) { | ||
CooldownUtils.CooldownType cooldownType = CooldownUtils.CooldownType.values()[settingsResponse.getDropdownResponses().get(offset).getElementID()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use CooldownType.VALUES here. values()
is a function that allocates a new array (which we don't need when we have one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, I wasn't sure if there was a significant difference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the same apply to the gamemode and difficulty stuff below this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not believe those have a VALUES static field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the gamerule enum is ours, but the VALUES static field is private. the difficulty enum is mcprotocollibs and doesn't have one.
not sure if this is going out of the scope of this pr
connector/src/main/java/org/geysermc/connector/utils/SettingsUtils.java
Outdated
Show resolved
Hide resolved
@@ -149,7 +158,7 @@ public static CooldownType getByName(String name) { | |||
return type; | |||
} | |||
} | |||
return DISABLED; | |||
return TITLE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't do this because legacy configs that have their cooldown settings set to false will break.
This allows the user to choose what kind of cooldown they want to see (title, action bar, or false) through a dropdown. Similarly to the show coordinate option, they aren't shown the option if it is disabled globally through the geyser config (at least that is the only setter of
DEFAULT_SHOW_COOLDOWN
currently).This was was done in a new PreferencesCache in the session. I threw the show coordinates code in there as well since it seemed more appropriate. Also turned the
allowShowCoordinates
boolean into a @Getter field so that the form constructor is a bit nicer.Relies on GeyserMC/languages#69