Grief Prevention

Grief Prevention

1M Downloads

Dispensers can't break armor stands

PallePolseMad opened this issue ยท 6 comments

commented

Observed Behavior

If players place a dispenser within a claim, and use it to fire an arrow at an armor stand, the arrow will just bounce off of the armor stand. When doing the same thing outside a claim, it works as intended (Breaking the armor stand).

I am dead-center in a pretty big claim, so it shouldn't have anything to do with being near a claim border.

I saw another open issue with the same problem as me, but it has been untouched for 3 years, and had the 'Needs more info' label: #1103

Expected Behavior

In my ideal world you'd be able to break armor stands with dispensers shooting arrows. Possibly only if /claimexplosions is enabled. I remember another server i played on it was set-up like that, so claimexplosions was needed for it to work. Unsure if that functionality just broke in an update, and i'm unable to test on that other server.

Reproduction steps

  1. Place a dispenser
  2. Fill it with arrows
  3. Place an armor stand at least one block in front of the dispenser
  4. Activate the dispenser

Stack trace or error log

No response

Server version

This server is running Paper version git-Paper-468 (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT) (Git: a774fba)

GriefPrevention version

GriefPrevention version 16.18.2

Configuration

# Default values are perfect for most servers.  If you want to customize and have a question, look for the answer here first: http://dev.bukkit.org/bukkit-plugins/grief-prevention/pages/setup-and-configuration/

GriefPrevention:
  SeaLevelOverrides:
    world: -1
    world_nether: -1
    world_the_end: -1
    TestWorld: -1
    HubWorld: -1
    BuildersWorld: -1
    Resource: -1
    Resource_End: -1
    Resource_Nether: -1
  Claims:
    Mode:
      world_the_end: Survival
      Resource_End: Disabled
      Resource_Nether: Disabled
      Resource: Survival
      HubWorld: Disabled
      world: Survival
      world_nether: Survival
      BuildersWorld: Disabled
      TestWorld: Disabled
    PreventGlobalMonsterEggs: true
    PreventTheft: true
    ProtectCreatures: true
    PreventButtonsSwitches: true
    LockWoodenDoors: true
    LockTrapDoors: true
    LockFenceGates: true
    EnderPearlsRequireAccessTrust: true
    RaidTriggersRequireBuildTrust: true
    ProtectHorses: true
    ProtectDonkeys: true
    ProtectLlamas: true
    InitialBlocks: 100
    Claim Blocks Accrued Per Hour:
      Default: 100
    Max Accrued Claim Blocks:
      Default: 15000
    Accrued Idle Threshold: 0
    AccruedIdlePercent: 0
    AbandonReturnRatio: 1.0
    AutomaticNewPlayerClaimsRadius: 4
    AutomaticNewPlayerClaimsRadiusMinimum: 0
    ExtendIntoGroundDistance: 400
    MinimumWidth: 5
    MinimumArea: 100
    MaximumDepth: -2147483648
    InvestigationTool: STICK
    ModificationTool: GOLDEN_SHOVEL
    Expiration:
      ChestClaimDays: 7
      UnusedClaimDays: 14
      AllClaims:
        DaysInactive: 120
        ExceptWhenOwnerHasTotalClaimBlocks: 10000
        ExceptWhenOwnerHasBonusClaimBlocks: 5000
      AutomaticNatureRestoration:
        SurvivalWorlds: false
    AllowTrappedInAdminClaims: false
    MaximumNumberOfClaimsPerPlayer: 0
    CreationRequiresWorldGuardBuildPermission: true
    VillagerTradingRequiresPermission: true
    CommandsRequiringAccessTrust: /sethome
    DeliverManuals: true
    ManualDeliveryDelaySeconds: 30
    RavagersBreakBlocks: true
    FireSpreadsInClaims: false
    FireDamagesInClaims: true
    LecternReadingRequiresAccessTrust: true
  Spam:
    Enabled: true
    LoginCooldownSeconds: 60
    LoginLogoutNotificationsPerMinute: 5
    ChatSlashCommands: /me;/global;/local
    WhisperSlashCommands: /tell;/pm;/r;/whisper;/msg
    WarningMessage: Please reduce your noise level.  Spammers will be banned.
    BanOffenders: false
    BanMessage: Banned for spam.
    AllowedIpAddresses: 1.2.3.4; 5.6.7.8
    DeathMessageCooldownSeconds: 120
    Logout Message Delay In Seconds: 0
  PvP:
    RulesEnabledInWorld:
      world: true
      world_nether: true
      world_the_end: true
      TestWorld: true
      HubWorld: true
      BuildersWorld: true
      Resource: true
      Resource_End: true
      Resource_Nether: true
    ProtectFreshSpawns: false
    PunishLogout: true
    CombatTimeoutSeconds: 15
    AllowCombatItemDrop: false
    BlockedSlashCommands: /home;/vanish;/spawn;/tpa
    ProtectPlayersInLandClaims:
      PlayerOwnedClaims: false
      AdministrativeClaims: true
      AdministrativeSubdivisions: true
    AllowLavaDumpingNearOtherPlayers:
      PvPWorlds: true
      NonPvPWorlds: false
    AllowFlintAndSteelNearOtherPlayers:
      PvPWorlds: true
      NonPvPWorlds: false
    ProtectPetsOutsideLandClaims: true
  Economy:
    ClaimBlocksMaxBonus: 0
    ClaimBlocksPurchaseCost: 0.0
    ClaimBlocksSellValue: 0.0
  ProtectItemsDroppedOnDeath:
    PvPWorlds: false
    NonPvPWorlds: true
  BlockLandClaimExplosions: true
  BlockSurfaceCreeperExplosions: true
  BlockSurfaceOtherExplosions: true
  LimitSkyTrees: true
  LimitTreeGrowth: false
  PistonMovement: EVERYWHERE_SIMPLE
  PistonExplosionSound: true
  FireSpreads: false
  FireDestroys: false
  AdminsGetWhispers: true
  AdminsGetSignNotifications: true
  VisualizationAntiCheatCompatMode: false
  SmartBan: true
  Mute New Players Using Banned Words: true
  MaxPlayersPerIpAddress: 10
  SilenceBans: true
  Siege:
    Worlds: []
    BreakableBlocks:
    - GRASS_BLOCK
    - DIRT
    - COBBLESTONE
    - OAK_PLANKS
    - SPRUCE_PLANKS
    - BIRCH_PLANKS
    - JUNGLE_PLANKS
    - ACACIA_PLANKS
    - DARK_OAK_PLANKS
    - SAND
    - GRAVEL
    - GLASS
    - GRASS     <-- can't understand this entry, see BukkitDev documentation
    - FERN
    - DEAD_BUSH
    - WHITE_WOOL
    - ORANGE_WOOL
    - MAGENTA_WOOL
    - LIGHT_BLUE_WOOL
    - YELLOW_WOOL
    - LIME_WOOL
    - PINK_WOOL
    - GRAY_WOOL
    - LIGHT_GRAY_WOOL
    - CYAN_WOOL
    - PURPLE_WOOL
    - BLUE_WOOL
    - BROWN_WOOL
    - GREEN_WOOL
    - RED_WOOL
    - BLACK_WOOL
    - SNOW
    - GLASS_PANE
    DoorsOpenDelayInSeconds: 300
    CooldownEndInMinutes: 60
  EndermenMoveBlocks: false
  SilverfishBreakBlocks: false
  CreaturesTrampleCrops: false
  RabbitsEatCrops: true
  HardModeZombiesBreakDoors: false
  MobProjectilesChangeBlocks: false
  Database:
    URL: ''
    UserName: ''
    Password: ''
  UseBanCommand: false
  BanCommandPattern: ban %name% %reason%
  Advanced:
    fixNegativeClaimblockAmounts: true
    ClaimExpirationCheckRate: 60
    OfflinePlayer_cache_days: 90
  Abridged Logs:
    Days To Keep: 7
    Included Entry Types:
      Social Activity: true
      Suspicious Activity: true
      Administrative Activity: false
      Debug: false
      Muted Chat Messages: false
  ConfigVersion: 1

