Skip to content

MobArena PlayerTag Fixes#451

Open
MC-Samuel wants to merge 2 commits intoDenizenScript:masterfrom
MC-Samuel:mobarena-fix
Open

MobArena PlayerTag Fixes#451
MC-Samuel wants to merge 2 commits intoDenizenScript:masterfrom
MC-Samuel:mobarena-fix

Conversation

@MC-Samuel
Copy link
Contributor


public class MobArenaPlayerExtensions {

public static SlowWarning mobArenaPlayerTags = new SlowWarning("mobArenaPlayerTags", "Tags in the format 'PlayerTag.mobarena.x' have been deprecated: check the meta site for updated versions.");
Copy link
Member

Choose a reason for hiding this comment

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

in the format X -> in the X format, meta docs for more information

// NOTE: Requires the player to be in an arena.
// -->
PlayerTag.tagProcessor.registerTag(MobArenaArenaTag.class, "current_mobarena", (attribute, player) -> {
return getArena(player) != null ? new MobArenaArenaTag(getArena(player)) : null;
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to be calling getArena twice here? The old code seems to put it in a variable

// NOTE: Requires the player to be in an arena.
// -->
PlayerTag.tagProcessor.registerTag(ElementTag.class, "mobarena_class", (attribute, player) -> {
return getArena(player) != null ? new ElementTag(getArenaPlayer(player).getArenaClass().getConfigName(), true) : null;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe same thing here, alongside making getArenaPlayer null safe?

// @plugin Depenizen, MobArena
// @description
// Returns the stats of a player in their current arena.
// Valid keys are 'KILLS', 'DAMAGE_DONE', 'DAMAGE_TAKEN', 'LAST_WAVE', 'TIMES_SWUNG', and 'TIMES_HIT'.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe includes keys or something? Valid sounds like an input - also stating ElementTag(Number) could be handy

// @attribute <PlayerTag.mobarena.in_arena>
// @returns ElementTag(Boolean)
// @plugin Depenizen, MobArena
// @deprecated Use 'PlayerTag.in_mobarena'
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick but these should start lowercase, as they're used as a part of a bigger message in e.g. VSC

attribute.fulfill(1);
return new ElementTag(getArena(player) != null);
}
if (getArena(player) != null) {
Copy link
Member

Choose a reason for hiding this comment

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

Same here, no need to call it each time - seeing as this is all one big tag block anyway just put it in a variable


if (attribute.startsWith("stats", 2)) {
attribute.fulfill(1);
ArenaPlayerStatistics stats = getArenaPlayer(player).getStats();
Copy link
Member

Choose a reason for hiding this comment

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

Does this not remove functionality? Looks like it let you input any mob arena previously (same for the new mobarena_stats, looks like you can't do what the old tag did currently)

Sign up for free to 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.

2 participants