PluginBugs / Issues-ItemsAdder

Repository used to keep track of issues of my plugin ItemsAdder
https://itemsadder.devs.beer
54 stars 21 forks source link

Axes allow instabreaking custom blocks #1691

Closed bckd00r closed 2 years ago

bckd00r commented 2 years ago

Terms

Discord tag (optional)

if#7858

What happened?

I'm creating a new Custom Block, almost everything works fine, but I can't prevent miner fatigue when breaking the custom block. It's a bug I removed it from the config but it doesn't work looks like it needs a minor fix.

Steps to reproduce the issue

1.I created a custom block. 2.I set the config config properly. 3.I placed the block and broke it.

If the hardness level is not set in the configuration file, it should not give miner fatigue at all. A setting can be added for this in config.yml. (customblock_break_slown_potion_effect: true/false)

Server version

Current: git-Purpur-1613 (MC: 1.18.2)Previous: git-Purpur-1585 (MC: 1.18.2)

ItemsAdder Version

image

ProtocolLib Version

image

LoneLibs Version

image

LightAPI Version (optional)

No response

LibsDisguises Version (optional)

No response

FULL server log

no panel faults in sight.

Error (optional)

no panel faults in sight.

ItemsAdder config.yml

metrics: true
update-checker: true
disable-plugin-loading-messages_DONT_ASK_ME_FOR_SUPPORT_IF_YOU_SET_TRUE__THANKS: false
resource-pack:
  hosting:
    no-host:
      enabled: false
    auto-external-host:
      enabled: false
    self-host:
      enabled: true
      server-ip: 5.180.107.106
      pack-port: 3162
    external-host:
      enabled: false
      url: ''
      skip-url-file-type-check___DONT_ASK_HELP_IF_SET_TRUE: false
  apply-on-join: true
  kick-player-on-decline: false
  kick-player-on-fail: false
  delay-ticks: 1
  notify-other-plugins-interfering: true
  title:
    enabled: false
  protect-player:
    black-screen: true
    hide-hud: true
    cancel-movement: true
    lock-player: true
  command:
    usage-cooldown-seconds: 60
  custom-font:
    enabled: false
    name: ipaexg.ttf
    shift: '[0,0]'
    size: 11.0
    oversample: 2.0
  thin-font:
    enabled: false
  zip:
    protect-file-from-unzip:
      enabled: false
      extreme: true
    compress-png-files: true
    compress-json-files: true
    overwrite-vanilla-models: false
    overwrite-vanilla-lang-json: false
    generate-custom-armors-textures:
      vanilla_1_17: true
      optifine: true
    disable-overwrite-leather-armor-layers-textures: false
    fix_transparent_noteblocks__disable-for-more-performance: false
    ignore-files-ext:
    - db
    - yml
    - xcf
    - psd
    - html
    - gz
    - rar
    - zip
    - 7z
    - bbmodel
    - iaentitymodel
  items:
    CustomModelData-starting-value:
      ALL: 10000
      DIAMOND: 11000
config_files:
  lang: en
  dictionaries-lang: en
  extract-default-items: true
  extract-default-resources: true
blocks:
  light-api: true
  fix-liquids-flow: true
  fix-floating-blocks: true
  fix-glitched-blocks:
    enabled: true
    only-new-chunks: false
    search-also-in-these-biomes:
      enabled: false
      biomes:
      - BEACH
      - BIRCH_FOREST
      - BIRCH_FOREST_HILLS
      - FOREST
      - MOUNTAINS
      - MOUNTAIN_EDGE
      - GRAVELLY_MOUNTAINS
      - PLAINS
      - RIVER
  cancel-break-wrong-tool:
    enabled: false
    send-actionbar: false
  campfire:
    unlit-on-place: true
    allow-any-item: true
  disable-REAL: false
  disable-REAL_TRANSPARENT: false
  disable-REAL_NOTE: false
  disable-REAL_WIRE: false
  disable-FIRE: false
items:
  fix-show-attack-and-damage-as-lore: true
  give_death_location_maps: true
  hide-custom-durability-lore: false
liquids:
  enabled: true
huds:
  enabled: false
loots:
  allow-loots-drop-from-spawners-using-silk-touch: false
mobs:
  disable-MOB-behaviour__DISABLE_AT_YOUR_OWN_RISK: false
font_images:
  replace-in-customitems-name-and-lore: true
  chat:
    enabled: true
    doublecheck-permission__disable-for-more-performance: false
    add-hover-suggestion: true
  command:
    enabled: true
    commandblocks: true
    excluded:
    - home
    - sethome
    - tpa
  sign:
    enabled: true
  book:
    enabled: true
  anvil:
    enabled: true
  inventory-title:
    enabled: true
  tab-header-footer:
    enabled: false
  vault-prefix-suffix:
    enabled: true
    update-every-ticks: 1200
  scoreboard-teams:
    enabled: false
    update-every-ticks: 3600
  player-display-name:
    enabled: true
    update-every-ticks: 1200
effects:
  hide-scoreboard-numbers: true
  text-effects:
    enabled: true
    replace-in-customitems-name-and-lore: true
    chat:
      enabled: true
    sign:
      enabled: true
    book:
      enabled: true
    anvil:
      enabled: true
    tab-header-footer:
      enabled: false