Plugin list

[Thu 11:15:12 INFO ] Server Plugins (87):
  [Thu 11:15:12 INFO ] Paper Plugins:
  [Thu 11:15:12 INFO ]  - AdvancedServerList, MarriageMaster
  [Thu 11:15:12 INFO ] Bukkit Plugins:
  [Thu 11:15:12 INFO ]  - ActivityRewarder, AdvancedEnchantments, AntiNetherRoof, ArtMap, AuctionHouse, BalancedGrindstone, BankPlus, BeautyQuests, BetterRTP, BlockLocker
  [Thu 11:15:12 INFO ]  BottledExp, Brewery, ChatChat, ChatColor2, Citizens, CMILib, CommandAPI, CoreProtect, CraftingStore, CrazyCrates
  [Thu 11:15:12 INFO ]  CrazyVouchers, creative-central, CustomWings, DecentHolograms, DeluxeMenus, DeluxeTags, DiscordSRV, eGlow, Elevators, EpicSpawners
  [Thu 11:15:12 INFO ]  Essentials, EssentialsSpawn, EvenMoreFish, FastAsyncWorldEdit, GEmote, Geyser-Spigot, GPFlags, GriefPrevention, GSit, HeadDatabase
  [Thu 11:15:12 INFO ]  ImageMaps, InventorySaver, InvisibleItemFrames, ItemFilter, Jobs, Join-Leave, LavaSponge, LibsDisguises, LiteBans, LiteBansBridge
  [Thu 11:15:12 INFO ]  LuckPerms, mcMMO, MythicDungeons, MythicMobs, NBTAPI, PhantomWorlds, PlaceholderAPI, Plan, PlayerEmotes, PlayerList
  [Thu 11:15:12 INFO ]  PlayerParticles, PlayerReport, PlayerStats, PlayerVaults, PlayerWarps, ProtocolLib, QuickShop, SafariNet, ShowItem, spark
  [Thu 11:15:12 INFO ]  squaremap, SuperVanish, TAB, TogglePvp, UltimateAutoRestart, unemojis, Vault, ViaVersion, ViewDistanceTweaks, Vivecraft-Spigot-Extensions
  [Thu 11:15:12 INFO ]  VotifierPlus, VotingPlugin, WorldGuard, WorldGuardExtraFlags, YamipaPlugin

Running without GriefPrevention

  • I attempted running the server without GriefPrevention installed.
  • The problem does not occur when GriefPrevention is removed from the server.

Running with only GriefPrevention

  • I attempted running only GriefPrevention on the server.
  • The issue still occurs when GriefPrevention is the only plugin running.

Running on a fresh, clean server installation

  • I attempted testing for the issue on a new server.
  • The issue still occurs on a new server.

Using unmodified client

  • I attempted testing for the issue with the vanilla client.
  • The issue still occurs when using the vanilla client.

We appreciate you taking the time to fill out a bug report!

  • I searched for similar issues before submitting this bug report.
commented

Allowing any arrow fired by a dispenser without being able to check the particular dispenser would lead to griefing opportunities where a griefer could set up a dispenser outside the claim and fire arrows into it to hit the armour stand, so GriefPrevention would need to be able to determine the source block (dispenser) - a Projectile has a getShooter() method that can return the shooter - a ProjectileSource - I thought that was only implemented by entities, not dispenser blocks, but there's a BlockProjectileSource which extends ProjectileSource and represents blocks which can launch projectiles, and has a getBlock() method which should return the block - so it may be possible for GriefPrevention to tell that the arrow was launched from a block, and check if the block in question is in the same claim that the target being hit is in, and allow it if so.

I imagine wanting to be able to break armour stands with arrows fired from dispensers is a fairly unusual requirement, so I don't think it's a particularly high priority thing, but it looks as though it would at least be possible assuming that an arrow fired by a dispenser does in fact have a BlockProjectileSource representing the block returned from its getShooter() method.

In fact - it's pretty much what we already do for fireballs from dispensers:

// If a fire is started by a fireball from a dispenser, allow it if the dispenser is in the same claim.
if (igniteEvent.getCause() == IgniteCause.FIREBALL && igniteEvent.getIgnitingEntity() instanceof Fireball)
{
ProjectileSource shooter = ((Fireball) igniteEvent.getIgnitingEntity()).getShooter();
if (shooter instanceof BlockProjectileSource)
{
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(igniteEvent.getBlock().getLocation(), false, null);
if (claim != null && GriefPrevention.instance.dataStore.getClaimAt(((BlockProjectileSource) shooter).getBlock().getLocation(), false, claim) == claim)
{
return;
}
}
}

commented

Allowing any arrow fired by a dispenser without being able to check the particular dispenser would lead to griefing opportunities where a griefer could set up a dispenser outside the claim and fire arrows into it to hit the armour stand, so GriefPrevention would need to be able to determine the source block (dispenser) - a Projectile has a getShooter() method that can return the shooter - a [ProjectileSource]

Even if this isn't possible, i'd imagine making it so armor stands can be broken if claimexplosions is enabled isn't too difficult. I don't think many people have claimexplosions enabled at all times, so the griefing potential isn't too much of an issue IMO.
I don't know anything about developing plugins, so take all of my comments with a grain of salt i guess

commented

adding to this I would like to point to a rarely used mechanic in the game where chorus-flowers drop when shot by a projectile. this bug leads to such farms not being able to be built anymore.

commented

i'd imagine making it so armor stands can be broken if claimexplosions is enabled isn't too difficult.

Hmm, I do remember noting something about this regarding firespread/damage years ago. Seems I've forgotten about this - but having /claimexplosions be more of a toggle for all types of natural damage was what I was looking at.

commented

This is definitely an issue with chorus flowers not breaking. I tried snowballs too and neither work. I'd like to express interest in this being fixed.

Actually, that is almost entirely unrelated - armor stands are an entity, chorus flowers are a block. Chorus flowers and the like are also already handled:

// Allow change if projectile was shot by a dispenser in the same claim.
if (isBlockSourceInClaim(shooter, claim))
return;

Note that the block broken and the dispenser firing the arrow should be in the same claim.

If you're having issues with chorus flowers and dispensers, please open a separate issue including screenshots of the machine with claims displayed.

commented

This is definitely an issue with chorus flowers not breaking. I tried snowballs too and neither work. I'd like to express interest in this being fixed.