Merge branch 'develop' into add-total-points
This commit is contained in:
commit
34af2dff65
|
@ -14,10 +14,10 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
- name: Set up JDK 16
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 16
|
||||
java-version: 17
|
||||
- name: Cache SonarCloud packages
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
|
|
24
pom.xml
24
pom.xml
|
@ -54,12 +54,16 @@
|
|||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>16</java.version>
|
||||
<java.version>17</java.version>
|
||||
<!-- Non-minecraft related dependencies -->
|
||||
<powermock.version>2.0.9</powermock.version>
|
||||
<!-- More visible way how to change dependency versions -->
|
||||
<spigot.version>1.16.5-R0.1-SNAPSHOT</spigot.version>
|
||||
<spigot.version>1.19.2-R0.1-SNAPSHOT</spigot.version>
|
||||
<bentobox.version>1.20.0</bentobox.version>
|
||||
<!-- Warps addon version -->
|
||||
<warps.version>1.12.0</warps.version>
|
||||
<!-- Visit addon version -->
|
||||
<visit.version>1.4.0</visit.version>
|
||||
<!-- Panel Utils version -->
|
||||
<panelutils.version>1.1.0</panelutils.version>
|
||||
<!-- Revision variable removes warning about dynamic version -->
|
||||
|
@ -67,7 +71,7 @@
|
|||
<!-- Do not change unless you want different name for local builds. -->
|
||||
<build.number>-LOCAL</build.number>
|
||||
<!-- This allows to change between versions. -->
|
||||
<build.version>2.9.1</build.version>
|
||||
<build.version>2.10.0</build.version>
|
||||
<sonar.projectKey>BentoBoxWorld_Level</sonar.projectKey>
|
||||
<sonar.organization>bentobox-world</sonar.organization>
|
||||
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
||||
|
@ -185,6 +189,18 @@
|
|||
<version>${bentobox.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>world.bentobox</groupId>
|
||||
<artifactId>warps</artifactId>
|
||||
<version>${warps.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>world.bentobox</groupId>
|
||||
<artifactId>visit</artifactId>
|
||||
<version>${visit.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>lv.id.bonne</groupId>
|
||||
<artifactId>panelutils</artifactId>
|
||||
|
@ -209,7 +225,7 @@
|
|||
<dependency>
|
||||
<groupId>com.github.DeadSilenceIV</groupId>
|
||||
<artifactId>AdvancedChestsAPI</artifactId>
|
||||
<version>1.8</version>
|
||||
<version>2.9-BETA</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -13,8 +13,6 @@ 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.bukkit.plugin.Plugin;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
@ -22,9 +20,9 @@ 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.bentobox.managers.RanksManager;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
import world.bentobox.level.calculators.Pipeliner;
|
||||
import world.bentobox.level.commands.AdminLevelCommand;
|
||||
|
@ -39,16 +37,20 @@ import world.bentobox.level.config.ConfigSettings;
|
|||
import world.bentobox.level.listeners.IslandActivitiesListeners;
|
||||
import world.bentobox.level.listeners.JoinLeaveListener;
|
||||
import world.bentobox.level.objects.IslandLevels;
|
||||
import world.bentobox.level.listeners.MigrationListener;
|
||||
import world.bentobox.level.objects.LevelsData;
|
||||
import world.bentobox.level.objects.TopTenData;
|
||||
import world.bentobox.level.requests.LevelRequestHandler;
|
||||
import world.bentobox.level.requests.TopTenRequestHandler;
|
||||
import world.bentobox.visit.VisitAddon;
|
||||
import world.bentobox.warps.Warp;
|
||||
|
||||
|
||||
/**
|
||||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
public class Level extends Addon implements Listener {
|
||||
public class Level extends Addon {
|
||||
|
||||
// The 10 in top ten
|
||||
public static final int TEN = 10;
|
||||
|
@ -64,6 +66,17 @@ public class Level extends Addon implements Listener {
|
|||
private boolean roseStackersEnabled;
|
||||
private final List<GameModeAddon> registeredGameModes = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Local variable that stores if warpHook is present.
|
||||
*/
|
||||
private Warp warpHook;
|
||||
|
||||
/**
|
||||
* Local variable that stores if visitHook is present.
|
||||
*/
|
||||
private VisitAddon visitHook;
|
||||
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
// Save the default config from config.yml
|
||||
|
@ -99,7 +112,8 @@ public class Level extends Addon implements Listener {
|
|||
// Register listeners
|
||||
this.registerListener(new IslandActivitiesListeners(this));
|
||||
this.registerListener(new JoinLeaveListener(this));
|
||||
this.registerListener(this);
|
||||
this.registerListener(new MigrationListener(this));
|
||||
|
||||
// Register commands for GameModes
|
||||
registeredGameModes.clear();
|
||||
getPlugin().getAddonsManager().getGameModeAddons().stream()
|
||||
|
@ -126,10 +140,10 @@ public class Level extends Addon implements Listener {
|
|||
advChestEnabled = advChest != null;
|
||||
if (advChestEnabled) {
|
||||
// Check version
|
||||
if (compareVersions(advChest.getDescription().getVersion(), "14.2") > 0) {
|
||||
if (compareVersions(advChest.getDescription().getVersion(), "23.0") > 0) {
|
||||
log("Hooked into AdvancedChests.");
|
||||
} else {
|
||||
logError("Could not hook into AdvancedChests " + advChest.getDescription().getVersion() + " - requires version 14.3 or later");
|
||||
logError("Could not hook into AdvancedChests " + advChest.getDescription().getVersion() + " - requires version 23.0 or later");
|
||||
advChestEnabled = false;
|
||||
}
|
||||
}
|
||||
|
@ -140,6 +154,45 @@ public class Level extends Addon implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allLoaded()
|
||||
{
|
||||
super.allLoaded();
|
||||
|
||||
if (this.isEnabled())
|
||||
{
|
||||
this.hookExtensions();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method tries to hook into addons and plugins
|
||||
*/
|
||||
private void hookExtensions()
|
||||
{
|
||||
// Try to find Visit addon and if it does not exist, display a warning
|
||||
this.getAddonByName("Visit").ifPresentOrElse(addon ->
|
||||
{
|
||||
this.visitHook = (VisitAddon) addon;
|
||||
this.log("Level Addon hooked into Visit addon.");
|
||||
}, () ->
|
||||
{
|
||||
this.visitHook = null;
|
||||
});
|
||||
|
||||
// Try to find Warps addon and if it does not exist, display a warning
|
||||
this.getAddonByName("Warps").ifPresentOrElse(addon ->
|
||||
{
|
||||
this.warpHook = (Warp) addon;
|
||||
this.log("Level Addon hooked into Warps addon.");
|
||||
}, () ->
|
||||
{
|
||||
this.warpHook = null;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compares versions
|
||||
* @param version1
|
||||
|
@ -165,39 +218,6 @@ public class Level extends Addon implements Listener {
|
|||
return comparisonResult;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBentoBoxReady(BentoBoxReadyEvent e) {
|
||||
// Perform upgrade check
|
||||
manager.migrate();
|
||||
// Load TopTens
|
||||
manager.loadTopTens();
|
||||
/*
|
||||
* DEBUG code to generate fake islands and then try to level them all.
|
||||
Bukkit.getScheduler().runTaskLater(getPlugin(), () -> {
|
||||
getPlugin().getAddonsManager().getGameModeAddons().stream()
|
||||
.filter(gm -> !settings.getGameModes().contains(gm.getDescription().getName()))
|
||||
.forEach(gm -> {
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
try {
|
||||
NewIsland.builder().addon(gm).player(User.getInstance(UUID.randomUUID())).name("default").reason(Reason.CREATE).noPaste().build();
|
||||
} catch (IOException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
// Queue all islands DEBUG
|
||||
|
||||
getIslands().getIslands().stream().filter(Island::isOwned).forEach(is -> {
|
||||
|
||||
this.getManager().calculateLevel(is.getOwner(), is).thenAccept(r ->
|
||||
log("Result for island calc " + r.getLevel() + " at " + is.getCenter()));
|
||||
|
||||
});
|
||||
}, 60L);*/
|
||||
}
|
||||
|
||||
|
||||
private void registerPlaceholders(GameModeAddon gm) {
|
||||
if (getPlugin().getPlaceholdersManager() == null) return;
|
||||
// Island Level
|
||||
|
@ -217,6 +237,9 @@ public class Level extends Addon implements Listener {
|
|||
getPlugin().getPlaceholdersManager().registerPlaceholder(this,
|
||||
gm.getDescription().getName().toLowerCase() + "_points_to_next_level",
|
||||
user -> getManager().getPointsToNextString(gm.getOverWorld(), user.getUniqueId()));
|
||||
getPlugin().getPlaceholdersManager().registerPlaceholder(this,
|
||||
gm.getDescription().getName().toLowerCase() + "_island_level_max",
|
||||
user -> String.valueOf(getManager().getIslandMaxLevel(gm.getOverWorld(), user.getUniqueId())));
|
||||
|
||||
// Visited Island Level
|
||||
getPlugin().getPlaceholdersManager().registerPlaceholder(this,
|
||||
|
@ -272,6 +295,7 @@ public class Level extends Addon implements Listener {
|
|||
if (island != null) {
|
||||
// Sort members by rank
|
||||
return island.getMembers().entrySet().stream()
|
||||
.filter(e -> e.getValue() >= RanksManager.MEMBER_RANK)
|
||||
.sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
|
||||
.map(Map.Entry::getKey)
|
||||
.map(getPlayers()::getName)
|
||||
|
@ -515,4 +539,23 @@ public class Level extends Addon implements Listener {
|
|||
return roseStackersEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method Level#getVisitHook returns the visitHook of this object.
|
||||
*
|
||||
* @return {@code Visit} of this object, {@code null} otherwise.
|
||||
*/
|
||||
public VisitAddon getVisitHook()
|
||||
{
|
||||
return this.visitHook;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method Level#getWarpHook returns the warpHook of this object.
|
||||
*
|
||||
* @return {@code Warp} of this object, {@code null} otherwise.
|
||||
*/
|
||||
public Warp getWarpHook()
|
||||
{
|
||||
return this.warpHook;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ import world.bentobox.level.objects.TopTenData;
|
|||
public class LevelsManager {
|
||||
private static final String INTOPTEN = "intopten";
|
||||
private static final TreeMap<BigInteger, String> LEVELS;
|
||||
private static final int[] SLOTS = new int[] {4, 12, 14, 19, 20, 21, 22, 23, 24, 25};
|
||||
private static final BigInteger THOUSAND = BigInteger.valueOf(1000);
|
||||
static {
|
||||
LEVELS = new TreeMap<>();
|
||||
|
@ -45,7 +44,7 @@ public class LevelsManager {
|
|||
LEVELS.put(THOUSAND.pow(3), "G");
|
||||
LEVELS.put(THOUSAND.pow(4), "T");
|
||||
}
|
||||
private Level addon;
|
||||
private final Level addon;
|
||||
|
||||
// Database handler for level data
|
||||
private final Database<IslandLevels> handler;
|
||||
|
@ -233,6 +232,19 @@ public class LevelsManager {
|
|||
return island == null ? 0L : getLevelsData(island).getLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum level ever given to this island
|
||||
* @param world - world where the island is
|
||||
* @param targetPlayer - target player UUID
|
||||
* @return Max level of the player's island or zero if player is unknown or UUID is null
|
||||
*/
|
||||
public long getIslandMaxLevel(@NonNull World world, @Nullable UUID targetPlayer) {
|
||||
if (targetPlayer == null) return 0L;
|
||||
// Get the island
|
||||
Island island = addon.getIslands().getIsland(world, targetPlayer);
|
||||
return island == null ? 0L : getLevelsData(island).getMaxLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a formatted string of the target player's island level
|
||||
* @param world - world where the island is
|
||||
|
@ -342,7 +354,7 @@ public class LevelsManager {
|
|||
/**
|
||||
* Loads all the top tens from the database
|
||||
*/
|
||||
void loadTopTens() {
|
||||
public void loadTopTens() {
|
||||
topTenLists.clear();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(addon.getPlugin(), () -> {
|
||||
addon.log("Generating rankings");
|
||||
|
|
|
@ -135,6 +135,9 @@ public class IslandLevelCalculator {
|
|||
case "tan":
|
||||
x = Math.tan(Math.toRadians(x));
|
||||
break;
|
||||
case "log":
|
||||
x = Math.log(x);
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Unknown function: " + func);
|
||||
}
|
||||
|
@ -425,11 +428,11 @@ public class IslandLevelCalculator {
|
|||
for (BlockState bs : chunk.getTileEntities()) {
|
||||
if (bs instanceof Container) {
|
||||
if (addon.isAdvChestEnabled()) {
|
||||
AdvancedChest aChest = AdvancedChestsAPI.getChestManager().getAdvancedChest(bs.getLocation());
|
||||
if (aChest != null) {
|
||||
AdvancedChest<?,?> aChest = AdvancedChestsAPI.getChestManager().getAdvancedChest(bs.getLocation());
|
||||
if (aChest != null && aChest.getChestType().getName().equals("NORMAL")) {
|
||||
aChest.getPages().stream().map(ChestPage::getItems).forEach(c -> {
|
||||
for (ItemStack i : c) {
|
||||
countItemStack(i);
|
||||
for (Object i : c) {
|
||||
countItemStack((ItemStack)i);
|
||||
}
|
||||
});
|
||||
continue;
|
||||
|
|
|
@ -90,7 +90,7 @@ public class ConfigSettings implements ConfigObject {
|
|||
@ConfigComment("Island level calculation formula")
|
||||
@ConfigComment("blocks - the sum total of all block values, less any death penalty")
|
||||
@ConfigComment("level_cost - in a linear equation, the value of one level")
|
||||
@ConfigComment("This formula can include +,=,*,/,sqrt,^,sin,cos,tan. Result will always be rounded to a long integer")
|
||||
@ConfigComment("This formula can include +,=,*,/,sqrt,^,sin,cos,tan,log (natural log). Result will always be rounded to a long integer")
|
||||
@ConfigComment("for example, an alternative non-linear option could be: 3 * sqrt(blocks / level_cost)")
|
||||
@ConfigEntry(path = "level-calc")
|
||||
private String levelCalc = "blocks / level_cost";
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
//
|
||||
// Created by BONNe
|
||||
// Copyright - 2022
|
||||
//
|
||||
|
||||
|
||||
package world.bentobox.level.listeners;
|
||||
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import world.bentobox.bentobox.api.events.BentoBoxReadyEvent;
|
||||
import world.bentobox.level.Level;
|
||||
|
||||
|
||||
/**
|
||||
* This listener checks when BentoBox is ready and then tries to migrate Levels addon database, if it is required.
|
||||
*/
|
||||
public class MigrationListener implements Listener
|
||||
{
|
||||
public MigrationListener(Level addon)
|
||||
{
|
||||
this.addon = addon;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBentoBoxReady(BentoBoxReadyEvent e) {
|
||||
// Perform upgrade check
|
||||
this.addon.getManager().migrate();
|
||||
// Load TopTens
|
||||
this.addon.getManager().loadTopTens();
|
||||
/*
|
||||
* DEBUG code to generate fake islands and then try to level them all.
|
||||
Bukkit.getScheduler().runTaskLater(getPlugin(), () -> {
|
||||
getPlugin().getAddonsManager().getGameModeAddons().stream()
|
||||
.filter(gm -> !settings.getGameModes().contains(gm.getDescription().getName()))
|
||||
.forEach(gm -> {
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
try {
|
||||
NewIsland.builder().addon(gm).player(User.getInstance(UUID.randomUUID())).name("default").reason(Reason.CREATE).noPaste().build();
|
||||
} catch (IOException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
// Queue all islands DEBUG
|
||||
|
||||
getIslands().getIslands().stream().filter(Island::isOwned).forEach(is -> {
|
||||
|
||||
this.getManager().calculateLevel(is.getOwner(), is).thenAccept(r ->
|
||||
log("Result for island calc " + r.getLevel() + " at " + is.getCenter()));
|
||||
|
||||
});
|
||||
}, 60L);*/
|
||||
}
|
||||
|
||||
|
||||
private final Level addon;
|
||||
}
|
|
@ -43,6 +43,11 @@ public class IslandLevels implements DataObject {
|
|||
*/
|
||||
@Expose
|
||||
private long pointsToNextLevel;
|
||||
/**
|
||||
* The maximum level this island has ever had
|
||||
*/
|
||||
@Expose
|
||||
private long maxLevel;
|
||||
|
||||
/**
|
||||
* Total points
|
||||
|
@ -100,6 +105,10 @@ public class IslandLevels implements DataObject {
|
|||
*/
|
||||
public void setLevel(long level) {
|
||||
this.level = level;
|
||||
// Track maximum level
|
||||
if (level > this.maxLevel) {
|
||||
maxLevel = level;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -142,6 +151,13 @@ public class IslandLevels implements DataObject {
|
|||
*/
|
||||
public void setTotalPoints(long totalPoints) {
|
||||
this.totalPoints = totalPoints;
|
||||
|
||||
/**
|
||||
* Get the maximum level ever set using {@link #setLevel(long)}
|
||||
* @return the maxLevel
|
||||
*/
|
||||
public long getMaxLevel() {
|
||||
return maxLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.io.File;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.TemplatedPanel;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
|
@ -185,22 +186,66 @@ public class TopLevelPanel
|
|||
List<ItemTemplateRecord.ActionRecords> activeActions = new ArrayList<>(template.actions());
|
||||
|
||||
activeActions.removeIf(action ->
|
||||
"VIEW".equalsIgnoreCase(action.actionType()) && island.getOwner() == null &&
|
||||
island.getMemberSet(RanksManager.MEMBER_RANK).
|
||||
contains(this.user.getUniqueId()));
|
||||
{
|
||||
switch (action.actionType().toUpperCase())
|
||||
{
|
||||
case "WARP" -> {
|
||||
return island.getOwner() == null ||
|
||||
this.addon.getWarpHook() == null ||
|
||||
!this.addon.getWarpHook().getWarpSignsManager().hasWarp(this.world, island.getOwner());
|
||||
}
|
||||
case "VISIT" -> {
|
||||
return island.getOwner() == null ||
|
||||
this.addon.getVisitHook() == null ||
|
||||
!this.addon.getVisitHook().getAddonManager().preprocessTeleportation(this.user, island);
|
||||
}
|
||||
case "VIEW" -> {
|
||||
return island.getOwner() == null ||
|
||||
!island.getMemberSet(RanksManager.MEMBER_RANK).contains(this.user.getUniqueId());
|
||||
}
|
||||
default -> {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Add Click handler
|
||||
builder.clickHandler((panel, user, clickType, i) ->
|
||||
{
|
||||
for (ItemTemplateRecord.ActionRecords action : activeActions)
|
||||
{
|
||||
if ((clickType == action.clickType() || action.clickType() == ClickType.UNKNOWN) &&
|
||||
"VIEW".equalsIgnoreCase(action.actionType()))
|
||||
if (clickType == action.clickType() || action.clickType() == ClickType.UNKNOWN)
|
||||
{
|
||||
this.user.closeInventory();
|
||||
// Open Detailed GUI.
|
||||
switch (action.actionType().toUpperCase())
|
||||
{
|
||||
case "WARP" -> {
|
||||
this.user.closeInventory();
|
||||
this.addon.getWarpHook().getWarpSignsManager().warpPlayer(this.world, this.user, island.getOwner());
|
||||
}
|
||||
case "VISIT" -> {
|
||||
// The command call implementation solves necessity to check for all visits options,
|
||||
// like cool down, confirmation and preprocess in single go. Would it be better to write
|
||||
// all logic here?
|
||||
|
||||
DetailsPanel.openPanel(this.addon, this.world, this.user);
|
||||
this.addon.getPlugin().getIWM().getAddon(this.world).
|
||||
flatMap(GameModeAddon::getPlayerCommand).ifPresent(command ->
|
||||
{
|
||||
String mainCommand =
|
||||
this.addon.getVisitHook().getSettings().getPlayerMainCommand();
|
||||
|
||||
if (!mainCommand.isBlank())
|
||||
{
|
||||
this.user.closeInventory();
|
||||
this.user.performCommand(command.getTopLabel() + " " + mainCommand + " " + island.getOwner());
|
||||
}
|
||||
});
|
||||
}
|
||||
case "VIEW" -> {
|
||||
this.user.closeInventory();
|
||||
// Open Detailed GUI.
|
||||
DetailsPanel.openPanel(this.addon, this.world, this.user);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ levelcost: 100
|
|||
# Island level calculation formula
|
||||
# blocks - the sum total of all block values, less any death penalty
|
||||
# level_cost - in a linear equation, the value of one level
|
||||
# This formula can include +,=,*,/,sqrt,^,sin,cos,tan. Result will always be rounded to a long integer
|
||||
# This formula can include +,=,*,/,sqrt,^,sin,cos,tan,log (natural log). Result will always be rounded to a long integer
|
||||
# for example, an alternative non-linear option could be: 3 * sqrt(blocks / level_cost)
|
||||
level-calc: blocks / level_cost
|
||||
#
|
||||
|
|
|
@ -175,6 +175,9 @@ level:
|
|||
right-click-to-clear: "&e Right Click &7 to clear."
|
||||
click-to-asc: "&e Click &7 to sort in increasing order."
|
||||
click-to-desc: "&e Click &7 to sort in decreasing order."
|
||||
click-to-warp: "&e Click &7 to warp."
|
||||
click-to-visit: "&e Click &7 to visit."
|
||||
right-click-to-visit: "&e Right Click &7 to visit."
|
||||
conversations:
|
||||
# Prefix for messages that are send from server.
|
||||
prefix: "&l&6 [BentoBox]: &r"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
admin:
|
||||
level:
|
||||
parameters: "<joueur>"
|
||||
parameters: "<player>"
|
||||
description: calcule le niveau d'île d'un joueur
|
||||
sethandicap:
|
||||
parameters: "<player> <handicap>"
|
||||
|
@ -18,7 +18,7 @@ admin:
|
|||
display: "&f[rank]. &a[name] &7- &b[level]"
|
||||
remove:
|
||||
description: retire le joueur du top 10
|
||||
parameters: "<joueur>"
|
||||
parameters: "<player>"
|
||||
island:
|
||||
level:
|
||||
parameters: "[joueur]"
|
||||
|
@ -49,12 +49,127 @@ island:
|
|||
names-island: île de [name]
|
||||
syntax: "[name] x [number]"
|
||||
hint: "&c Exécuter level pour voir le rapport des blocs"
|
||||
value:
|
||||
description: affiche la valeur d'un bloc
|
||||
success: "&7Valeur de ce bloc : &e[value]"
|
||||
success-underwater: "&7Valeur de ce bloc en dessous du niveau de la mer : &e[value]"
|
||||
empty-hand: "&cIl n'y a aucun bloc dans votre main"
|
||||
no-value: "&cCet objet n'a pas de valeur."
|
||||
level:
|
||||
commands:
|
||||
value:
|
||||
parameters: "[hand|<material>]"
|
||||
description: affiche la valeur des blocs. Ajoutez 'hand' à la fin pour afficher
|
||||
la valeur de l'objet en main.
|
||||
gui:
|
||||
titles:
|
||||
top: "&0&l Top Islands"
|
||||
detail-panel: "&0&l [name]'s island"
|
||||
value-panel: "&0&l Block Values"
|
||||
buttons:
|
||||
island:
|
||||
empty: "&f&l [name]. place"
|
||||
name: "&f&l [name]"
|
||||
description: |-
|
||||
[owner]
|
||||
[members]
|
||||
[place]
|
||||
[level]
|
||||
owners-island: "[player]'s Island"
|
||||
owner: "&7&l Propriétaire: &r&b [player]"
|
||||
members-title: "&7&l Membres:"
|
||||
member: "&b - [player]"
|
||||
unknown: inconnue
|
||||
place: "&7&o [number]. &r&7 place"
|
||||
level: "&7 Level: &o [number]"
|
||||
material:
|
||||
name: "&f&l [number] x [material]"
|
||||
description: |-
|
||||
[description]
|
||||
[count]
|
||||
[value]
|
||||
[calculated]
|
||||
[limit]
|
||||
[id]
|
||||
id: "&7 Block id: &e [id]"
|
||||
value: "&7 Block value: &e [number]"
|
||||
limit: "&7 Block limit: &e [number]"
|
||||
count: "&7 Nombre de blocs: &e [number]"
|
||||
calculated: "&7 Valeur calculée: &e [number]"
|
||||
all_blocks:
|
||||
name: "&f&l Tous les blocs"
|
||||
description: |-
|
||||
&7 Afficher tous les blocs
|
||||
&7 sur l'île.
|
||||
above_sea_level:
|
||||
name: "&f&l Blocs au-dessus du niveau de la mer"
|
||||
description: |-
|
||||
&7 Afficher uniquement les blocs
|
||||
&7 qui sont au-dessus du niveau
|
||||
&7 de la mer.
|
||||
underwater:
|
||||
name: "&f&l Blocs sous le niveau de la mer"
|
||||
description: |-
|
||||
&7 Afficher uniquement les blocs
|
||||
&7 situés sous le niveau
|
||||
&7 de la mer.
|
||||
spawner:
|
||||
name: "&f&l Spawners"
|
||||
description: "&7 Afficher uniquement les spawners."
|
||||
filters:
|
||||
name:
|
||||
name: "&f&l STrier par nom"
|
||||
description: "&7 Trier tous les blocs par nom."
|
||||
value:
|
||||
name: "&f&l Trier par valeur"
|
||||
description: "&7 Triez tous les blocs par leur valeur."
|
||||
count:
|
||||
name: "&f&l Trier par nombre"
|
||||
description: "&7 Trier tous les blocs par leur montant."
|
||||
value:
|
||||
name: "&f&l [material]"
|
||||
description: |-
|
||||
[description]
|
||||
[value]
|
||||
[underwater]
|
||||
[limit]
|
||||
[id]
|
||||
id: "&7 Block id: &e [id]"
|
||||
value: "&7 Block value: &e [number]"
|
||||
underwater: "&7 Sous le niveau de la mer : &e [number]"
|
||||
limit: "&7 Block limit: &e [number]"
|
||||
previous:
|
||||
name: "&f&l Page précédente"
|
||||
description: "&7 Passer à la page [number]"
|
||||
next:
|
||||
name: "&f&l Page suivante"
|
||||
description: "&7 Passer à la page [number]"
|
||||
search:
|
||||
name: "&f&l Rechercher"
|
||||
description: "&7 Recherche une valeur \n&7 spécifique."
|
||||
search: "&b Valeur : [value]"
|
||||
tips:
|
||||
click-to-view: "&e Cliquez &7 pour afficher."
|
||||
click-to-previous: "&e Cliquez &7 pour afficher la page précédente."
|
||||
click-to-next: "&e Cliquez &7 pour afficher la page suivante."
|
||||
click-to-select: "&e Cliquez &7 pour sélectionner."
|
||||
left-click-to-cycle-up: "&e Clic gauche &7 pour monter."
|
||||
right-click-to-cycle-down: "&e Clic droit &7 pour descendre."
|
||||
left-click-to-change: "&e Clic gauche &7 pour éditer."
|
||||
right-click-to-clear: "&e Clic droit &7 pour effacer."
|
||||
click-to-asc: "&e Cliquez &7 pour trier par ordre croissant."
|
||||
click-to-desc: "&e Cliquez &7 pour trier par ordre décroissant."
|
||||
click-to-warp: "&e Cliquer &7 to warp."
|
||||
click-to-visit: "&e Cliquer &7 pour visiter."
|
||||
right-click-to-visit: "&e Clic droit&7 pour visiter."
|
||||
conversations:
|
||||
prefix: "&l&6 [BentoBox]: &r"
|
||||
no-data: "&c Niveau d'exécution pour voir le rapport de blocage."
|
||||
cancel-string: annuler
|
||||
exit-string: annuler, sortir, quitter
|
||||
write-search: "&e Veuillez entrer une valeur de recherche. (Ecrivez 'cancel' pour
|
||||
quitter)"
|
||||
search-updated: "&a Valeur de recherche mise à jour."
|
||||
cancelled: "&c Conversation annulée !"
|
||||
no-value: "&c Cet item n'a aucune valeur."
|
||||
unknown-item: "&c Le '[material]' n'existe pas dans le jeu."
|
||||
value: "&7 La valeur de '[material]' est : &e[value]"
|
||||
value-underwater: "&7 La valeur de '[material]' sous le niveau de la mer : &e[value]"
|
||||
empty-hand: "&c Il n'y a pas de blocs dans votre main"
|
||||
meta:
|
||||
authors:
|
||||
'0': plagoutte
|
||||
|
|
|
@ -5,6 +5,9 @@ admin:
|
|||
description: oblicza poziom wyspy
|
||||
sethandicap:
|
||||
parameters: "<gracz> <uposledzenie>"
|
||||
description: ustawić 0 poziom wyspy, zwykle poziom wyspy startowej
|
||||
changed: "&a Początkowy poziom wysp został zmieniony z [number] na [new_number]."
|
||||
invalid-level: "&c Nieprawidłowy poziom. Użyj liczby całkowitej."
|
||||
levelstatus:
|
||||
description: pokazuje ile wysp znajduje się w kolejce do skanowania
|
||||
islands-in-queue: "&a Wyspy w kolejce: [number]"
|
||||
|
@ -23,7 +26,7 @@ island:
|
|||
estimated-wait: "&a Szacowany czas: [number] sekund"
|
||||
in-queue: "&a Jestes numerem [number] w kolejce"
|
||||
island-level-is: "&aPoziom wyspy wynosi &b[level]"
|
||||
required-points-to-next-level: "&a[points] punktów do następnego poziomu"
|
||||
required-points-to-next-level: "&aPozostało [points] punktów do następnego poziomu"
|
||||
deaths: "&c([number] śmierci)"
|
||||
cooldown: "&cMusisz zaczekać &b[time] &csekund przed następnym obliczeniem poziomu"
|
||||
in-progress: "&6 Trwa obliczanie poziomu twojej wyspy..."
|
||||
|
@ -44,9 +47,125 @@ island:
|
|||
names-island: Wyspa gracza [name]
|
||||
syntax: "[name] x [number]"
|
||||
hint: "&c Uruchom poziom, aby wyświetlić raport o blokach"
|
||||
value:
|
||||
description: pokazuje wartość dowolnego przedmiotu
|
||||
success: "&7Wartość punktowa tego bloku wynosi: &e[value]"
|
||||
success-underwater: "&7Wartość tego bloku poniżej poziomu morza: &e[value]"
|
||||
empty-hand: "&cNie trzymasz żadnego bloku."
|
||||
no-value: "&cTen przedmiot nie ma wartości :("
|
||||
level:
|
||||
commands:
|
||||
value:
|
||||
parameters: "[hand|<materiał>]"
|
||||
description: pokazuje wartość bloków. Dodaj „hand” na końcu, aby wyświetlić
|
||||
wartość pozycji w ręku.
|
||||
gui:
|
||||
titles:
|
||||
top: "&0&l Najlepsze wyspy"
|
||||
detail-panel: "&0&l Wyspa gracza [name] "
|
||||
value-panel: "&0&l Wartości bloków"
|
||||
buttons:
|
||||
island:
|
||||
empty: "&f&l [name]. miejsce"
|
||||
name: "&f&l [name]"
|
||||
description: |-
|
||||
[owner]
|
||||
[members]
|
||||
[place]
|
||||
[level]
|
||||
owners-island: wyspa gracza [player]
|
||||
owner: "&7&l Lider: &r&b [player]"
|
||||
members-title: "&7&l Członkowie:"
|
||||
member: "&b - [player]"
|
||||
unknown: nieznany
|
||||
place: "&7&o [number]. &r&7 miejsce"
|
||||
level: "&7 Poziom: &o [number]"
|
||||
material:
|
||||
name: "&f&l [number] x [material]"
|
||||
description: |-
|
||||
[description]
|
||||
[count]
|
||||
[value]
|
||||
[calculated]
|
||||
[limit]
|
||||
[id]
|
||||
id: "&7 Identyfikator bloku: &e [id]"
|
||||
value: "&7 Wartość bloku: &e [number]"
|
||||
limit: "&7 Limit bloków: &e [number]"
|
||||
count: "&7 Numer bloku: &e [number]"
|
||||
calculated: "&7 Obliczona wartość: &e [number]"
|
||||
all_blocks:
|
||||
name: "&f&l Wszystkie bloki"
|
||||
description: |-
|
||||
&7 Wyświetl wszystkie bloki
|
||||
&7 na wyspie.
|
||||
above_sea_level:
|
||||
name: "&f&l Bloki nad poziomem morza"
|
||||
description: |-
|
||||
&7 Wyświetlaj tylko bloki
|
||||
&7 które są nad poziomem
|
||||
&7 morza
|
||||
underwater:
|
||||
name: "&f&l Bloki pod poziomem morza"
|
||||
description: |-
|
||||
&7 Wyświetlaj tylko bloki
|
||||
&7 ponad poziomem morza
|
||||
spawner:
|
||||
name: "&f&l Spawnery"
|
||||
description: "&7 Wyświetlaj tylko spawnery."
|
||||
filters:
|
||||
name:
|
||||
name: "&f&l Sortuj według nazwy"
|
||||
description: "&7 Sortuj wszystkie bloki według nazwy."
|
||||
value:
|
||||
name: "&f&l Sortuj według wartości"
|
||||
description: "&7 Sortuj wszystkie bloki według ich wartości."
|
||||
count:
|
||||
name: "&f&l Sortuj według liczby"
|
||||
description: "&7 Sortuj wszystkie bloki według ich ilości."
|
||||
value:
|
||||
name: "&f&l [material]"
|
||||
description: |-
|
||||
[description]
|
||||
[value]
|
||||
[underwater]
|
||||
[limit]
|
||||
[id]
|
||||
id: "&7 Identyfikator bloku: &e [id]"
|
||||
value: "&7 Wartość bloku: &e [number]"
|
||||
underwater: "&7 Poniżej poziomu morza: &e [number]"
|
||||
limit: "&7 Limit bloku: &e [number]"
|
||||
previous:
|
||||
name: "&f&l Poprzednia strona"
|
||||
description: "&7 Przełącz na stronę [number]"
|
||||
next:
|
||||
name: "&f&l Następna strona"
|
||||
description: "&7 Przełącz na stronę [number]"
|
||||
search:
|
||||
name: "&f&l Szukaj"
|
||||
description: |-
|
||||
&7 Wyszukaj konkretną
|
||||
&7 wartość.
|
||||
search: "&b Wartość: [value]"
|
||||
tips:
|
||||
click-to-view: "&e Kliknij &7, aby wyświetlić."
|
||||
click-to-previous: "&e Kliknij &7, aby wyświetlić poprzednią stronę."
|
||||
click-to-next: "&e Kliknij &7, aby wyświetlić następną stronę."
|
||||
click-to-select: "&e Kliknij &7, aby wybrać."
|
||||
left-click-to-cycle-up: "&e Kliknij lewym przyciskiem &7, aby przejść w górę."
|
||||
right-click-to-cycle-down: "&e Kliknij prawym przyciskiem &7, aby przejść w
|
||||
dół."
|
||||
left-click-to-change: "&e Kliknij lewym przyciskiem &7, aby edytować."
|
||||
right-click-to-clear: "&e Kliknij prawym przyciskiem &7, aby wyczyścić."
|
||||
click-to-asc: "&e Kliknij &7, aby posortować w porządku rosnącym."
|
||||
click-to-desc: "&e Kliknij &7, aby posortować w porządku malejącym."
|
||||
click-to-warp: "&e Kliknij&7, aby przenieść"
|
||||
click-to-visit: "&e Kliknij&7, aby odwiedzić"
|
||||
right-click-to-visit: "&e Kliknij prawym przyciskiem &7, aby odwiedzić."
|
||||
conversations:
|
||||
prefix: "&l&6 [BentoBox]: &r"
|
||||
no-data: "&c Wykonaj sprawdzenie poziomu, przed raportem bloków"
|
||||
cancel-string: anuluj
|
||||
exit-string: cancel, exit, quit, anuluj
|
||||
write-search: "&e Wprowadź wartość wyszukiwania. (Napisz „anuluj”, aby wyjść)"
|
||||
search-updated: "&a Zaktualizowano wartość wyszukiwania."
|
||||
cancelled: "&c Rozmowa została anulowana!"
|
||||
no-value: "&c Ten element nie ma wartości."
|
||||
unknown-item: "&c „[material]” nie istnieje w grze."
|
||||
value: "&7 Wartość '[material]' to: &e[value]"
|
||||
value-underwater: "&7 Wartość „[material]” poniżej poziomu morza: &e[value]"
|
||||
empty-hand: "&c W twojej ręce nie ma bloków"
|
||||
|
|
|
@ -17,6 +17,13 @@ top_panel:
|
|||
data:
|
||||
type: TOP
|
||||
index: 1
|
||||
actions:
|
||||
warp:
|
||||
click-type: LEFT
|
||||
tooltip: level.gui.tips.click-to-warp
|
||||
visit:
|
||||
click-type: RIGHT
|
||||
tooltip: level.gui.tips.right-click-to-visit
|
||||
fallback:
|
||||
icon: LIME_STAINED_GLASS_PANE
|
||||
title: level.gui.buttons.island.empty
|
||||
|
@ -28,6 +35,13 @@ top_panel:
|
|||
data:
|
||||
type: TOP
|
||||
index: 2
|
||||
actions:
|
||||
warp:
|
||||
click-type: LEFT
|
||||
tooltip: level.gui.tips.click-to-warp
|
||||
visit:
|
||||
click-type: RIGHT
|
||||
tooltip: level.gui.tips.right-click-to-visit
|
||||
fallback:
|
||||
icon: LIME_STAINED_GLASS_PANE
|
||||
title: level.gui.buttons.island.empty
|
||||
|
@ -38,6 +52,13 @@ top_panel:
|
|||
data:
|
||||
type: TOP
|
||||
index: 3
|
||||
actions:
|
||||
warp:
|
||||
click-type: LEFT
|
||||
tooltip: level.gui.tips.click-to-warp
|
||||
visit:
|
||||
click-type: RIGHT
|
||||
tooltip: level.gui.tips.right-click-to-visit
|
||||
fallback:
|
||||
icon: LIME_STAINED_GLASS_PANE
|
||||
title: level.gui.buttons.island.empty
|
||||
|
@ -49,6 +70,13 @@ top_panel:
|
|||
data:
|
||||
type: TOP
|
||||
index: 4
|
||||
actions:
|
||||
warp:
|
||||
click-type: LEFT
|
||||
tooltip: level.gui.tips.click-to-warp
|
||||
visit:
|
||||
click-type: RIGHT
|
||||
tooltip: level.gui.tips.right-click-to-visit
|
||||
fallback:
|
||||
icon: LIME_STAINED_GLASS_PANE
|
||||
title: level.gui.buttons.island.empty
|
||||
|
@ -59,6 +87,13 @@ top_panel:
|
|||
data:
|
||||
type: TOP
|
||||
index: 5
|
||||
actions:
|
||||
warp:
|
||||
click-type: LEFT
|
||||
tooltip: level.gui.tips.click-to-warp
|
||||
visit:
|
||||
click-type: RIGHT
|
||||
tooltip: level.gui.tips.right-click-to-visit
|
||||
fallback:
|
||||
icon: LIME_STAINED_GLASS_PANE
|
||||
title: level.gui.buttons.island.empty
|
||||
|
@ -69,6 +104,13 @@ top_panel:
|
|||
data:
|
||||
type: TOP
|
||||
index: 6
|
||||
actions:
|
||||
warp:
|
||||
click-type: LEFT
|
||||
tooltip: level.gui.tips.click-to-warp
|
||||
visit:
|
||||
click-type: RIGHT
|
||||
tooltip: level.gui.tips.right-click-to-visit
|
||||
fallback:
|
||||
icon: LIME_STAINED_GLASS_PANE
|
||||
title: level.gui.buttons.island.empty
|
||||
|
@ -79,6 +121,13 @@ top_panel:
|
|||
data:
|
||||
type: TOP
|
||||
index: 7
|
||||
actions:
|
||||
warp:
|
||||
click-type: LEFT
|
||||
tooltip: level.gui.tips.click-to-warp
|
||||
visit:
|
||||
click-type: RIGHT
|
||||
tooltip: level.gui.tips.right-click-to-visit
|
||||
fallback:
|
||||
icon: LIME_STAINED_GLASS_PANE
|
||||
title: level.gui.buttons.island.empty
|
||||
|
@ -89,6 +138,13 @@ top_panel:
|
|||
data:
|
||||
type: TOP
|
||||
index: 8
|
||||
actions:
|
||||
warp:
|
||||
click-type: LEFT
|
||||
tooltip: level.gui.tips.click-to-warp
|
||||
visit:
|
||||
click-type: RIGHT
|
||||
tooltip: level.gui.tips.right-click-to-visit
|
||||
fallback:
|
||||
icon: LIME_STAINED_GLASS_PANE
|
||||
title: level.gui.buttons.island.empty
|
||||
|
@ -99,6 +155,13 @@ top_panel:
|
|||
data:
|
||||
type: TOP
|
||||
index: 9
|
||||
actions:
|
||||
warp:
|
||||
click-type: LEFT
|
||||
tooltip: level.gui.tips.click-to-warp
|
||||
visit:
|
||||
click-type: RIGHT
|
||||
tooltip: level.gui.tips.right-click-to-visit
|
||||
fallback:
|
||||
icon: LIME_STAINED_GLASS_PANE
|
||||
title: level.gui.buttons.island.empty
|
||||
|
@ -109,6 +172,13 @@ top_panel:
|
|||
data:
|
||||
type: TOP
|
||||
index: 10
|
||||
actions:
|
||||
warp:
|
||||
click-type: LEFT
|
||||
tooltip: level.gui.tips.click-to-warp
|
||||
visit:
|
||||
click-type: RIGHT
|
||||
tooltip: level.gui.tips.right-click-to-visit
|
||||
fallback:
|
||||
icon: LIME_STAINED_GLASS_PANE
|
||||
title: level.gui.buttons.island.empty
|
||||
|
|
|
@ -270,6 +270,15 @@ public class LevelsManagerTest {
|
|||
//Map<UUID, Long> tt = lm.getTopTen(world, 10);
|
||||
//assertEquals(1, tt.size());
|
||||
//assertTrue(tt.get(uuid) == 10000);
|
||||
assertEquals(10000L, lm.getIslandMaxLevel(world, uuid));
|
||||
|
||||
results.setLevel(5000);
|
||||
lm.calculateLevel(uuid, island);
|
||||
// Complete the pipelined completable future
|
||||
cf.complete(results);
|
||||
assertEquals(5000L, lm.getLevelsData(island).getLevel());
|
||||
// Still should be 10000
|
||||
assertEquals(10000L, lm.getIslandMaxLevel(world, uuid));
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue