mirror of
https://github.com/BentoBoxWorld/AcidIsland.git
synced 2024-11-23 02:55:21 +01:00
Update to BentoBox 1.4.0 API
This commit is contained in:
parent
7a7c34af56
commit
c8cbbe717e
2
pom.xml
2
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>
|
||||
|
@ -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")
|
||||
@ -646,8 +647,8 @@ public class AISettings implements DataObject, WorldSettings {
|
||||
* @return the visibleSettings
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
@ -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