mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2025-01-25 08:51:20 +01:00
Changes config.yml to enable hooking into any gamemode
When upgrading, must delete config.yml to get new version. Also changes placeholder names to be prefixed with GameModeAddon name in lower case. e.g, %bskyblock-island-level% https://github.com/BentoBoxWorld/Level/issues/39 https://github.com/BentoBoxWorld/BentoBox/issues/322 https://github.com/BentoBoxWorld/Level/issues/27
This commit is contained in:
parent
8fa3f51666
commit
bf965277c3
@ -118,8 +118,9 @@ public class Level extends Addon {
|
|||||||
registerListener(topTen);
|
registerListener(topTen);
|
||||||
// Register commands for AcidIsland and BSkyBlock
|
// Register commands for AcidIsland and BSkyBlock
|
||||||
getPlugin().getAddonsManager().getGameModeAddons().stream()
|
getPlugin().getAddonsManager().getGameModeAddons().stream()
|
||||||
.filter(gm -> gm.getDescription().getName().equals("AcidIsland") || gm.getDescription().getName().equals("BSkyBlock"))
|
.filter(gm -> settings.getGameModes().contains(gm.getDescription().getName()))
|
||||||
.forEach(gm -> {
|
.forEach(gm -> {
|
||||||
|
log("Level hooking into " + gm.getDescription().getName());
|
||||||
gm.getAdminCommand().ifPresent(adminCommand -> {
|
gm.getAdminCommand().ifPresent(adminCommand -> {
|
||||||
new AdminLevelCommand(this, adminCommand);
|
new AdminLevelCommand(this, adminCommand);
|
||||||
new AdminTopCommand(this, adminCommand);
|
new AdminTopCommand(this, adminCommand);
|
||||||
@ -130,11 +131,11 @@ public class Level extends Addon {
|
|||||||
});
|
});
|
||||||
// Register placeholders
|
// Register placeholders
|
||||||
if (getPlugin().getPlaceholdersManager() != null) {
|
if (getPlugin().getPlaceholdersManager() != null) {
|
||||||
getPlugin().getPlaceholdersManager().registerPlaceholder(this, "island-level", new LevelPlaceholder(this, gm));
|
getPlugin().getPlaceholdersManager().registerPlaceholder(this, gm.getDescription().getName().toLowerCase() + "-island-level", new LevelPlaceholder(this, gm));
|
||||||
// Top Ten
|
// Top Ten
|
||||||
for (int i = 1; i < 11; i++) {
|
for (int i = 1; i < 11; i++) {
|
||||||
getPlugin().getPlaceholdersManager().registerPlaceholder(this, "island-level-top-value-" + i, new TopTenPlaceholder(this, gm, i));
|
getPlugin().getPlaceholdersManager().registerPlaceholder(this, gm.getDescription().getName().toLowerCase() + "-island-level-top-value-" + i, new TopTenPlaceholder(this, gm, i));
|
||||||
getPlugin().getPlaceholdersManager().registerPlaceholder(this, "island-level-top-name-" + i, new TopTenNamePlaceholder(this, gm, i));
|
getPlugin().getPlaceholdersManager().registerPlaceholder(this, gm.getDescription().getName().toLowerCase() + "-island-level-top-name-" + i, new TopTenNamePlaceholder(this, gm, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package world.bentobox.level.config;
|
package world.bentobox.level.config;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -23,11 +25,15 @@ public class Settings {
|
|||||||
private int maxDeaths;
|
private int maxDeaths;
|
||||||
private boolean islandResetDeathReset;
|
private boolean islandResetDeathReset;
|
||||||
private boolean teamJoinDeathReset;
|
private boolean teamJoinDeathReset;
|
||||||
|
private List<String> gameModes = new ArrayList<>();
|
||||||
|
|
||||||
public Settings(Level level) {
|
public Settings(Level level) {
|
||||||
|
|
||||||
level.saveDefaultConfig();
|
level.saveDefaultConfig();
|
||||||
|
|
||||||
|
// GameModes
|
||||||
|
gameModes = level.getConfig().getStringList("game-modes");
|
||||||
|
|
||||||
setLevelWait(level.getConfig().getInt("levelwait", 60));
|
setLevelWait(level.getConfig().getInt("levelwait", 60));
|
||||||
if (getLevelWait() < 0) {
|
if (getLevelWait() < 0) {
|
||||||
setLevelWait(0);
|
setLevelWait(0);
|
||||||
@ -221,4 +227,11 @@ public class Settings {
|
|||||||
return worldBlockValues;
|
return worldBlockValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the gameModes
|
||||||
|
*/
|
||||||
|
public List<String> getGameModes() {
|
||||||
|
return gameModes;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
# Config file for Level add-on for BSkyBlock or AcidIsland
|
# Config file for Level add-on for BSkyBlock or AcidIsland
|
||||||
|
|
||||||
# Command hook-in configuration.
|
# GameModes
|
||||||
# Level will try to hook into these commands when it starts
|
# Level will hook into these game modes. Don't forget to set any world-specific
|
||||||
# If you have changed the default AcidIsland or BSkyBlock commands, change them here
|
# block values below!
|
||||||
acidisland:
|
game-modes:
|
||||||
admin-command: acid
|
- AcidIsland
|
||||||
user-command: ai
|
- BSkyBlock
|
||||||
bskyblock:
|
- CaveBlock
|
||||||
admin-command: bsbadmin
|
#- SkyGrid
|
||||||
user-command: island
|
|
||||||
|
|
||||||
# This file lists the values for various blocks that are used to calculate the
|
# This file lists the values for various blocks that are used to calculate the
|
||||||
# island level. Level = total of all blocks in island boundary / 100.
|
# island level. Level = total of all blocks in island boundary / 100.
|
||||||
|
Loading…
Reference in New Issue
Block a user