mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2024-11-22 10:36:08 +01:00
Merge branch 'develop' into details-gui
This commit is contained in:
commit
7f75caab36
@ -8,12 +8,15 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
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.NonNull;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.addons.Addon;
|
import world.bentobox.bentobox.api.addons.Addon;
|
||||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||||
import world.bentobox.bentobox.api.configuration.Config;
|
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.api.user.User;
|
||||||
import world.bentobox.bentobox.database.objects.Island;
|
import world.bentobox.bentobox.database.objects.Island;
|
||||||
import world.bentobox.level.calculators.Pipeliner;
|
import world.bentobox.level.calculators.Pipeliner;
|
||||||
@ -35,7 +38,7 @@ import world.bentobox.level.requests.TopTenRequestHandler;
|
|||||||
* @author tastybento
|
* @author tastybento
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Level extends Addon {
|
public class Level extends Addon implements Listener {
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
private ConfigSettings settings;
|
private ConfigSettings settings;
|
||||||
@ -71,10 +74,10 @@ public class Level extends Addon {
|
|||||||
pipeliner = new Pipeliner(this);
|
pipeliner = new Pipeliner(this);
|
||||||
// Start Manager
|
// Start Manager
|
||||||
manager = new LevelsManager(this);
|
manager = new LevelsManager(this);
|
||||||
manager.loadTopTens();
|
|
||||||
// Register listeners
|
// Register listeners
|
||||||
this.registerListener(new IslandActivitiesListeners(this));
|
this.registerListener(new IslandActivitiesListeners(this));
|
||||||
this.registerListener(new JoinLeaveListener(this));
|
this.registerListener(new JoinLeaveListener(this));
|
||||||
|
this.registerListener(this);
|
||||||
// Register commands for GameModes
|
// Register commands for GameModes
|
||||||
getPlugin().getAddonsManager().getGameModeAddons().stream()
|
getPlugin().getAddonsManager().getGameModeAddons().stream()
|
||||||
.filter(gm -> !settings.getGameModes().contains(gm.getDescription().getName()))
|
.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) {
|
private void registerPlaceholders(GameModeAddon gm) {
|
||||||
if (getPlugin().getPlaceholdersManager() == null) return;
|
if (getPlugin().getPlaceholdersManager() == null) return;
|
||||||
// Island Level
|
// Island Level
|
||||||
|
@ -380,7 +380,7 @@ public class LevelsManager {
|
|||||||
World world = Bukkit.getWorld(tt.getUniqueId());
|
World world = Bukkit.getWorld(tt.getUniqueId());
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
topTenLists.put(world, tt);
|
topTenLists.put(world, tt);
|
||||||
addon.log("Loaded TopTen for " + world.getName());
|
addon.log("Loaded top ten for " + world.getName());
|
||||||
// Update based on user data
|
// Update based on user data
|
||||||
// Remove any non island owners
|
// Remove any non island owners
|
||||||
tt.getTopTen().keySet().removeIf(u -> !addon.getIslands().isOwner(world, u));
|
tt.getTopTen().keySet().removeIf(u -> !addon.getIslands().isOwner(world, u));
|
||||||
@ -479,6 +479,7 @@ public class LevelsManager {
|
|||||||
return ld.getLevel(world);
|
return ld.getLevel(world);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
addon.getPlugin().logDebug("Returning 0L");
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,7 +364,7 @@ public class LevelsManagerTest {
|
|||||||
lm.loadTopTens();
|
lm.loadTopTens();
|
||||||
PowerMockito.verifyStatic(Bukkit.class); // 1
|
PowerMockito.verifyStatic(Bukkit.class); // 1
|
||||||
Bukkit.getWorld(eq("world"));
|
Bukkit.getWorld(eq("world"));
|
||||||
verify(addon).log(eq("Loaded TopTen for bskyblock-world"));
|
verify(addon).log(eq("Loaded top ten for bskyblock-world"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user