Merge remote-tracking branch 'origin/develop'

This commit is contained in:
tastybento 2019-03-28 19:40:51 -07:00
commit def76296ba
8 changed files with 62 additions and 28 deletions

20
.travis.yml Normal file
View File

@ -0,0 +1,20 @@
language: java
sudo: false
addons:
sonarcloud:
organization: "tastybento-github"
token:
secure: $SONAR_TOKEN
branches:
- develop
- master
jdk:
- openjdk8
script:
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package -P sonar sonar:sonar -B
- echo "${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}"
cache:
directories:
- '$HOME/.m2/repository'
- '$HOME/.sonar/cache'

View File

@ -6,7 +6,7 @@
<groupId>world.bentobox</groupId>
<artifactId>acidisland</artifactId>
<version>1.3.0</version>
<version>1.4.0</version>
<name>AcidIsland</name>
<description>AcidIsland is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland.</description>
@ -91,7 +91,7 @@
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId>
<version>1.3.0</version>
<version>1.4.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@ -245,9 +245,10 @@ public class AISettings implements DataObject, WorldSettings {
@Adapter(FlagSerializer2.class)
private Map<Flag, Integer> defaultIslandSettings = new HashMap<>();
@ConfigComment("These are the settings visible to users. (Not implemented yet)")
@ConfigEntry(path = "world.visible-settings", experimental = true)
private List<String> visibleSettings = new ArrayList<>();
@ConfigComment("These settings/flags are hidden from users")
@ConfigComment("Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings")
@ConfigEntry(path = "world.hidden-flags")
private List<String> hiddenFlags = new ArrayList<>();
@ConfigComment("Visitor banned commands - Visitors to islands cannot use these commands in this world")
@ConfigEntry(path = "world.visitor-banned-commands")
@ -643,11 +644,11 @@ public class AISettings implements DataObject, WorldSettings {
return uniqueId;
}
/**
* @return the visibleSettings
* @return the hidden flags
*/
@Override
public List<String> getVisibleSettings() {
return visibleSettings;
public List<String> getHiddenFlags() {
return hiddenFlags;
}
/**
* @return the visitorbannedcommands
@ -1258,10 +1259,10 @@ public class AISettings implements DataObject, WorldSettings {
}
/**
* @param visibleSettings the visibleSettings to set
* @param hiddenFlags the hidden flags to set
*/
public void setVisibleSettings(List<String> visibleSettings) {
this.visibleSettings = visibleSettings;
public void setHiddenFlags(List<String> hiddenFlags) {
this.hiddenFlags = hiddenFlags;
}
/**

View File

@ -50,7 +50,7 @@ public class AcidIsland extends GameModeAddon {
return false;
}
// Save settings
new Config<>(this, AISettings.class).saveConfigObject(settings);
saveWorldSettings();
return true;
}
@ -74,6 +74,8 @@ public class AcidIsland extends GameModeAddon {
@Override
public void onDisable(){
if (settings == null) {
// Save settings that have changed
new Config<>(this, AISettings.class).saveConfigObject(settings);
return;
}
acidTask.cancelTasks();
@ -142,4 +144,11 @@ public class AcidIsland extends GameModeAddon {
return chunkGenerator;
}
@Override
public void saveWorldSettings() {
if (settings != null) {
new Config<>(this, AISettings.class).saveConfigObject(settings);
}
}
}

View File

@ -8,6 +8,7 @@ import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.commands.island.IslandBanCommand;
import world.bentobox.bentobox.api.commands.island.IslandBanlistCommand;
import world.bentobox.bentobox.api.commands.island.IslandCreateCommand;
import world.bentobox.bentobox.api.commands.island.IslandExpelCommand;
import world.bentobox.bentobox.api.commands.island.IslandGoCommand;
import world.bentobox.bentobox.api.commands.island.IslandInfoCommand;
import world.bentobox.bentobox.api.commands.island.IslandLanguageCommand;
@ -52,6 +53,7 @@ public class AiCommand extends CompositeCommand {
new IslandBanCommand(this);
new IslandUnbanCommand(this);
new IslandBanlistCommand(this);
new IslandExpelCommand(this);
// Team commands
new IslandTeamCommand(this);
}

View File

@ -53,7 +53,7 @@ public class AcidTask {
((LivingEntity) e).damage(addon.getSettings().getAcidDamageMonster());
} else if ((e instanceof Animals) && addon.getSettings().getAcidDamageAnimal() > 0D
&& (!e.getType().equals(EntityType.CHICKEN) || addon.getSettings().isAcidDamageChickens())) {
((LivingEntity) e).damage(addon.getSettings().getAcidDamageMonster());
((LivingEntity) e).damage(addon.getSettings().getAcidDamageAnimal());
}
}), 0L, 20L);
}

View File

@ -207,9 +207,9 @@ world:
MONSTER_SPAWN: true
FIRE_SPREAD: true
PVP_OVERWORLD: false
# These are the settings visible to users. (Not implemented yet)
# /!\ This feature is experimental and might not work as expected or might not work at all.
visible-settings: []
# These settings/flags are hidden from users
# Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings
hidden-flags: []
# Visitor banned commands - Visitors to islands cannot use these commands in this world
visitor-banned-commands:
- spawner

View File

@ -1,9 +1,11 @@
/**
*
*
*/
package world.bentobox.acidisland.commands;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ -41,7 +43,7 @@ public class AiCommandTest {
private User user;
private IslandsManager im;
private Island island;
/**
* @throws java.lang.Exception
*/
@ -78,7 +80,7 @@ public class AiCommandTest {
when(plugin.getIslands()).thenReturn(im);
// Locales
// Return the reference (USE THIS IN THE FUTURE)
// Return the reference (USE THIS IN THE FUTURE)
when(user.getTranslation(Mockito.anyString())).thenAnswer((Answer<String>) invocation -> invocation.getArgumentAt(0, String.class));
}
@ -91,7 +93,7 @@ public class AiCommandTest {
public void testAiCommand() {
Addon addon = mock(Addon.class);
AiCommand cmd = new AiCommand(addon, "ai");
assertEquals("ai", cmd.getLabel());
assertEquals("ai", cmd.getLabel());
}
/**
@ -107,10 +109,10 @@ public class AiCommandTest {
assertEquals("commands.ai.parameters", cmd.getParameters());
assertEquals("commands.island.help.description", cmd.getDescription());
// Number of commands = sub commands + help
assertEquals("Number of sub commands registered", 16, cmd.getSubCommands().values().size());
assertEquals("Number of sub commands registered", 17, cmd.getSubCommands().values().size());
}
/**
* Test method for {@link world.bentobox.acidisland.commands.AiCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/
@ -119,7 +121,7 @@ public class AiCommandTest {
Addon addon = mock(Addon.class);
AiCommand cmd = new AiCommand(addon, "ai");
assertFalse(cmd.execute(null, "ai", Collections.emptyList()));
}
/**
@ -130,9 +132,9 @@ public class AiCommandTest {
Addon addon = mock(Addon.class);
AiCommand cmd = new AiCommand(addon, "ai");
assertFalse(cmd.execute(user, "ai", Collections.singletonList("unknown")));
Mockito.verify(user).sendMessage("general.errors.unknown-command", TextVariables.LABEL, "ai");
Mockito.verify(user).sendMessage("general.errors.unknown-command", TextVariables.LABEL, "ai");
}
/**
* Test method for {@link world.bentobox.acidisland.commands.AiCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/
@ -142,7 +144,7 @@ public class AiCommandTest {
AiCommand cmd = new AiCommand(addon, "ai");
assertTrue(cmd.execute(user, "ai", Collections.emptyList()));
}
/**
* Test method for {@link world.bentobox.acidisland.commands.AiCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/