BentoBoxWorld / Level

Add on for BentoBox to calculate island levels for BSkyBlock and AcidIsland. Please read the Wiki!
Eclipse Public License 2.0
24 stars 31 forks source link

IslandLevelCalculatedEvent returns wrong level #189

Closed bertek41 closed 4 years ago

bertek41 commented 4 years ago

Description

Describe the bug

When i do /cave level it returns 100 but in IslandLevelCalculatedEvent it returns 25731.

Steps to reproduce the behavior

/cave level

Expected behavior

It should return 100 like /cave level returns.

Screenshots and videos (Optional)

image

Environment

Output of /bbox version (Mandatory)
Running PAPER 1.16.2.
BentoBox version: 1.15.0-SNAPSHOT-b1853
Database: JSON
Loaded Game Worlds:
caveblock-world (caveblock): Overworld, Nether*, The End*
Loaded Addons:
Biomes 1.13.0-SNAPSHOT-LOCAL (ENABLED)
Border 2.0.0 (ENABLED)
CaveBlock 1.15.1-SNAPSHOT-b363 (ENABLED)
Chat 1.1.0-SNAPSHOT-b33 (ENABLED)
ControlPanel 1.13.0-SNAPSHOT-b41 (ENABLED)
ExtraMobs 1.11.0.4-SNAPSHOT-b7 (ENABLED)
Level 2.4.1 (ENABLED)
Likes 2.1.0-SNAPSHOT-b29 (ENABLED)
Limits 1.15.0-SNAPSHOT-b228 (ENABLED)
MagicCobblestoneGenerator 2.2.0-SNAPSHOT-LOCAL (ENABLED)
TwerkingForTrees 1.4.1-SNAPSHOT-b47 (ENABLED)
Upgrades 0.2.0-SNAPSHOT-b64 (ENABLED)
Warps 1.10.1-SNAPSHOT-LOCAL (ENABLED)

Additional context (Optional)

@EventHandler
public void onBentoBoxEvent(BentoBoxEvent event) {
    Map<String, Object> keyValues = event.getKeyValues();
    if("IslandLevelCalculatedEvent".equals(event.getEventName())) {
        UUID uniqueId = (UUID) keyValues.get("targetPlayer");
        getServer().broadcastMessage("IslandLevelCalculatedEvent#getLevel: "+keyValues.get("level"));
    }
}

IslandLevels.zip

tastybento commented 4 years ago

The initial island level was not being subtracted from the level. Try the latest snapshot and let me know if that works for you.

bertek41 commented 4 years ago

Tested build 415 and interestingly problem persists.

tastybento commented 4 years ago

What does your config.yml look like? Do you have:

# Zero island levels on new island or island reset
# If true, Level will calculate the starter island's level and remove it from any future level calculations.
# If false, the player's starter island and will count towards their level.
# This will reduce CPU if it isn't used.
zero-new-island-levels: false

in it?

bertek41 commented 4 years ago

Yes its set to true

tastybento commented 4 years ago

[Post deleted] I used the wrong command.

tastybento commented 4 years ago

Bug replicated... working on a fix now.

bertek41 commented 4 years ago

Current build set my island level to initial level. But my server is not public rn so np.

tastybento commented 4 years ago

This new build should work. I tested it with your listener and get what's expected. It actually was a long-standing bug where the initial level wasn't being used.

bertek41 commented 4 years ago

Yep its working now thank you.