-
-
Notifications
You must be signed in to change notification settings - Fork 343
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
Conversation
src/main/java/org/spongepowered/api/event/entity/living/trader/VillagerEvent.java
Outdated
Show resolved
Hide resolved
589345b
to
699e3a1
Compare
src/main/java/org/spongepowered/api/event/item/merchant/TradeMerchantEvent.java
Outdated
Show resolved
Hide resolved
src/main/java/org/spongepowered/api/event/entity/living/trader/VillagerEvent.java
Show resolved
Hide resolved
* @return The {@link Profession} level. | ||
*/ | ||
default int getCurrentProfessionLevel() { | ||
this.getVillager().professionLevel().get(); |
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 needs to be passed to the event factory in the impl, never default and point to the source like 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.
Right, and especially since a plugin can change the profession level value between event listeners.
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.
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 Key
s fields to generate an event based on it.
src/main/java/org/spongepowered/api/world/server/ServerWorld.java
Outdated
Show resolved
Hide resolved
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.
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(); |
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 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(); |
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.
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(); |
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.
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 Key
s fields to generate an event based on it.
src/main/java/org/spongepowered/api/event/entity/living/trader/VillagerEvent.java
Outdated
Show resolved
Hide resolved
src/main/java/org/spongepowered/api/event/entity/living/trader/VillagerEvent.java
Outdated
Show resolved
Hide resolved
src/main/java/org/spongepowered/api/event/item/merchant/TradeMerchantEvent.java
Outdated
Show resolved
Hide resolved
src/main/java/org/spongepowered/api/world/server/ServerWorld.java
Outdated
Show resolved
Hide resolved
0270d0d
to
1932c3d
Compare
Do not force push your changes as it complicates the review process. |
Will note that. |
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.
Run a licenseFormat
and it looks good to me.
1932c3d
to
84c6f6c
Compare
*/ | ||
Merchant getMerchant(); | ||
|
||
/** |
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.
It would be nice to have the original TradeOffer here.
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'm not sure whether the TradeOffer
should be settable in this event.
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.
@ST-DDT Would you care to share with the class why?
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.
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?
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.
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.
src/main/java/org/spongepowered/api/event/entity/living/trader/VillagerEvent.java
Outdated
Show resolved
Hide resolved
84c6f6c
to
0209444
Compare
src/main/java/org/spongepowered/api/event/item/merchant/TradeWithMerchantEvent.java
Outdated
Show resolved
Hide resolved
src/main/java/org/spongepowered/api/world/server/ServerWorld.java
Outdated
Show resolved
Hide resolved
Only these last minor issues otherwise it looks good to me. |
src/main/java/org/spongepowered/api/event/entity/living/trader/VillagerEvent.java
Show resolved
Hide resolved
src/main/java/org/spongepowered/api/event/entity/living/trader/VillagerEvent.java
Outdated
Show resolved
Hide resolved
0209444
to
ad726f9
Compare
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)