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

Add new 1.14 Merchant, Raid and Villager related features. #2068 #2069 #2073

Merged
merged 1 commit into from
Jan 2, 2020

Conversation

i509VCB
Copy link
Contributor

@i509VCB i509VCB commented Dec 18, 2019

This adds some new events (#2068):

RingBellEvent (Needs to have a way to get a list of all villagers which will hear the bell ring).

VillagerEvent.ProfessionChange
VillagerEvent.ProfessionLevelUp
VillagerEvent.Panic

TradeMerchantEvent

RaidEvent.Start
RaidEvent.StartWave
RaidEvent.End

Other additions:

Adds a new Key to get a Villager's Profession level.

Add a way to reference all the Raids within a world, inside of ServerWorld. (#2069)

@gabizou gabizou changed the title [DO NOT MERGE ME] [Draft] Add new 1.14 Merchant, Raid and Villager related features. #2068 #2069 Add new 1.14 Merchant, Raid and Villager related features. #2068 #2069 Dec 18, 2019
@i509VCB i509VCB force-pushed the feature/new_114_events branch 2 times, most recently from 589345b to 699e3a1 Compare December 19, 2019 03:05
@i509VCB i509VCB marked this pull request as ready for review December 19, 2019 03:09
@i509VCB i509VCB requested a review from gabizou as a code owner December 19, 2019 03:09
* @return The {@link Profession} level.
*/
default int getCurrentProfessionLevel() {
this.getVillager().professionLevel().get();
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be passed to the event factory in the impl, never default and point to the source like this.

Copy link
Member

Choose a reason for hiding this comment

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

Right, and especially since a plugin can change the profession level value between event listeners.

Copy link
Member

Choose a reason for hiding this comment

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

Mind you that this would technically be possible to be part of ChangeValueEvent as a sub class LevelUpProfession that is based on the Keys.PROFESSION_LEVEL. I'll be making adjustments to event-impl-gen to allow annotating Keys fields to generate an event based on it.

Copy link
Member

@gabizou gabizou left a comment

Choose a reason for hiding this comment

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

Well done, only went through functional aspects of the PR, will do another review of documentation a bit later, but a cursory look was fine.

*
* @return A list of Entities that will get the glowing effect.
*/
List<Entity> entitiesToGlow();
Copy link
Member

Choose a reason for hiding this comment

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

This might be better to mimic AffectEntityEvent where there's the immutable list of entities originally, versus the now mutable list that'll be used.

* @return The {@link Profession} level.
*/
default int getCurrentProfessionLevel() {
this.getVillager().professionLevel().get();
Copy link
Member

Choose a reason for hiding this comment

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

Right, and especially since a plugin can change the profession level value between event listeners.

* @return The {@link Profession} level.
*/
default int getCurrentProfessionLevel() {
this.getVillager().professionLevel().get();
Copy link
Member

Choose a reason for hiding this comment

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

Mind you that this would technically be possible to be part of ChangeValueEvent as a sub class LevelUpProfession that is based on the Keys.PROFESSION_LEVEL. I'll be making adjustments to event-impl-gen to allow annotating Keys fields to generate an event based on it.

@i509VCB i509VCB force-pushed the feature/new_114_events branch 2 times, most recently from 0270d0d to 1932c3d Compare December 19, 2019 21:13
@ST-DDT
Copy link
Member

ST-DDT commented Dec 19, 2019

Do not force push your changes as it complicates the review process.

@i509VCB
Copy link
Contributor Author

i509VCB commented Dec 19, 2019

Do not force push your changes as it complicates the review process.

Will note that.

Copy link
Member

@gabizou gabizou left a comment

Choose a reason for hiding this comment

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

Run a licenseFormat and it looks good to me.

@i509VCB i509VCB force-pushed the feature/new_114_events branch from 1932c3d to 84c6f6c Compare December 29, 2019 04:44
*/
Merchant getMerchant();

/**
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to have the original TradeOffer here.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure whether the TradeOffer should be settable in this event.

Copy link
Member

Choose a reason for hiding this comment

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

@ST-DDT Would you care to share with the class why?

Copy link
Member

@ST-DDT ST-DDT Dec 29, 2019

Choose a reason for hiding this comment

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

It's hard to explain. I dont see a reason for that. You are in the middle of the trade. Why would the trade change at this point. If this were something like SelectTradeOfferEvent it would make sense, but not while actually doing it.

Edit: Is the server expected to verify that the requirements for the old or the new trade offer is met? What happens if the player no longer meets the requirement will the event be cancelled afterwards? If not how will the missing resources be withdrawn?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Considering that case you mentioned, I am not too sure if you can make the client forcefully select a TradeOffer. Maybe it would be best to make the TradeOffer not settable during the event.

@i509VCB i509VCB force-pushed the feature/new_114_events branch from 84c6f6c to 0209444 Compare January 2, 2020 07:12
@ST-DDT
Copy link
Member

ST-DDT commented Jan 2, 2020

Only these last minor issues otherwise it looks good to me.

@i509VCB i509VCB force-pushed the feature/new_114_events branch from 0209444 to ad726f9 Compare January 2, 2020 17:21
@Zidane Zidane merged commit 3d691e8 into SpongePowered:api-8 Jan 2, 2020
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.

4 participants