Skip to content

Commit

Permalink
use Integer#parseInt instead of valueOf
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Aug 8, 2024
1 parent 4fb3a16 commit be361f1
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public BlockLimit() {
for (String configuredMaterial : section.getKeys(false)) {
try {
Material blockMaterial = Material.valueOf(configuredMaterial);
Integer maxAmountPerChunk = Integer.valueOf(section.getString(configuredMaterial));
Integer maxAmountPerChunk = Integer.parseInt(section.getString(configuredMaterial));
this.blockLimits.put(blockMaterial, maxAmountPerChunk);
} catch (NumberFormatException e) {
notRecognized(Integer.class, configuredMaterial);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public CustomEntityLimit() {
Make sure your minecraft version is matching as well.""");
for (String configuredEntity : section.getKeys(false)) {
try {
Integer maxAmountPerChunk = Integer.valueOf(section.getString(configuredEntity));
Integer maxAmountPerChunk = Integer.parseInt(section.getString(configuredEntity));
EntityType limitedEntity = EntityType.valueOf(configuredEntity);
entityLimits.put(limitedEntity, maxAmountPerChunk);
} catch (NumberFormatException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public CustomAgeLimits() {
for (String configuredEntity : section.getKeys(false)) {
try {
EntityType limitedEntity = EntityType.valueOf(configuredEntity);
Integer maxAmountPerChunk = Integer.valueOf(section.getString(configuredEntity));
Integer maxAmountPerChunk = Integer.parseInt(section.getString(configuredEntity));
entityLimits.put(limitedEntity, maxAmountPerChunk);
} catch (NumberFormatException e) {
notRecognized(Integer.class, configuredEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public WitherSpawningAtSpawn() {
ConfigSection section = config.getConfigSection(configPath + ".worlds", defaults);
for (String world : section.getKeys(false)) {
try {
Integer radius = Integer.valueOf(section.getString(world));
Integer radius = Integer.parseInt(section.getString(world));
this.worldsAndTheirRadiuses.put(world, radius);
} catch (NumberFormatException e) {
warn("Radius for world '" + world + "' is not a valid integer.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public BlockLimit() {
for (String configuredMaterial : section.getKeys(false)) {
try {
Material blockMaterial = Material.valueOf(configuredMaterial);
Integer maxAmountPerChunk = Integer.valueOf(section.getString(configuredMaterial));
Integer maxAmountPerChunk = Integer.parseInt(section.getString(configuredMaterial));
blockLimits.put(blockMaterial, maxAmountPerChunk);
} catch (NumberFormatException e) {
notRecognized(Integer.class, configuredMaterial);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public CustomEntityLimit() {
for (String configuredEntity : section.getKeys(false)) {
try {
EntityType limitedEntity = EntityType.valueOf(configuredEntity);
Integer maxAmountPerChunk = Integer.valueOf(section.getString(configuredEntity));
Integer maxAmountPerChunk = Integer.parseInt(section.getString(configuredEntity));
entityLimits.put(limitedEntity, maxAmountPerChunk);
} catch (NumberFormatException e) {
notRecognized(Integer.class, configuredEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public CustomAgeLimits() {
for (String configuredEntity : section.getKeys(false)) {
try {
EntityType limitedEntity = EntityType.valueOf(configuredEntity);
Integer maxAmountPerChunk = Integer.valueOf(section.getString(configuredEntity));
Integer maxAmountPerChunk = Integer.parseInt(section.getString(configuredEntity));
entityLimits.put(limitedEntity, maxAmountPerChunk);
} catch (NumberFormatException e) {
notRecognized(Integer.class, configuredEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public WitherSpawningAtSpawn() {
ConfigSection section = config.getConfigSection(configPath + ".worlds", defaults);
for (String world : section.getKeys(false)) {
try {
Integer radius = Integer.valueOf(section.getString(world));
Integer radius = Integer.parseInt(section.getString(world));
this.worldsAndTheirRadiuses.put(world, radius);
} catch (NumberFormatException e) {
warn("Radius for world '" + world + "' is not a valid integer.");
Expand Down

0 comments on commit be361f1

Please sign in to comment.