Skip to content

Commit

Permalink
Slightly improved redability
Browse files Browse the repository at this point in the history
  • Loading branch information
sarhatabaot committed Oct 19, 2024
1 parent 39718cc commit 70b40f5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ public void onLanguage(final Player player, @Optional final String language) {
@CommandPermission("farmassist.player.toggle")
@CommandCompletion("@worlds")
public void onToggle(final Player player, @Optional final String world) {

//todo, merge this with the admin command, or just move the checks somewhere
if (world == null || world.isEmpty()) {
toggleManager.togglePlayer(player.getUniqueId(), player.getWorld());
//send a message toggling that world
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,29 @@ private void load() {

// Fallthrough is on purpose. If the version is 1.20, we also want to execute the code from 1.8. If anyone has a better idea, feel free to submit a PR.
private void loadCrops() {
final List<String> versionsToLoad = new ArrayList<>();
final String jsonCropVersion = Util.getJsonCropVersionFromMinecraftVersion();
switch (jsonCropVersion) {
case "1.20": {
this.crops.putAll(readFileFromJar("1.20.json"));
// load 1.0, 1.8, 1.20
}
case "1.14": {
this.crops.putAll(readFileFromJar("1.14.json"));

}
case "1.9": {
this.crops.putAll(readFileFromJar("1.9.json"));
// load 1.0, 1.9
}
case "1.0": {
this.crops.putAll(readFileFromJar("1.0.json"));
// load 1.0
case "1.20":
versionsToLoad.add("1.20.json");
// Intentional fallthrough
case "1.14":
versionsToLoad.add("1.14.json");
// Intentional fallthrough
case "1.9":
versionsToLoad.add("1.9.json");
// Intentional fallthrough
case "1.0":
versionsToLoad.add("1.0.json");
break;
}
default:
plugin.getLogger().warning(() -> "Unknown/Unsupported Minecraft version: " + jsonCropVersion);
return; // Exit if unsupported version
}

default: {
plugin.getLogger().warning(() -> "Unknown/Unspported Minecraft version: " + jsonCropVersion);
}
// Load all specified versions
for (String version : versionsToLoad) {
this.crops.putAll(readFileFromJar(version));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ private boolean hasPermissionForCrop(final @NotNull Player player, final Crop cr
return player.hasPermission(Util.getCropPermission(cropManager.getCropName(crop)));
}

// TODO
// https://github.com/sarhatabaot/FarmAssistReboot/issues/101
private boolean isNotFullyGrownCrop(final Block block, final Crop crop) {
return XBlock.getAge(block) < crop.getMaximumAge(); //todo bug here with cocoa
return XBlock.getAge(block) < crop.getMaximumAge();
}

public void replant(final Block blockBroken) {
Expand Down

0 comments on commit 70b40f5

Please sign in to comment.