TownyAdvanced / TownyResources

Adds value to towns, by giving each one a unique set of automatically-generated resources.
Other
33 stars 17 forks source link

Error when killing some mob #19

Closed Akiranya closed 3 years ago

Akiranya commented 3 years ago

Error log

[00:46:42] [Server thread/ERROR]: Could not pass event EntityDeathEvent to TownyResources v0.0.8
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_17_R1.entity.CraftCreeper cannot be cast to class org.bukkit.entity.Player (org.bukkit.craftbukkit.v1_17_R1.entity.CraftCreeper and org.bukkit.entity.Player are in unnamed module of loader 'app')
    at io.github.townyadvanced.townyresources.controllers.PlayerExtractionLimitsController.processEntityDeathEvent(PlayerExtractionLimitsController.java:143) ~[TownyResources-0.0.8.jar:?]
    at io.github.townyadvanced.townyresources.listeners.TownyResourcesBukkitEventListener.onEntityDeathEvent(TownyResourcesBukkitEventListener.java:44) ~[TownyResources-0.0.8.jar:?]
    at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor822.execute(Unknown Source) ~[?:?]
    at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.17.1.jar:git-Purpur-1331]
    at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.17.1.jar:git-Purpur-1331]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.17.1.jar:git-Purpur-1331]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:624) ~[patched_1.17.1.jar:git-Purpur-1331]
    at org.bukkit.craftbukkit.v1_17_R1.event.CraftEventFactory.callEntityDeathEvent(CraftEventFactory.java:867) ~[patched_1.17.1.jar:git-Purpur-1331]
    at net.minecraft.world.entity.LivingEntity.dropAllDeathLoot(LivingEntity.java:1753) ~[app:?]
    at net.minecraft.world.entity.monster.Creeper.dropAllDeathLoot(Creeper.java:152) ~[app:?]
    at net.minecraft.world.entity.LivingEntity.die(LivingEntity.java:1666) ~[app:?]
    at net.minecraft.world.entity.LivingEntity.hurt(LivingEntity.java:1480) ~[app:?]
    at net.minecraft.world.entity.Mob.hurt(Mob.java:357) ~[app:?]
    at net.minecraft.world.entity.player.Player.attack(Player.java:1303) ~[app:?]
    at net.minecraft.server.level.ServerPlayer.attack(ServerPlayer.java:2128) ~[app:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl$5.onAttack(ServerGamePacketListenerImpl.java:2541) ~[app:?]
    at net.minecraft.network.protocol.game.ServerboundInteractPacket$1.dispatch(ServerboundInteractPacket.java:24) ~[app:?]
    at net.minecraft.network.protocol.game.ServerboundInteractPacket.dispatch(ServerboundInteractPacket.java:80) ~[app:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.handleInteract(ServerGamePacketListenerImpl.java:2466) ~[app:?]
    at net.minecraft.network.protocol.game.ServerboundInteractPacket.handle(ServerboundInteractPacket.java:67) ~[app:?]
    at net.minecraft.network.protocol.game.ServerboundInteractPacket.handle(ServerboundInteractPacket.java:12) ~[app:?]
    at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:56) ~[app:?]
    at net.minecraft.server.TickTask.run(TickTask.java:18) ~[patched_1.17.1.jar:git-Purpur-1331]
    at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:149) ~[app:?]
    at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[app:?]
    at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1422) ~[patched_1.17.1.jar:git-Purpur-1331]
    at net.minecraft.server.MinecraftServer.shouldRun(MinecraftServer.java:190) ~[patched_1.17.1.jar:git-Purpur-1331]
    at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:122) ~[app:?]
    at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1400) ~[patched_1.17.1.jar:git-Purpur-1331]
    at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1393) ~[patched_1.17.1.jar:git-Purpur-1331]
    at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:132) ~[app:?]
    at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1369) ~[patched_1.17.1.jar:git-Purpur-1331]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1280) ~[patched_1.17.1.jar:git-Purpur-1331]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Purpur-1331]
    at java.lang.Thread.run(Thread.java:831) [?:?]

config.yml

version:
  # This is the current version.  Please do not edit.
  version: 0.0.8
# The language file you wish to use
language: chinese.yml

