Skip to content

Commit

Permalink
Add ability to change user and admin command for SkyGrid. (#11)
Browse files Browse the repository at this point in the history
Other GameMode add-ons already has this ability.
  • Loading branch information
BONNe authored and tastybento committed Feb 20, 2019
1 parent 47a3b92 commit 9a878b9
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 3 deletions.
51 changes: 51 additions & 0 deletions src/main/java/world/bentobox/skygrid/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@
@ConfigComment("")
public class Settings implements DataObject, WorldSettings {

/* Commands */
@ConfigComment("Island Command. What command users will run to access their island.")
@ConfigComment("To define alias, just separate commands with white space.")
@ConfigEntry(path = "skygrid.command.island")
private String islandCommand = "skygrid sg";

@ConfigComment("The island admin command.")
@ConfigComment("To define alias, just separate commands with white space.")
@ConfigEntry(path = "skygrid.command.admin")
private String adminCommand = "sgadmin sga";

/* Blocks */
@ConfigComment("World block types. If the material cannot be placed, bedrock will be used.")
@ConfigComment("Format: Material : Probability")
Expand Down Expand Up @@ -1044,4 +1055,44 @@ public boolean isWaterUnsafe() {
}


/**
* This method returns the islandCommand object.
* @return the islandCommand object.
*/
public String getIslandCommand()
{
return islandCommand;
}


/**
* This method returns the adminCommand object.
* @return the adminCommand object.
*/
public String getAdminCommand()
{
return adminCommand;
}


/**
* This method sets the islandCommand object value.
* @param islandCommand the islandCommand object new value.
*
*/
public void setIslandCommand(String islandCommand)
{
this.islandCommand = islandCommand;
}


/**
* This method sets the adminCommand object value.
* @param adminCommand the adminCommand object new value.
*
*/
public void setAdminCommand(String adminCommand)
{
this.adminCommand = adminCommand;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
public class AdminCommand extends CompositeCommand {

public AdminCommand(SkyGrid addon) {
super(addon, "sgadmin");
super(addon,
addon.getSettings().getAdminCommand().split(" ")[0],
addon.getSettings().getAdminCommand().split(" "));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
public class SkyGridCommand extends CompositeCommand {

public SkyGridCommand(SkyGrid addon) {
super(addon, "skygrid", "sg");
super(addon,
addon.getSettings().getIslandCommand().split(" ")[0],
addon.getSettings().getIslandCommand().split(" "));
}

/* (non-Javadoc)
Expand Down
10 changes: 9 additions & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# SkyGrid Configuration ${version}
#
#
skygrid:
command:
# Island Command. What command users will run to access their island.
# To define alias, just separate commands with white space.
island: skygrid sg
# The island admin command.
# To define alias, just separate commands with white space.
admin: sgadmin sga
world:
# World block types. If the material cannot be placed, bedrock will be used.
# Format: Material : Probability
Expand Down

0 comments on commit 9a878b9

Please sign in to comment.