ScreamingSandals / BedWars

Simple BedWars minigame plugin for Spigot version 1.8.8 - 1.21.1
https://www.spigotmc.org/resources/bedwars.63714/
GNU Lesser General Public License v3.0
264 stars 95 forks source link

Duplication Bug on death #148

Closed alkanex-xyz closed 4 years ago

alkanex-xyz commented 4 years ago

Describe the bug

While falling you open the inventory and take something with the mouse and/or put it in the crafting field. After death (we only tested:)by falling this items reappear in the inventory with the respawn. Special when putting items in the crafting-field while falling: I wasn't able to pick the items from the spawner only after opening my inventory or talking to the shop. Maybe comparable to the existing bug: #100 ? sounds like an comparable bug.

Server and plugin version

Spigot version: git-Spigot-e7dc2f5-a8ec1d6 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT) BedWars version: 0.2.7

Installed plugins on server (can be obtained by /pl)

CleanroomGenerator, LuckPerms, WorldEdit, AsyncWorldEdit, PlaceholderAPI, KidsTimeBoard, Vault, KidStuff, ProtocolLib, WorldGuard, Multiverse-Core, LibsDisguises, Simple_PaintBall, Plan, BedWars, Parkour, SurvivalGames, HolographicDisplays, HideAndSeek, CMI, BungeeTabListPlus, Splegg, Skywars, VillageDefense

Console log

No messages

Configuration (of config.yml and shop.yml)

config.yml locale: de allow-crafting: false keep-inventory-on-death: false in-lobby-colored-leather-by-team: true jointeam-entity-show-name: true friendlyfire: false player-drops: true join-randomly-after-lobby-timeout: true spectator-gm3: false prevent-killing-villagers: true compass-enabled: true join-randomly-on-lobby-join: false add-wool-to-inventory-on-join: true prevent-spawning-mobs: true spawner-holograms: true spawner-disable-merge: true prevent-lobby-spawn-mobs-in-radius: 16 spawner-holo-height: 0.25 spawner-holograms-countdown: true damage-when-player-is-not-in-arena: true remove-unused-target-blocks: true allow-block-falling: true game-start-items: false player-respawn-items: false gived-game-start-items:

shop.yml https://pastebin.com/yfpZTUqY

If there are problem with only one game, paste here config of this game

iamceph commented 4 years ago

Please paste your shop to pastebin, not here.

alkanex-xyz commented 4 years ago

done.

JustGregGithub commented 4 years ago

when yall to lazy to answer back xdd. this man has been waiting for 3 months now xd

Misat11 commented 4 years ago

when yall to lazy to answer back xdd. this man has been waiting for 3 months now xd

I still don't know how to fix that :)

mindw0rm commented 4 years ago

I made a workaround (in a separate plugin that imports BedwarsAPI) that prevents klicks in the crafting grid and while falling, and also clears the inventory on respawn (to clear items that out players learned to put in the cursor slot shortly before death -- our players are mainly kids, and you can trust in them to fine every littly bug that can be somehow abused):

  @EventHandler
  public void onInventoryClick(InventoryClickEvent e) {
    HumanEntity he = e.getWhoClicked();
    if (he instanceof Player && e.getClickedInventory() != null) {
      Player player = (Player)he;
      if (api.isPlayerPlayingAnyGame(player)) {
        switch (e.getClickedInventory().getType()) {
          case CRAFTING:
          case PLAYER:
            int raw = e.getRawSlot();
            if (!player.isOnGround() || raw >= 1 && raw <= 4)
              e.setCancelled(true);
        }
      }
    }
  }
  @EventHandler
  public void onPlayerSpawn(PlayerRespawnEvent e) {
    Player player = e.getPlayer();

    if (api.isPlayerPlayingAnyGame(player)) {
      player.getInventory().clear();
    }
  }

This might be a bit extreme, but does prevent the issue for us and doesn't lead to side effects or complaints so far (disclaimer: I belong to the same server team as Grizzly90).

Edit: the second handler might be enough, but I did the first one first, and kept it ;)

iamceph commented 4 years ago

You can make Pull Request if you want :)