# If true, the TownyResources system is enabled.
# if false, the TownyResources system is disabled.
enabled: 'true'

############################################################
# +------------------------------------------------------+ #
# |             Resource Extraction Limits               | #
# +------------------------------------------------------+ #
############################################################

resource_extraction_limits:

  # If true, then daily player resource extraction limits are enabled.
  # If false, then daily player resource extraction limits are disabled.
  enabled: 'true'

  # The cooldown after a player receives a daily-limit warning message.
  # During this time they cannot receive another daily-limit warning message for the same material.
  cooldown_after_daily_limit_warning_message_millis: '5000'

  # This list shows the resource extraction categories.
  # 
  # Each category is enclosed in curly brackets, and has 3 parts:
  # 1 - The name of the category (used for messaging)
  # 2-  The daily limit per player (in stacks)
  # 3-  The list of materials in the category
  categories: |
    {common_dirt, 12, DIRT, DIRT_PATH, FARMLAND},
    {uncommon_dirt, 1, PODZOL, ROOTED_DIRT, MYCELIUM},
    {rare_dirt, 1, SOUL_SOIL},
    {gravel, 1, GRAVEL},
    {sand, 3, SAND},
    {common_rocks, 2.5, STONE, COBBLESTONE},
    {uncommon_rocks, 1.5, DIORITE, ANDESITE, GRANITE, MOSSY_COBBLESTONE, MAGMA_BLOCK, BASALT},
    {terracotta, 1.5, TERRACOTTA, WHITE_TERRACOTTA, ORANGE_TERRACOTTA, MAGENTA_TERRACOTTA, LIGHT_BLUE_TERRACOTTA, YELLOW_TERRACOTTA,LIME_TERRACOTTA, PINK_TERRACOTTA, GRAY_TERRACOTTA, LIGHT_GRAY_TERRACOTTA, CYAN_TERRACOTTA,PURPLE_TERRACOTTA, BLUE_TERRACOTTA, BROWN_TERRACOTTA, GREEN_TERRACOTTA, RED_TERRACOTTA,BLACK_TERRACOTTA},
    {quartz, 0.25, QUARTZ_BLOCK},
    {prismarine, 0.125, PRISMARINE},
    {obsidian, 0.125, OBSIDIAN},
    {clay, 1, CLAY_BALL, CLAY},
    {ice, 1, ICE, PACKED_ICE, BLUE_ICE},
    {snow, 1, SNOW, SNOWBALL, SNOW_BLOCK},
    {coal, 1, COAL, COAL_BLOCK},
    {iron, 1, IRON_ORE, RAW_IRON},
    {gold, 0.25, GOLD_ORE, DEEPSLATE_GOLD_ORE, RAW_GOLD},
    {gold_nuggets, 0.25, GOLD_NUGGET, NETHER_GOLD_ORE},
    {copper, 0.25, COPPER_ORE, RAW_COPPER},
    {emeralds, 0.25, EMERALD_ORE, EMERALD},
    {lapis_Lazuli, 0.25, LAPIS_LAZULI, LAPIS_BLOCK, LAPIS_ORE},
    {diamonds, 0.125, DIAMOND_ORE, DIAMOND},
    {redstone, 1, REDSTONE, REDSTONE_BLOCK},
    {netherrack, 4, NETHERRACK},
    {nether_quartz, 1, NETHER_QUARTZ_ORE, QUARTZ},
    {glowstone, 0.25, GLOWSTONE_DUST, GLOWSTONE},
    {end_Stone, 4, END_STONE},
    {ancient_debris, 0.0625, ANCIENT_DEBRIS},
    {wood, 3.5, OAK_LOG, SPRUCE_LOG, BIRCH_LOG, JUNGLE_LOG, ACACIA_LOG, DARK_OAK_LOG,CRIMSON_STEM, WARPED_STEM, OAK_WOOD, SPRUCE_WOOD, BIRCH_WOOD, JUNGLE_WOOD,ACACIA_WOOD, DARK_OAK_WOOD, CRIMSON_HYPHAE, WARPED_HYPHAE}{wool, 0.5, 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},
    {coral, 1, TUBE_CORAL, BRAIN_CORAL, BUBBLE_CORAL, FIRE_CORAL, HORN_CORAL,TUBE_CORAL_BLOCK, BRAIN_CORAL_BLOCK, BUBBLE_CORAL_BLOCK, FIRE_CORAL_BLOCK, HORN_CORAL_BLOCK,DEAD_TUBE_CORAL_BLOCK, DEAD_BRAIN_CORAL_BLOCK, DEAD_BUBBLE_CORAL_BLOCK, DEAD_FIRE_CORAL_BLOCK, DEAD_HORN_CORAL_BLOCK,TUBE_CORAL_FAN, BRAIN_CORAL_FAN, BUBBLE_CORAL_FAN, FIRE_CORAL_FAN, HORN_CORAL_FAN,DEAD_TUBE_CORAL_FAN, DEAD_BRAIN_CORAL_FAN, DEAD_BUBBLE_CORAL_FAN, DEAD_FIRE_CORAL_FAN,DEAD_HORN_CORAL_FAN},
    {wheat, 1, WHEAT},
    {carrots, 1, CARROTS},
    {potatoes, 1, POTATOES},
    {beetroot, 1, BEETROOT},
    {melon_slices, 1, MELON_SLICE},
    {cocoa_beans, 1, COCOA_BEANS},
    {pumpkin_blocks, 0.125, PUMPKIN},
    {melon_blocks, 0.125, MELON},
    {cocoa_pods, 0.125, COCOA},
    {kelp, 1, KELP},
    {bamboo, 1, BAMBOO},
    {cactus, 1, CACTUS},
    {mushrooms, 1, BROWN_MUSHROOM, RED_MUSHROOM},
    {apples, 0.125, APPLE},
    {vines, 0.25, VINE},
    {nether_wart, 1, NETHER_WART},
    {chorus_fruit, 1, CHORUS_FRUIT},
    {fish, 0.5, COD, SALMON, PUFFERFISH, TROPICAL_FISH},
    {gunpowder, 0.25, GUNPOWDER},
    {string, 0.25, STRING},
    {spider_eyes, 0.25, SPIDER_EYE},
    {feathers, 0.25, FEATHER},
    {leather, 0.25, LEATHER},
    {rabbit_hides, 0.25, RABBIT_HIDE},
    {rotten_flesh, 0.5, ROTTEN_FLESH},
    {bones, 0.5, BONE, BONE_BLOCK},
    {pork, 0.25, PORKCHOP, COOKED_PORKCHOP},
    {mutton, 0.25, MUTTON, COOKED_MUTTON},
    {beef, 0.25, BEEF, COOKED_BEEF},
    {chicken, 0.25, CHICKEN, COOKED_CHICKEN},
    {eggs, 0.25, EGG},
    {chorus_fruits, 0.25, CHORUS_FRUIT},
    {ender_pearls, 0.125, ENDER_PEARL}

############################################################
# +------------------------------------------------------+ #
# |                  Town Resources                      | #
# +------------------------------------------------------+ #
############################################################

town_resources:

  surveys:

    # If true, players can do surveys.
    # if false, they cannot.
    enabled: 'true'

    # This list of values determines how much it costs to do a survey for each resource level.
    # Example: If the first value is 250, then it will cost 250 to survey and discover the level 1 resource.
    cost_per_resource_level: 250, 1000, 5000, 20000

    # This list of values determines how much many townblocks a town must have to DISCOVER each level of resource.
    # Example: If the first value is 10, then the town must have 10 townblocks to survey and discover the level 1 resource.
    num_townblocks_requirement_per_resource_level: 10, 50, 100, 200

  production:

    # If true, towns produce resources.
    # if false, towns do not produce resource.
    enabled: 'true'

    # This list of values determines the level a town needs to be, to PRODUCE its resources.
    # Example: If the first value is 1, then the town has to be level 1 to produce its level 1 resource.
    town_level_requirement_per_resource_level: 1, 4, 6, 8

    # This list of values determines the productivity of each level of resource.
    # Example: If the second value is 200, then the level 2 resource of a town will be 200% productive.
    productivity_percentage_per_resource_level: 100, 200, 300, 400

    # This value determines the limit of how many resources of each type can be stored for collection.
    # Example: If this value 3, and the daily production amount is 32 ..... then the storage limit is 96.
    storage_limit_modifier: '8'

    # The owner nation of a town gets this percentage of town production.
    # The town gets the rest.
    nation_tax_percentage: '25'

  offers:

    # This list shows the survey offer categories.
    # 
    # Each category is enclosed in curly brackets, and has 4 parts:
    # 1 - The name of the category (used for messaging)
    # 2 - The discovery weight of the category (used during discovery)
    # 3-  The base amount of the offer (in stacks)
    # 4-  The list of materials in the category
    # 
    # The default values give a weight of 200 to strategic resources (coal, iron etc.), and 100 to most non-strategic resources. (wheat, quartz etc.)
    # This gives each survey approx. 30% chance to discover a strategic resources, and a 70% to discover a non-strategic resource.
    categories: |
      {common_dirt, 25, 2, DIRT},
      {gravel, 100, 1, GRAVEL},
      {sand, 100, 2, SAND},
      {common_rocks, 100, 2, STONE, COBBLESTONE},
      {uncommon_rocks, 100, 1, DIORITE, ANDESITE, GRANITE},
      {terracotta, 100, 0.5, TERRACOTTA},
      {quartz, 100, 0.25, QUARTZ_BLOCK},
      {prismarine, 100, 0.125, PRISMARINE},
      {obsidian, 100, 0.125, OBSIDIAN},
      {clay, 100, 1, CLAY_BALL},
      {ice, 25, 1, ICE},
      {snow, 25, 1, SNOWBALL},
      {coal, 200, 1, COAL},
      {iron, 200, 0.5, RAW_IRON},
      {gold, 200, 0.25, RAW_GOLD},
      {copper, 100, 0.25, RAW_COPPER},
      {emeralds, 200, 0.25, EMERALD},
      {diamonds, 200, 0.125, DIAMOND},
      {redstone, 100, 1, REDSTONE},
      {ancient_debris, 200, 0.0625, ANCIENT_DEBRIS},
      {wood, 200, 2, OAK_LOG, SPRUCE_LOG, BIRCH_LOG, JUNGLE_LOG, ACACIA_LOG, DARK_OAK_LOG, OAK_WOOD, SPRUCE_WOOD, BIRCH_WOOD, JUNGLE_WOOD, ACACIA_WOOD, DARK_OAK_WOOD},
      {wheat, 100, 1, WHEAT},
      {carrots, 100, 1, CARROTS},
      {potatoes, 100, 1, POTATOES},
      {beetroots, 100, 1, BEETROOT},
      {pumpkins, 100, 1, PUMPKIN_SEEDS},
      {melon_slices, 100, 1, MELON_SLICE},
      {cocoa_plants, 100, 1, COCOA_BEANS},
      {kelp, 100, 1, KELP},
      {bamboo, 100, 1, BAMBOO},
      {cactus, 100, 1, CACTUS},
      {mushrooms, 100, 1, BROWN_MUSHROOM, RED_MUSHROOM},
      {apple_trees, 100, 0.125, APPLE},
      {vines, 100, 0.25, VINE},
      {fish, 100, 1, COD, SALMON, PUFFERFISH, TROPICAL_FISH},
      {wool, 100, 0.5, WHITE_WOOL},
      {gunpowder, 200, 0.25, GUNPOWDER},
      {string, 100, 0.25, STRING},
      {spider_eyes, 100, 0.25, SPIDER_EYE},
      {feathers, 100, 0.25, FEATHER},
      {leather, 100, 0.25, LEATHER},
      {rabbit_hide, 100, 0.25, RABBIT_HIDE},
      {rotten_flesh, 100, 1, ROTTEN_FLESH},
      {bones, 100, 0.5, BONE},
      {pork, 100, 0.25, PORKCHOP},
      {mutton, 100, 0.25, MUTTON},
      {beef, 100, 0.25, BEEF},
      {chickens, 100, 0.25, CHICKEN},
      {eggs, 100, 0.25, EGG},
      {ender_pearls, 100, 0.125, ENDER_PEARL}

  language:

    # If you have the LanguageUtils plugin installed, materials will be automatically translated into this locale/language.
    materials_display_language: zh_cn
Akiranya commented 3 years ago

FYI, I'm using plugin LevelledMobs to let all mobs have levels.

Goosius1 commented 3 years ago

Fixed in 0.0.9, thanks for spotting this bug!