Sergittos / BedWars

🛏️ BedWars for PocketMine-MP
GNU Lesser General Public License v3.0
25 stars 6 forks source link

Shop & Upgrade Villagers despawned when a player killed an enemy. #34

Closed xwertxy closed 6 months ago

xwertxy commented 6 months ago

Describe the bug Shops has despawned when a player killed an enemy (other team), seems like the chunk generation issue between entities.

To Reproduce

Additional context It seems like the chunk with entities has not to be saved in that certain chunk, which probably caused entity despawned. I was thinking of how map is resetted (even the player that placed blocks are gone too.)

xwertxy commented 6 months ago

Also, i've been noticing between other teams that are null, no one alive, and yeah we can break also bed and get the item.

This is the probably fix for that.

$team = $this->getTeamByPosition($game, $position);
        if($team === null) {
            $session->message("{RED}You can only break blocks placed by a player!");
            $event->cancel();
            return;
        }

        $bed_position = $team->getBedPosition();
        $half_position = $other_half->getPosition();
        if($team->isBedDestroyed()) {
            $session->message("{RED}You can only break blocks placed by a player!");
            $event->cancel();
            return;
        }
Sergittos commented 6 months ago

It doesn't happen to me, are you using a modified PocketMine version?

UnknownNull commented 6 months ago

Also, i've been noticing between other teams that are null, no one alive, and yeah we can break also bed and get the item.

This is the probably fix for that.

No, this is related to large maps, when the player moves away from the chunk where the villager is, that chunk is unloaded, and when the player returns to it in any way, such as being killed or walking, other villagers and blocks that was placed around the bed is not there.

UnknownNull commented 6 months ago

To make this happen to you a lot, just reduce view-distance =[

xwertxy commented 6 months ago

Also, i've been noticing between other teams that are null, no one alive, and yeah we can break also bed and get the item. This is the probably fix for that.

No, this is related to large maps, when the player moves away from the chunk where the villager is, that chunk is unloaded, and when the player returns to it in any way, such as being killed or walking, other villagers and blocks that was placed around the bed is not there.

This happends when entity is not saved through chunks.

xwertxy commented 6 months ago

It doesn't happen to me, are you using a modified PocketMine version?

No i am originally using PocketMine-MP from stable releases. I've been also tried without any using other plugins.

xwertxy commented 6 months ago

I'll send later the attachment to reproduce this issue.

UnknownNull commented 6 months ago

I'll send later the attachment to reproduce this issue.

I even sent a video in this regard, but it was ignored by him 👈(゚ヮ゚👈)

Sergittos commented 6 months ago

I'm unable to reproduce this issue, anyways I'm going to change the way the worlds are created for the games

UnknownNull commented 6 months ago

I'm unable to reproduce this issue, anyways I'm going to change the way the worlds are created for the games

I think the "UnloadChunkEvent" event will solve the problem easily \(〇_o)/

Sergittos commented 6 months ago

Yes, cancelling UnloadChunkEvent would fix this problem, but I don't think that's the right way to fix it.

I don't like the current game generation system, so I'm going to change the way they are generated and that will fix this problem

UnknownNull commented 6 months ago

Yes, cancelling UnloadChunkEvent would fix this problem, but I don't think that's the right way to fix it.

I don't like the current game generation system, so I'm going to change the way they are generated and that will fix this problem

How can you prevent the chunk from being unloaded with a different construction method?

Sergittos commented 6 months ago

The current game generation system sets the world auto save to false, which means that chunks that are unloaded aren't saved.

In the new game generation system this won't happen, so this problem will be solved.

xwertxy commented 6 months ago

Here's a breif reproduce of issue. I just modified only the scoreboard and the rest including xp bar is on another plugin.

https://streamable.com/uq2por

UnknownNull commented 6 months ago

The current game generation system sets the world auto save to false, which means that chunks that are unloaded aren't saved.

In the new game generation system this won't happen, so this problem will be solved.

This bug was also in this plugin: https://github.com/boi1216/BedWarsUltimate although its reset map system was different from your plugin

ClydeNoIQ commented 6 months ago

Blocks placed by the player on their island may also disappear along with the villagers despawning

xwertxy commented 6 months ago

Blocks placed by the player on their island may also disappear along with the villagers despawning

Pocketmine chunk issue

Sergittos commented 6 months ago

Fixed in 1.0.9, thanks for reporting!