mirror of
https://github.com/BentoBoxWorld/BSkyBlock.git
synced 2024-11-05 09:17:34 +01:00
Use control panel if it exists. (#260)
* Use control panel if it exists. * Added config option for use-control-panel * Updated copyright date on About command. * Fixes test
This commit is contained in:
parent
981f28e230
commit
812a9727df
@ -40,6 +40,10 @@ public class Settings implements WorldSettings {
|
||||
@ConfigEntry(path = "bskyblock.command.admin", since = "1.3.0")
|
||||
private String adminCommand = "bsbadmin bsb skyblockadmin sbadmin sba";
|
||||
|
||||
@ConfigComment("Use control panel if it exists (ControlPanel addon must be in addons)")
|
||||
@ConfigEntry(path = "bskyblock.use-control-panel", since = "1.13.0")
|
||||
private boolean useControlPanel = false;
|
||||
|
||||
/* WORLD */
|
||||
@ConfigComment("Friendly name for this world. Used in admin commands. Must be a single word")
|
||||
@ConfigEntry(path = "world.friendly-name")
|
||||
@ -224,13 +228,13 @@ public class Settings implements WorldSettings {
|
||||
@ConfigComment("Permission size cannot be less than the default below. ")
|
||||
@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 bskyblock.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 bskyblock.trust.maxsize.<number> permission to be bigger but")
|
||||
@ConfigComment("permission size cannot be less than the default below. ")
|
||||
@ -1608,4 +1612,18 @@ public class Settings implements WorldSettings {
|
||||
public void setMaxTrustSize(int maxTrustSize) {
|
||||
this.maxTrustSize = maxTrustSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the useControlPanel
|
||||
*/
|
||||
public boolean isUseControlPanel() {
|
||||
return useControlPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param useControlPanel the useControlPanel to set
|
||||
*/
|
||||
public void setUseControlPanel(boolean useControlPanel) {
|
||||
this.useControlPanel = useControlPanel;
|
||||
}
|
||||
}
|
||||
|
@ -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, Poslovitch");
|
||||
user.sendRawMessage("Copyright (c) 2017 - 2020 tastybento, Poslovitch");
|
||||
user.sendRawMessage("See https://www.eclipse.org/legal/epl-2.0/");
|
||||
user.sendRawMessage("for license information.");
|
||||
return true;
|
||||
|
@ -73,6 +73,10 @@ public class IslandCommand extends CompositeCommand {
|
||||
if (args.isEmpty()) {
|
||||
// If user has an island, go
|
||||
if (getPlugin().getIslands().getIsland(getWorld(), user.getUniqueId()) != null) {
|
||||
if (((BSkyBlock)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
|
||||
|
@ -9,6 +9,8 @@ bskyblock:
|
||||
# To define alias, just separate commands with white space.
|
||||
# Added since 1.3.0.
|
||||
admin: bsbadmin bsb skyblockadmin sbadmin sba
|
||||
# Use control panel if it exists (ControlPanel addon must be in addons)
|
||||
use-control-panel: false
|
||||
world:
|
||||
# Friendly name for this world. Used in admin commands. Must be a single word
|
||||
friendly-name: BSkyBlock
|
||||
|
@ -33,7 +33,7 @@ public class IslandAboutCommandTest {
|
||||
User user = mock(User.class);
|
||||
c.execute(user, "", Collections.emptyList());
|
||||
// Verify
|
||||
Mockito.verify(user).sendRawMessage(Mockito.eq("Copyright (c) 2017 - 2019 tastybento, Poslovitch"));
|
||||
Mockito.verify(user).sendRawMessage(Mockito.eq("Copyright (c) 2017 - 2020 tastybento, Poslovitch"));
|
||||
Mockito.verify(user).sendRawMessage(Mockito.eq("About BSkyBlock 1.2.3:"));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user