Merge remote-tracking branch 'origin/develop'

This commit is contained in:
tastybento 2020-05-05 16:58:53 -07:00
commit 331f192cd9
8 changed files with 86 additions and 11 deletions

View File

@ -59,13 +59,13 @@
<powermock.version>2.0.4</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.15-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.11.0</bentobox.version>
<bentobox.version>1.13.0-SNAPSHOT</bentobox.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>1.12.0</build.version>
<build.version>1.13.0</build.version>
</properties>
<!-- Profiles will allow to automatically change build version. -->

View File

@ -50,7 +50,11 @@ public class AISettings implements WorldSettings {
@ConfigComment("The island admin command.")
@ConfigEntry(path = "acid.command.admin")
private String adminCommand = "acid";
@ConfigComment("Use control panel if it exists (ControlPanel addon must be in addons)")
@ConfigEntry(path = "acid.use-control-panel", since = "1.13.0")
private boolean useControlPanel = false;
// Damage
@ConfigComment("Damage that a player will experience in acid. 10 is half their health typically. 5 would be easier.")
@ -319,6 +323,18 @@ public class AISettings implements WorldSettings {
@ConfigEntry(path = "island.max-team-size")
private int maxTeamSize = 4;
@ConfigComment("Default maximum number of coop rank members per island")
@ConfigComment("Players can have the acidisland.coop.maxsize.<number> permission to be bigger but")
@ConfigComment("permission size cannot be less than the default below. ")
@ConfigEntry(path = "island.max-coop-size", since = "1.13.0")
private int maxCoopSize = 4;
@ConfigComment("Default maximum number of trusted rank members per island")
@ConfigComment("Players can have the acidisland.trust.maxsize.<number> permission to be bigger but")
@ConfigComment("permission size cannot be less than the default below. ")
@ConfigEntry(path = "island.max-trusted-size", since = "1.13.0")
private int maxTrustSize = 4;
@ConfigComment("Default maximum number of homes a player can have. Min = 1")
@ConfigComment("Accessed via /ai sethome <number> or /ai go <number>")
@ConfigComment("Use this permission to set for specific user groups: acidisland.island.maxhomes.<number>")
@ -1693,4 +1709,45 @@ public class AISettings implements WorldSettings {
public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) {
this.ticksPerMonsterSpawns = ticksPerMonsterSpawns;
}
/**
* @return the useControlPanel
*/
public boolean isUseControlPanel() {
return useControlPanel;
}
/**
* @param useControlPanel the useControlPanel to set
*/
public void setUseControlPanel(boolean useControlPanel) {
this.useControlPanel = useControlPanel;
}
/**
* @return the maxCoopSize
*/
@Override
public int getMaxCoopSize() {
return maxCoopSize;
}
/**
* @param maxCoopSize the maxCoopSize to set
*/
public void setMaxCoopSize(int maxCoopSize) {
this.maxCoopSize = maxCoopSize;
}
/**
* @return the maxTrustSize
*/
@Override
public int getMaxTrustSize() {
return maxTrustSize;
}
/**
* @param maxTrustSize the maxTrustSize to set
*/
public void setMaxTrustSize(int maxTrustSize) {
this.maxTrustSize = maxTrustSize;
}
}

View File

@ -5,7 +5,6 @@ import java.util.List;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.commands.admin.AdminDeleteCommand;
import world.bentobox.bentobox.api.commands.admin.AdminEmptyTrashCommand;
import world.bentobox.bentobox.api.commands.admin.AdminGetrankCommand;
import world.bentobox.bentobox.api.commands.admin.AdminInfoCommand;
import world.bentobox.bentobox.api.commands.admin.AdminRegisterCommand;
@ -15,9 +14,7 @@ import world.bentobox.bentobox.api.commands.admin.AdminSetrankCommand;
import world.bentobox.bentobox.api.commands.admin.AdminSetspawnCommand;
import world.bentobox.bentobox.api.commands.admin.AdminSettingsCommand;
import world.bentobox.bentobox.api.commands.admin.AdminSwitchCommand;
import world.bentobox.bentobox.api.commands.admin.AdminSwitchtoCommand;
import world.bentobox.bentobox.api.commands.admin.AdminTeleportCommand;
import world.bentobox.bentobox.api.commands.admin.AdminTrashCommand;
import world.bentobox.bentobox.api.commands.admin.AdminUnregisterCommand;
import world.bentobox.bentobox.api.commands.admin.AdminVersionCommand;
import world.bentobox.bentobox.api.commands.admin.AdminWhyCommand;
@ -81,9 +78,9 @@ public class AcidCommand extends CompositeCommand {
// Reset flags
new AdminResetFlagsCommand(this);
// Trash
new AdminTrashCommand(this);
new AdminEmptyTrashCommand(this);
new AdminSwitchtoCommand(this);
//new AdminTrashCommand(this);
//new AdminEmptyTrashCommand(this);
//new AdminSwitchtoCommand(this);
// Switch
new AdminSwitchCommand(this);
// Purge

View File

@ -3,6 +3,7 @@ package world.bentobox.acidisland.commands;
import java.util.ArrayList;
import java.util.List;
import world.bentobox.acidisland.AcidIsland;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.commands.island.IslandBanCommand;
@ -71,8 +72,13 @@ public class AiCommand extends CompositeCommand {
if (args.isEmpty()) {
// If in world, go
if (getPlugin().getIslands().getIsland(getWorld(), user.getUniqueId()) != null) {
return getSubCommand("go").map(goCmd -> goCmd.call(user, label, new ArrayList<>())).orElse(false);
if (((AcidIsland)getAddon()).getSettings().isUseControlPanel()
&& getSubCommand("controlpanel").isPresent()) {
return getSubCommand("controlpanel").get().call(user, label, new ArrayList<>());
}
return getSubCommand("go").map(goCmd -> goCmd.call(user, goCmd.getLabel(), new ArrayList<>())).orElse(false);
}
// No islands currently
return getSubCommand("create").map(createCmd -> createCmd.call(user, label, new ArrayList<>())).orElse(false);
}

View File

@ -23,7 +23,7 @@ public class IslandAboutCommand extends CompositeCommand {
@Override
public boolean execute(User user, String label, List<String> args) {
user.sendRawMessage("About " + getAddon().getDescription().getName() + " " + getAddon().getDescription().getVersion() + ":");
user.sendRawMessage("Copyright (c) 2017 - 2019 tastybento");
user.sendRawMessage("Copyright (c) 2017 - 2020 tastybento");
user.sendRawMessage("See https://www.eclipse.org/legal/epl-2.0/ for license information.");
return true;
}

View File

@ -48,6 +48,8 @@ public class AcidTask {
entityBurnTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(addon.getPlugin(), () -> getEntityStream()
// These entities are immune to acid
.filter(e -> !IMMUNE.contains(e.getType()))
// Only burn if the chunk is loaded
.filter(e -> e.getLocation().getChunk().isLoaded())
.filter(w -> w.getLocation().getBlock().getType().equals(Material.WATER))
.forEach(e -> {
if ((e instanceof Monster || e instanceof MagmaCube) && addon.getSettings().getAcidDamageMonster() > 0D) {
@ -89,6 +91,7 @@ public class AcidTask {
Set<Entity> newItemsInWater = new HashSet<>();
getEntityStream()
.filter(e -> e.getType().equals(EntityType.DROPPED_ITEM))
.filter(e -> e.getLocation().getChunk().isLoaded())
.filter(e -> e.getLocation().getBlock().getType().equals(Material.WATER)
|| (e.getLocation().getY() > 0 && e.getLocation().getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.WATER)))
.forEach(e -> {

View File

@ -9,6 +9,8 @@ acid:
island: ai
# The island admin command.
admin: acid
# Use control panel if it exists (ControlPanel addon must be in addons)
use-control-panel: false
damage:
acid:
# Damage that a player will experience in acid. 10 is half their health typically. 5 would be easier.
@ -298,6 +300,16 @@ island:
# Use this permission to set for specific user groups: acidisland.team.maxsize.<number>
# Permission size cannot be less than the default below.
max-team-size: 4
# Default maximum number of coop rank members per island
# Players can have the acidisland.coop.maxsize.<number> permission to be bigger but
# permission size cannot be less than the default below.
# Added since 1.13.0.
max-coop-size: 4
# Default maximum number of trusted rank members per island
# Players can have the acidisland.trust.maxsize.<number> permission to be bigger but
# permission size cannot be less than the default below.
# Added since 1.13.0.
max-trusted-size: 4
# Default maximum number of homes a player can have. Min = 1
# Accessed via /ai sethome <number> or /ai go <number>
# Use this permission to set for specific user groups: acidisland.island.maxhomes.<number>

View File

@ -36,7 +36,7 @@ import world.bentobox.bentobox.managers.FlagsManager;
@PrepareForTest({Bukkit.class, BentoBox.class, User.class })
public class AcidCommandTest {
private static final int NUM_COMMANDS = 29;
private static final int NUM_COMMANDS = 26;
@Mock
private User user;
@Mock