mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2025-01-10 17:58:07 +01:00
parent
f4d7299015
commit
8add41c140
@ -14,6 +14,7 @@ import world.bentobox.level.commands.admin.AdminLevelCommand;
|
|||||||
import world.bentobox.level.commands.admin.AdminTopCommand;
|
import world.bentobox.level.commands.admin.AdminTopCommand;
|
||||||
import world.bentobox.level.commands.island.IslandLevelCommand;
|
import world.bentobox.level.commands.island.IslandLevelCommand;
|
||||||
import world.bentobox.level.commands.island.IslandTopCommand;
|
import world.bentobox.level.commands.island.IslandTopCommand;
|
||||||
|
import world.bentobox.level.commands.island.IslandValueCommand;
|
||||||
import world.bentobox.level.config.Settings;
|
import world.bentobox.level.config.Settings;
|
||||||
import world.bentobox.level.listeners.IslandTeamListeners;
|
import world.bentobox.level.listeners.IslandTeamListeners;
|
||||||
import world.bentobox.level.listeners.JoinLeaveListener;
|
import world.bentobox.level.listeners.JoinLeaveListener;
|
||||||
@ -128,6 +129,7 @@ public class Level extends Addon {
|
|||||||
gm.getPlayerCommand().ifPresent(playerCmd -> {
|
gm.getPlayerCommand().ifPresent(playerCmd -> {
|
||||||
new IslandLevelCommand(this, playerCmd);
|
new IslandLevelCommand(this, playerCmd);
|
||||||
new IslandTopCommand(this, playerCmd);
|
new IslandTopCommand(this, playerCmd);
|
||||||
|
new IslandValueCommand(this, playerCmd);
|
||||||
});
|
});
|
||||||
// Register placeholders
|
// Register placeholders
|
||||||
if (getPlugin().getPlaceholdersManager() != null) {
|
if (getPlugin().getPlaceholdersManager() != null) {
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
package world.bentobox.level.commands.island;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||||
|
import world.bentobox.bentobox.api.user.User;
|
||||||
|
import world.bentobox.level.Level;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class IslandValueCommand extends CompositeCommand {
|
||||||
|
private final Level plugin;
|
||||||
|
|
||||||
|
public IslandValueCommand(Level plugin, CompositeCommand parent) {
|
||||||
|
super(parent, "value");
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup() {
|
||||||
|
this.setPermission("island.value");
|
||||||
|
this.setDescription("island.value.description");
|
||||||
|
this.setOnlyPlayer(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(User user, String label, List<String> args) {
|
||||||
|
Player player = user.getPlayer();
|
||||||
|
PlayerInventory inventory = player.getInventory();
|
||||||
|
if (!inventory.getItemInMainHand().getType().equals(Material.AIR)) {
|
||||||
|
Material material = inventory.getItemInMainHand().getType();
|
||||||
|
if (plugin.getConfig().get("blocks." + material.toString()) != null) {
|
||||||
|
int value = plugin.getConfig().getInt("blocks." + material.toString());
|
||||||
|
user.sendMessage("island.value.success", "[value]", value + "");
|
||||||
|
if (plugin.getConfig().get("underwater") != null) {
|
||||||
|
Double underWater = plugin.getConfig().getDouble("underwater");
|
||||||
|
if (underWater > 1.0) {
|
||||||
|
user.sendMessage("island.value.success-underwater", "[value]", (underWater * value) + "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
user.sendMessage("island.value.no-value");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
user.sendMessage("island.value.empty-hand");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -16,6 +16,9 @@ permissions:
|
|||||||
bskyblock.island.top:
|
bskyblock.island.top:
|
||||||
description: Player can use top ten command
|
description: Player can use top ten command
|
||||||
default: true
|
default: true
|
||||||
|
bskyblock.island.value:
|
||||||
|
description: Player can use value command
|
||||||
|
default: true
|
||||||
bskyblock.admin.level:
|
bskyblock.admin.level:
|
||||||
description: Player can use admin level command
|
description: Player can use admin level command
|
||||||
default: true
|
default: true
|
||||||
@ -32,6 +35,9 @@ permissions:
|
|||||||
acidisland.island.top:
|
acidisland.island.top:
|
||||||
description: Player can use top ten command
|
description: Player can use top ten command
|
||||||
default: true
|
default: true
|
||||||
|
acidisland.island.value:
|
||||||
|
description: Player can use value command
|
||||||
|
default: true
|
||||||
acidisland.admin.level:
|
acidisland.admin.level:
|
||||||
description: Player can use admin level command
|
description: Player can use admin level command
|
||||||
default: true
|
default: true
|
||||||
@ -48,6 +54,9 @@ permissions:
|
|||||||
caveblock.island.top:
|
caveblock.island.top:
|
||||||
description: Player can use top ten command
|
description: Player can use top ten command
|
||||||
default: true
|
default: true
|
||||||
|
caveblock.island.value:
|
||||||
|
description: Player can use value command
|
||||||
|
default: true
|
||||||
caveblock.admin.level:
|
caveblock.admin.level:
|
||||||
description: Player can use admin level command
|
description: Player can use admin level command
|
||||||
default: true
|
default: true
|
||||||
@ -64,6 +73,9 @@ permissions:
|
|||||||
skygird.island.top:
|
skygird.island.top:
|
||||||
description: Player can use top ten command
|
description: Player can use top ten command
|
||||||
default: true
|
default: true
|
||||||
|
skygird.island.value:
|
||||||
|
description: Player can use value command
|
||||||
|
default: true
|
||||||
skygird.admin.level:
|
skygird.admin.level:
|
||||||
description: Player can use admin level command
|
description: Player can use admin level command
|
||||||
default: true
|
default: true
|
||||||
|
@ -29,3 +29,9 @@ island:
|
|||||||
island-level: "&BLevel [level]"
|
island-level: "&BLevel [level]"
|
||||||
warp-to: "&AWarping to [name]'s island"
|
warp-to: "&AWarping to [name]'s island"
|
||||||
|
|
||||||
|
value:
|
||||||
|
description: "shows the value of any block"
|
||||||
|
success: "§7The value of this block is: §e[value]"
|
||||||
|
success-underwater: "§7The value of this block below sea-level: §e[value]"
|
||||||
|
empty-hand: "§cThere are no blocks in your hand"
|
||||||
|
no-value: "§cThat item has no value."
|
Loading…
Reference in New Issue
Block a user