Skip to content

ViaVersion bridge update - #418

Merged
mcmonkey4eva merged 5 commits into
DenizenScript:masterfrom
davight:viaversion_update
Aug 26, 2023
Merged

ViaVersion bridge update#418
mcmonkey4eva merged 5 commits into
DenizenScript:masterfrom
davight:viaversion_update

Conversation

@davight

Copy link
Copy Markdown
Contributor

Changes

  • Update jar version
  • Proper registration for tags
  • ViaVersionPlayerProperties -> ViaVersionPlayerExtensions
  • PlayerTag.viaversion tag -> PlayerTag.viaversion_protocol

Additions

  • PlayerTag.viaversion_version tag


public class ViaVersionBridge extends Bridge {

public static ViaAPI viaVersionInstance;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there any reason to keep this here vs just using Via#getAPI? I assume Via#getAPI is already cached and all

Comment on lines +42 to +45
PlayerTag.tagProcessor.registerTag(ElementTag.class, "viaversion_version", (attribute, object) -> {
int version = ViaVersionBridge.viaVersionInstance.getPlayerVersion(object.getUUID());
return new ElementTag(ProtocolVersion.getProtocol(version).getName(), true);
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How do these 2 behave with offline players? would probably make sense to make it an online-only tag?

// @returns ElementTag
// @plugin Depenizen, ViaVersion
// @description
// Returns the version based on the protocol version number of the player's client.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would probably be useful to have a few examples so that you can see what format does it return them in

// @description
// Returns the protocol version number of the player's client.
// See <@link url https://wiki.vg/Protocol_version_numbers> as a reference list.
// Note: When getting the players protocol, join events may not have the protocol linked with the player in time. It is suggested to delay this check by a few ticks.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Have you been able to replicate this in-game? they might be referring to very early connection events and not the regular join event

@davight

Copy link
Copy Markdown
ContributorAuthor

fixed

public static void register() {

// <--[tag]
// @attribute <PlayerTag.viaversion>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There's a double space here, that needs to be removed

@davight

Copy link
Copy Markdown
ContributorAuthor

oops, fixed

@mcmonkey4eva
mcmonkey4eva merged commit c37d96a into DenizenScript:masterAug 26, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@davight@mcmonkey4eva@tal5