Skip to content

Commit

Permalink
Had Eclipse reformat all the code
Browse files Browse the repository at this point in the history
This should fix the tab/space issues in the source.
No code changes were made, only formatting.
  • Loading branch information
Challenger2 committed Jul 23, 2017
1 parent 52ee11b commit be90efd
Show file tree
Hide file tree
Showing 11 changed files with 697 additions and 625 deletions.
350 changes: 179 additions & 171 deletions src/main/java/nu/nerd/SpeedBuildArena/SBA.java

Large diffs are not rendered by default.

58 changes: 32 additions & 26 deletions src/main/java/nu/nerd/SpeedBuildArena/SBAConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,65 +11,71 @@

/**
* Load config.yml
*/
*/
public class SBAConfig {

/** Set to true if the config is valid */
public boolean VALID;

/** Add players as owners or members */
public boolean ADD_OWNERS;

/** MineCraft world name where the plots are */
public String WORLD_NAME;

/** Name of the minecraft arena region */
public String ARENA_PLOT_NAME;

/** Name of all the speed build plots */
//public List<String> PLOT_NAMES;
// public List<String> PLOT_NAMES;

/** Plot data */
public List<SBAConfigPlot> PLOTS;

/** List of commands to be executed */
public List<SBACommand> SCRIPT;

/** Not actually in the yml, but we need to know of WGRegionEvents is installed or not */

/**
* Not actually in the yml, but we need to know of WGRegionEvents is
* installed or not
*/
public boolean HAVE_WGREGION_EVENTS;

public void load(SBAPlugin sba) throws Exception {
VALID = false;
sba.reloadConfig();

FileConfiguration config = sba.getConfig();

ADD_OWNERS = config.getBoolean("add_owners", false);

WORLD_NAME = config.getString("world_name", "world");

ARENA_PLOT_NAME = config.getString("arena_plot_name");
if(ARENA_PLOT_NAME == null) {
throw new Exception("Invalid config.yml. \"arena_plot_name\" is missing or corrupt");
if (ARENA_PLOT_NAME == null) {
throw new Exception(
"Invalid config.yml. \"arena_plot_name\" is missing or corrupt");
}

PLOTS = new ArrayList<SBAConfigPlot>();
if(PLOTS == null) {
throw new Exception("Invalid config.yml: \"plots\" missing or corrupt");
if (PLOTS == null) {
throw new Exception(
"Invalid config.yml: \"plots\" missing or corrupt");
}
ConfigurationSection section = config.getConfigurationSection("plots");
for (String key : section.getKeys(false)) {
PLOTS.add(new SBAConfigPlot(section.getConfigurationSection(key)));
}

SCRIPT = SBAFactory.loadFromConfig(config);
if(SCRIPT == null || SCRIPT.isEmpty()) {

if (SCRIPT == null || SCRIPT.isEmpty()) {
throw new Exception("Empty command sequence");
}

HAVE_WGREGION_EVENTS = sba.getServer().getPluginManager().getPlugin("WGRegionEvents") != null;


HAVE_WGREGION_EVENTS = sba.getServer().getPluginManager()
.getPlugin("WGRegionEvents") != null;

VALID = true;
}
}
24 changes: 15 additions & 9 deletions src/main/java/nu/nerd/SpeedBuildArena/SBAConfigPlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,42 @@
*
*/
public class SBAConfigPlot {

private String _regionPlot; /** name of plot's primary region */
private String _regionFloor; /** name of a region that marks the floor. Works with /sba setfloor */


private String _regionPlot;
/** name of plot's primary region */
private String _regionFloor;

/** name of a region that marks the floor. Works with /sba setfloor */

/**
* Load config data from yaml configuration section
*
* @param conf
* @throws Exception
* @throws Exception
*/
public SBAConfigPlot(ConfigurationSection conf) throws Exception {
_regionPlot = conf.getString("region_plot");
if(_regionPlot == null) {
if (_regionPlot == null) {
throw new Exception("region_plot sections cannot be null");
}
_regionFloor = conf.getString("region_floor");
if(_regionFloor == null) {
if (_regionFloor == null) {
throw new Exception("region_floor sections cannot be null");
}
}

/**
* Get the plot's region name
*
* @return Name of the region, or null.
*/
public String getRegionPlot() {
return _regionPlot;
}

/**
* Get the plot's floor region name
*
* @return Name of the region, or null.
*/
public String getRegionFloor() {
Expand Down
24 changes: 15 additions & 9 deletions src/main/java/nu/nerd/SpeedBuildArena/SBAPlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,42 @@
*
*/
public class SBAPlot {

private ProtectedRegion _plot;
private ProtectedRegion _floor;

/**
* Create new plot data object
* @param config Plot config to load
* @param wgrm World Guard Region Manager to pull plots from
*
* @param config
* Plot config to load
* @param wgrm
* World Guard Region Manager to pull plots from
* @throws Exception
*/
public SBAPlot(SBAConfigPlot config, RegionManager wgrm) throws Exception {
_plot = wgrm.getRegion(config.getRegionPlot());
if (_plot == null)
throw new Exception("Cannot find region: " + config.getRegionPlot());
throw new Exception(
"Cannot find region: " + config.getRegionPlot());
_floor = wgrm.getRegion(config.getRegionFloor());
if (_floor == null)
throw new Exception("Cannot find region: " + config.getRegionFloor());
throw new Exception(
"Cannot find region: " + config.getRegionFloor());
}



/**
* Get the plot region
*
* @return The region
*/
public ProtectedRegion getPlot() {
return _plot;
}

/**
* Get the floor region
*
* @return The region
*/
public ProtectedRegion getFloor() {
Expand Down
Loading

0 comments on commit be90efd

Please sign in to comment.