Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
tastybento 2019-03-12 19:38:43 -07:00
commit bcfb5f2155
9 changed files with 134 additions and 68 deletions

33
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
---
**Description**
A clear and concise description of what the bug is.
**Steps to reproduce the behavior:**
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Server Information:**
[Please complete the following information:]
- Database being used (YAML, JSON, MySQL, MongoDB): []
- OS: [e.g. iOS]
- Java Version: [e.g. Java 8]
- BentoBox version: [e.g. 1.7.2.21]
- Addons installed? [Do '/bentobox version' and copy/paste from the console]
- Other plugins? [Do '/plugins' and copy/paste from the console]
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -1,6 +1,6 @@
# addon-level
# Level
Add-on for BentoBox to calculate island levels for BSkyBlock and AcidIsland. This add-on will work
for both game modes.
for game modes listed in the config.yml.
## How to use
@ -10,20 +10,23 @@ for both game modes.
4. Edit the config.yml how you want. The config specifies how much blocks are worth (see below)
5. Restart the server if you make a change
## Upgrading
1. Read the release notes carefully, but you may have to delete the old config.yml to use a new one.
## Config.yml
The config.yml has the following sections:
* Command hook-in configuration
* Game Mode Addon configuration
* General settings
* Limits
* Block values
* Per-world block values
### Command hook-in configuration
### Game Mode Addon configuration
This section allows you to tell the add-on which commands it should hook into. Do not edit this unless
you are changing the game mode command names.
This section allows you to list which game mode add-ons Level should hook into. Use BentoBox's version command to list the official add-on name.
### General Settings

59
pom.xml
View File

@ -6,7 +6,7 @@
<groupId>world.bentobox</groupId>
<artifactId>level</artifactId>
<version>1.2.2-SNAPSHOT</version>
<version>1.4.0-SNAPSHOT</version>
<name>Level</name>
<description>Level is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland.</description>
@ -169,14 +169,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<minimizeJar>false</minimizeJar>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
@ -187,56 +179,7 @@
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.1</version>
<configuration>
<append>true</append>
</configuration>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>sonar</id>
<properties>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>bentobox-world</sonar.organization>
<sonar.projectKey>BentoBoxWorld_Level</sonar.projectKey>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.4.1.1168</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sonar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -14,6 +14,7 @@ import world.bentobox.level.commands.admin.AdminLevelCommand;
import world.bentobox.level.commands.admin.AdminTopCommand;
import world.bentobox.level.commands.island.IslandLevelCommand;
import world.bentobox.level.commands.island.IslandTopCommand;
import world.bentobox.level.commands.island.IslandValueCommand;
import world.bentobox.level.config.Settings;
import world.bentobox.level.listeners.IslandTeamListeners;
import world.bentobox.level.listeners.JoinLeaveListener;
@ -130,6 +131,7 @@ public class Level extends Addon {
gm.getPlayerCommand().ifPresent(playerCmd -> {
new IslandLevelCommand(this, playerCmd);
new IslandTopCommand(this, playerCmd);
new IslandValueCommand(this, playerCmd);
});
// Register placeholders
if (getPlugin().getPlaceholdersManager() != null) {

View File

@ -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;
}
}

View File

@ -16,6 +16,9 @@ permissions:
bskyblock.island.top:
description: Player can use top ten command
default: true
bskyblock.island.value:
description: Player can use value command
default: true
bskyblock.admin.level:
description: Player can use admin level command
default: true
@ -32,6 +35,9 @@ permissions:
acidisland.island.top:
description: Player can use top ten command
default: true
acidisland.island.value:
description: Player can use value command
default: true
acidisland.admin.level:
description: Player can use admin level command
default: true
@ -48,6 +54,9 @@ permissions:
caveblock.island.top:
description: Player can use top ten command
default: true
caveblock.island.value:
description: Player can use value command
default: true
caveblock.admin.level:
description: Player can use admin level command
default: true
@ -64,6 +73,9 @@ permissions:
skygird.island.top:
description: Player can use top ten command
default: true
skygird.island.value:
description: Player can use value command
default: true
skygird.admin.level:
description: Player can use admin level command
default: true

View File

@ -1,7 +1,7 @@
# Config file for Level add-on for BSkyBlock or AcidIsland
# Config file for Level add-on Version ${version}
# GameModes
# Level will hook into these game modes. Don't forget to set any world-specific
# Game Mode Addons
# Level will hook into these game mode addons. Don't forget to set any world-specific
# block values below!
game-modes:
- AcidIsland

View File

@ -28,4 +28,10 @@ island:
gui-heading: "&6[name]: &B[rank]"
island-level: "&BLevel [level]"
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."