entities:
  max-furniture-vehicles-per-chunk: 30
  allow-removing-old-furnitures_2_3_11: false
  custom-entitites:
    enabled: true
    emotes: true
    interval-rendering-packets-ticks: 1
recipes:
  hide-vanilla-unrecognized-recipe-errors: true
  fix-packet-too-large-kick: false
  custom-recipes:
    unlock:
      all-on-join: false
      on-pickup:
        any: false
        ingredients: true
  remove-vanilla-recipes:
    enabled: true
    list:
      DIAMOND_SWORD: false
      IRON_INGOT: false
debug:
  items:
    log-files-loading: false
    log-items-loading: false
    log-items-loading-disabled: false
    log-font-images-loading: false
    log-huds-loading: false
    log-attribute-modifiers-loading: false
    log-warnings: false
    log-loots-loading: false
    log-loots-loading-disabled: false
    log-armors-loading: false
  recipes:
    log-recipes-loading: false
    log-recipes-loading-disabled: false
    log-recipes-removed-vanilla: false
    log-fix-packet-too-large: false
  resource-pack:
    log-extract-default-resources: false
    log-not-extract-default-resources-already-exist: false
  blocks:
    log-save: false
    log-save-on-unload: false
    log-mined-unknown-blocks: true
  worlds-populators:
    log-loading: false
    log-loading-disabled: false
    log-loading-no-populators: false
    log-loading-no-world: true
    log-generation: false
  trees-populators:
    log-loading: false
    log-loading-disabled: false
    log-loading-no-populators: false
    log-loading-no-world: true
    log-generation: false
  surface-decorators:
    log-loading: false
    log-loading-disabled: false
    log-loading-no-decorators: false
    log-loading-no-world: true
    log-generation: false
  player-stats:
    log-save: false
  performance:
    loading-ms: true
  huds:
    log-triggers: false
  other:
    log-dictionaries-loading: false
    log-liquids-loading: false
    log-minecraft_lang_overwrite-loading: false
  categories:
    log-total-loaded: true
    log-single-loaded: false
    log-single-loaded-overwrite: false
    log-single-skip: false
    log-icon-failed-load: false
  entities:
    log-files-loading: false
    log-entities-loading: false
    log-entities-loading-disabled: false

Problematic items yml configuration file (optional)

wet_mud_block:
    display_name: Islak Çamur Bloğu
    permission: wet_mud_block
    resource:
      material: PAPER
      generate: true
      textures:
      - block/wet_mud_block.png
    specific_properties:
      block:
        #hardness: -999 <-DELETED
        placed_model:
          type: REAL_NOTE
          break_particles_material: aphernix:wet_mud_block
        sound:
          place:
            name: minecraft:block.pointed_dripstone.place
          break:
            name: minecraft:block.pointed_dripstone.break

Other files, you can drag and drop them here to upload. (optional)

No response

Screenshots/Videos (you can drag and drop files or paste links)

thank you for taking the time to read this simple error, it would be great if you could fix it because it's broken with my external plugins..

LoneDev6 commented 2 years ago

If the hardness level is not set in the configuration file, it should not give miner fatigue at all.

This is not true as a default hardness value is set by ItemsAdder. The noteblock/mushroom blocks are too easy to break. Anyway I can make -1 a special value which disables the potion effect to be sent, but I'd need you to explain why you need this change: "it would be great if you could fix it because it's broken with my external plugins.." is very vague.

bckd00r commented 2 years ago

I want to distribute CustomBlocks to many parts of the server and I am trying to be perfect for this. There are many mistakes, but the important thing for me is that even if the feelings and hardness level are adjusted, sometimes when breaking with a wooden ax, it can get into a bug, the solution to this is to give the player constant miner fatigue and when breaking normal blocks to remove miner fatigue. it is very simple and useful.

    @EventHandler(priority = EventPriority.HIGH)
    public void slowBockDamageAbort(BlockDamageAbortEvent event) { 
        CustomBlock customBlock = CustomBlock.byAlreadyPlaced(event.getBlock());
        if (customBlock == null) {
            event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 999999999, -1, true, false), true);
            event.getPlayer().sendMessage("block damage abort!");
        }

    }

    @EventHandler(priority = EventPriority.HIGH)
    public void slowBlockBreak(BlockBreakEvent event) {
        CustomBlock customBlock = CustomBlock.byAlreadyPlaced(event.getBlock());
        if (customBlock == null) {
            event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 999999999, -1, true, false), true);
            event.getPlayer().sendMessage("block damage abort!");
        }
    }

Here is a simple example of what I did (some bugs for now, but works perfectly, does exactly what I want)

All I need for this is hardness: disable should not be -1

bckd00r commented 2 years ago

I know that you don't have much time for this plugin, but opening a new topic is very troublesome for me, you can add the following error to your business notes.

https://streamable.com/x4fnwf (I prevented this simple and not too difficult bug by coding a spigot plugin, but I respect the originality of the plugin and hope you can fix it when you're available.)

Thanks for considering my mistakes. <3

LoneDev6 commented 2 years ago

I managed to find the cause of the issues and fix it. In the next update you won't have the axes instabreak issue anymore.