mirror of
https://github.com/BentoBoxWorld/AcidIsland.git
synced 2025-01-24 17:11:20 +01:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
def76296ba
20
.travis.yml
Normal file
20
.travis.yml
Normal 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'
|
4
pom.xml
4
pom.xml
@ -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>
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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)}.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user