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

Implement effect command #555

Merged
merged 4 commits into from Aug 31, 2017

Conversation

Projects
None yet
3 participants
@schweinefilet
Contributor

schweinefilet commented Aug 26, 2017

This adds the /effect command (see #499 ).

@momothereal

This comment has been minimized.

Show comment
Hide comment
@momothereal

momothereal Aug 26, 2017

Member

Would be nice to add tab-completion to this, like we did with the other commands.

Member

momothereal commented Aug 26, 2017

Would be nice to add tab-completion to this, like we did with the other commands.

Added tab completion for effect names.
Added permission "minecraft.command.effect" for the command.
@schweinefilet

This comment has been minimized.

Show comment
Hide comment
@schweinefilet

schweinefilet Aug 27, 2017

Contributor

I just checked the auto completion in vanilla Minecraft and all the effect names have a "minecraft:"-prefix. Should I leave this in or not, because currently the prefix gets removed.

Contributor

schweinefilet commented Aug 27, 2017

I just checked the auto completion in vanilla Minecraft and all the effect names have a "minecraft:"-prefix. Should I leave this in or not, because currently the prefix gets removed.

@momothereal

This comment has been minimized.

Show comment
Hide comment
@momothereal

momothereal Aug 27, 2017

Member

I think we should leave it in.

This is what we did for the /give command:

String start = args[1];
if (!"minecraft:".startsWith(start)) {
int colon = start.indexOf(':');
start = "minecraft:" + start.substring(colon == -1 ? 0 : (colon + 1));
}
return (List) StringUtil.copyPartialMatches(start, ItemIds.getIds(), new ArrayList(ItemIds.getIds().size()));

However, I see that you are getting the potion IDs using the enum values (Impl.values()). So basically, you would add a new field to this enum (e.g. key) with the actual vanilla ID, with the namespace (e.g. minecraft:regeneration). Then you can map the potion effects using these IDs instead.

Member

momothereal commented Aug 27, 2017

I think we should leave it in.

This is what we did for the /give command:

String start = args[1];
if (!"minecraft:".startsWith(start)) {
int colon = start.indexOf(':');
start = "minecraft:" + start.substring(colon == -1 ? 0 : (colon + 1));
}
return (List) StringUtil.copyPartialMatches(start, ItemIds.getIds(), new ArrayList(ItemIds.getIds().size()));

However, I see that you are getting the potion IDs using the enum values (Impl.values()). So basically, you would add a new field to this enum (e.g. key) with the actual vanilla ID, with the namespace (e.g. minecraft:regeneration). Then you can map the potion effects using these IDs instead.

Improved tab completion.
Added a vanilla id for potion effects.

@mastercoms mastercoms merged commit 2f344a2 into GlowstoneMC:master Aug 31, 2017

2 checks passed

ci/circleci Your tests passed on CircleCI!
Details
license/cla Contributor License Agreement is signed.
Details
@mastercoms

This comment has been minimized.

Show comment
Hide comment
@mastercoms

mastercoms Aug 31, 2017

Member

Thank you so much for your contribution!

Member

mastercoms commented Aug 31, 2017

Thank you so much for your contribution!

@schweinefilet schweinefilet deleted the schweinefilet:effect-command branch Sep 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment