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

Added permission check for Allays #1958

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MrButtersDEV
Copy link

@MrButtersDEV MrButtersDEV commented Oct 19, 2022

Added a permission check similar to pets for setting what item an allay can pick up.

  • There is currently a visual bug when canceling the interaction with an allay.
    -> Might be a Pedal issue not spigot

@RoboMWM
Copy link

RoboMWM commented Nov 18, 2022

I've been severely inactive in the Minecraft scene for some time, and I'm trying to understand the effects of this. What risk in regards to grief can one perform via giving/taking items from an allay? My only guess is taking things from an allay displayed cosmetically in a claim?

@MrButtersDEV
Copy link
Author

I've been severely inactive in the Minecraft scene for some time, and I'm trying to understand the effects of this. What risk in regards to grief can one perform via giving/taking items from an allay? My only guess is taking things from an allay displayed cosmetically in a claim?

Some users have come up with ways to use allays in automated farms for item collection and sorting. Others being able to change what item they are holding allows users to disrupt (grief) the intended process.

Copy link

@UsefullSpoon UsefullSpoon left a comment

Choose a reason for hiding this comment

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

looks good

Copy link
Collaborator

@Jikoo Jikoo left a comment

Choose a reason for hiding this comment

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

Most major thing is the missing api-version: 1.19 that needs to be included if 1.19 features are used.

I'm semi-reluctant to give this my full seal of approval because while this does fix the easiest way to steal an allay, it does not address luring the allay out by dropping items matching its current, then swapping its item to take ownership. That said, that flaw is somewhat more in line with bees being not completely tracked and protected, users having some level of responsibility to build intelligently.

@@ -104,6 +104,7 @@ public class GriefPrevention extends JavaPlugin
public boolean config_claims_protectHorses; //whether horses on a claim should be protected by that claim's rules
public boolean config_claims_protectDonkeys; //whether donkeys on a claim should be protected by that claim's rules
public boolean config_claims_protectLlamas; //whether llamas on a claim should be protected by that claim's rules
public boolean config_claims_protectAllays; //weather allays on a claim should be protected by that claim's rules
Copy link
Collaborator

Choose a reason for hiding this comment

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

Spelling


PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());



Copy link
Collaborator

Choose a reason for hiding this comment

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

Extra whitespace

}
else
{
if (entity instanceof Allay) //check if player tried to set item
Copy link
Collaborator

Choose a reason for hiding this comment

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

While there aren't currently any Tameable Allay implementations that I'm aware of, it would be better to not have this in an else following the section for Tameable handling. It's similar to how armor stands are handled below.

Claim claim = this.dataStore.getClaimAt(entity.getLocation(), false, playerData.lastClaim);
if (claim != null) //make sure user is in an active claim
{
Supplier<String> override = () ->
Copy link
Collaborator

Choose a reason for hiding this comment

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

This override message is duplicate code and should be removed. It matches the supplier that would be constructed for ClaimPermission.Inventory by default. You only need an override if you want to use a different message, i.e. how interacting with claimed entities generally uses Messages.NoDamageClaimedEntity instead.

See https://github.com/TechFortress/GriefPrevention/blob/058ae98ceea307cf72155bde421564080ac85eb1/src/main/java/me/ryanhamshire/GriefPrevention/Claim.java#L587-L594 and https://github.com/TechFortress/GriefPrevention/blob/058ae98ceea307cf72155bde421564080ac85eb1/src/main/java/me/ryanhamshire/GriefPrevention/ClaimPermission.java#L37

@SenorFlamingo
Copy link

Is this pull request still alive? We have a problem on our server with allays, anyone can steal the items from them even in claimed area

@RoboMWM
Copy link

RoboMWM commented Jan 5, 2024

The PR owner appears to have not followed up on the review left by Jikoo.

@snurre0
Copy link

snurre0 commented Mar 29, 2024

@MrButtersDEV Would it be possible for you to follow up on the review here? 🙂

@SenorFlamingo
Copy link

PR owner looks inactive for over half a year, not sure if he comes back for this

@Jikoo
Copy link
Collaborator

Jikoo commented Apr 1, 2024

PR owner looks inactive for over half a year, not sure if he comes back for this

Their last GitHub-tracked activity was Mar 28 in a private repo, 3 days ago. I wouldn't be surprised to not see them bother due to the PR age, but they're definitely active.

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.

None yet

6 participants