Skip to content

Commit

Permalink
Changed configurable limits to float.
Browse files Browse the repository at this point in the history
  • Loading branch information
dscalzi committed Mar 13, 2017
1 parent da44c1d commit 762c56c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/com/dscalzi/skychanger/MainExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ private void cmdChangeSky(CommandSender sender, String[] args){
return;
}
if(!sender.hasPermission("skychanger.bypasslimit")){
int upper = ConfigManager.getInstance().getUpperLimit();
int lower = ConfigManager.getInstance().getLowerLimit();
float upper = ConfigManager.getInstance().getUpperLimit();
float lower = ConfigManager.getInstance().getLowerLimit();
if(pN > upper){
mm.outOfBoundsUpper(sender, upper);
return;
Expand Down
8 changes: 4 additions & 4 deletions src/com/dscalzi/skychanger/managers/ConfigManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ public static ConfigManager getInstance(){

/* Configuration Accessors */

public int getUpperLimit(){
return config.getInt("general_settings.upper_limit", 50);
public float getUpperLimit(){
return Float.parseFloat(config.getString("general_settings.upper_limit", "50.0"));
}

public int getLowerLimit(){
return config.getInt("general_settings.lower_limit", 50);
public float getLowerLimit(){
return Float.parseFloat(config.getString("general_settings.lower_limit", "50.0"));
}

public boolean metricsOptOut(){
Expand Down
6 changes: 3 additions & 3 deletions src/com/dscalzi/skychanger/managers/MessageManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ public void packetError(CommandSender sender, String name){
sendError(sender, "Failed to send packet to " + name + ".");
}

public void outOfBoundsUpper(CommandSender sender, int limit){
sendError(sender, "The packet number must not exceed " + limit + ".");
public void outOfBoundsUpper(CommandSender sender, float upper){
sendError(sender, "The packet number must not exceed " + upper + ".");
}

public void outOfBoundsLower(CommandSender sender, int limit){
public void outOfBoundsLower(CommandSender sender, float limit){
sendError(sender, "The packet number must not be smaller than " + limit + ".");
}

Expand Down
10 changes: 6 additions & 4 deletions src/com/dscalzi/skychanger/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ ConfigVersion: 1.0
#--------------[General Settings]---------------
general_settings:

# Upper packet limit.
upper_limit: 50
# Upper packet limit. Scientific notation is accepted.
# Must be less than 3.4028236E38 or there will be no limit.
upper_limit: 50.0

# Lower packet limit.
lower_limit: -50
# Lower packet limit. Scientific notation is accepted.
# Must be greater than -3.4028236E38 or there will be no limit.
lower_limit: -50.0

# Opt out of metrics collection by https://bstats.org/
# Note that if opting out you must fully restart
Expand Down

0 comments on commit 762c56c

Please sign in to comment.