Merge branch 'develop' into details-gui

This commit is contained in:
tastybento 2020-07-04 16:00:43 -07:00
commit 7f75caab36
3 changed files with 13 additions and 4 deletions

View File

@ -8,12 +8,15 @@ import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.configuration.Config;
import world.bentobox.bentobox.api.events.BentoBoxReadyEvent;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.level.calculators.Pipeliner;
@ -35,7 +38,7 @@ import world.bentobox.level.requests.TopTenRequestHandler;
* @author tastybento
*
*/
public class Level extends Addon {
public class Level extends Addon implements Listener {
// Settings
private ConfigSettings settings;
@ -71,10 +74,10 @@ public class Level extends Addon {
pipeliner = new Pipeliner(this);
// Start Manager
manager = new LevelsManager(this);
manager.loadTopTens();
// Register listeners
this.registerListener(new IslandActivitiesListeners(this));
this.registerListener(new JoinLeaveListener(this));
this.registerListener(this);
// Register commands for GameModes
getPlugin().getAddonsManager().getGameModeAddons().stream()
.filter(gm -> !settings.getGameModes().contains(gm.getDescription().getName()))
@ -94,6 +97,11 @@ public class Level extends Addon {
}
@EventHandler
public void onBentoBoxReady(BentoBoxReadyEvent e) {
manager.loadTopTens();
}
private void registerPlaceholders(GameModeAddon gm) {
if (getPlugin().getPlaceholdersManager() == null) return;
// Island Level

View File

@ -380,7 +380,7 @@ public class LevelsManager {
World world = Bukkit.getWorld(tt.getUniqueId());
if (world != null) {
topTenLists.put(world, tt);
addon.log("Loaded TopTen for " + world.getName());
addon.log("Loaded top ten for " + world.getName());
// Update based on user data
// Remove any non island owners
tt.getTopTen().keySet().removeIf(u -> !addon.getIslands().isOwner(world, u));
@ -479,6 +479,7 @@ public class LevelsManager {
return ld.getLevel(world);
}
}
addon.getPlugin().logDebug("Returning 0L");
return 0L;
}

View File

@ -364,7 +364,7 @@ public class LevelsManagerTest {
lm.loadTopTens();
PowerMockito.verifyStatic(Bukkit.class); // 1
Bukkit.getWorld(eq("world"));
verify(addon).log(eq("Loaded TopTen for bskyblock-world"));
verify(addon).log(eq("Loaded top ten for bskyblock-world"));
}
/**