Skip to content

Add PlayerFlowerPotManipulateEvent#2448

Closed
MisterVector wants to merge 1 commit into
PaperMC:masterfrom
MisterVector:PlayerFlowerPotManipulateEvent
Closed

Add PlayerFlowerPotManipulateEvent#2448
MisterVector wants to merge 1 commit into
PaperMC:masterfrom
MisterVector:PlayerFlowerPotManipulateEvent

Conversation

@MisterVector
Copy link
Copy Markdown
Contributor

Added an event for when a player places an item in or takes an item out of a flower pot.

This is a revisit to an old PR I had submitted nearly 3 years ago but wasn't able to finish because of an issue with server-side code that handles event cancellation.

+ com.destroystokyo.paper.event.player.PlayerFlowerPotManipulateEvent event = new com.destroystokyo.paper.event.player.PlayerFlowerPotManipulateEvent(player, bukkitblock, whichitem, placing);
+ player.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just test the result of callEvent, as it handles event cancellation already.

+ // Paper start
+ org.bukkit.entity.Player player = (org.bukkit.entity.Player) entityhuman.getBukkitEntity();
+ boolean placing = flag1;
+ org.bukkit.block.Block bukkitblock = org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Starting here, this is extremely verbose with fully-qualified classes. Try using imports when you are using the same class more than once.

@kickash32
Copy link
Copy Markdown
Contributor

I suggest you use imports in BlockFlowerPot.java as currently the implementation of the event is very hard to read.

@kickash32
Copy link
Copy Markdown
Contributor

kickash32 commented Aug 12, 2019

Additionally master is not accepting new feature PRs, only the 1.14 branch is. You need to port this patch to the 1.14 branch and then submit a new PR.

@MisterVector
Copy link
Copy Markdown
Contributor Author

Additionally master is not accepting new feature PRs, only the 1.14 branch is. You need to port this patch to the 1.14 branch and then submit a new PR.

According to https://papermc.io/forums/t/july-project-status-update/1391 they aren't formally feature-freezing the master branch (Minecraft 1.13.2). So on that note what should I do?

@kickash32
Copy link
Copy Markdown
Contributor

Although its not documented here, it has been talked about on the discord and PRs will only be accepted for 1.13 if they are bug fixes or also PR'd for 1.14.

@MisterVector
Copy link
Copy Markdown
Contributor Author

Alright then that is what I will do.

@MisterVector MisterVector deleted the PlayerFlowerPotManipulateEvent branch August 13, 2019 08:13
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.

3 participants