Add QOL Improvements#2
Conversation
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip |
There was a problem hiding this comment.
This Gradle version is severely out of date. We should be using at least Gradle 9.
There was a problem hiding this comment.
I would agree, but since this is voluntary work I do not care about updating my stuff to latest. Can break stuff in production anyway. Our system is still on 1.16..
| @@ -0,0 +1,81 @@ | |||
| package com.gmail.val59000mc.commands; | |||
There was a problem hiding this comment.
What on earth is this package name???
There was a problem hiding this comment.
It is the commands subpackage, where all commands are stored.....
| if(gameManager.getGameState().equals(GameState.WAITING)) { | ||
| String kitName = String.join(" ", args); | ||
| Kit kit = KitsManager.getKitByArgument(kitName); | ||
| if(kit == null) { | ||
| player.sendMessage(Lang.COMMAND_KIT_DOESNT_EXIST); | ||
| return true; | ||
| } | ||
|
|
||
| UhcPlayer uhcPlayer = playerManager.getUhcPlayer(player); | ||
|
|
||
| if(kit.canBeUsedBy(player, config)) { | ||
| uhcPlayer.setKit(kit); | ||
| uhcPlayer.sendMessage(Lang.ITEMS_KIT_SELECTED.replace("%kit%", kit.getName())); | ||
| } else { | ||
| uhcPlayer.sendMessage(Lang.ITEMS_KIT_NO_PERMISSION); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| return true; |
There was a problem hiding this comment.
Invert this condition and use a guard clause.
| List<String> options = new ArrayList<>(); | ||
|
|
||
| if(args.length == 1) { | ||
| if(!args[0].equals("")) { | ||
| for(Kit kit : KitsManager.getKits()) { | ||
| if(kit.getName().toLowerCase().startsWith(args[0].toLowerCase())) options.add(kit.getName()); | ||
| } | ||
| } else { | ||
| options = KitsManager.getKits().stream().map(Kit::getName).collect(Collectors.toList()); | ||
| } | ||
| } |
| return options; | ||
| } | ||
|
|
||
| } No newline at end of file |
| sourceCompatibility = 11 | ||
| targetCompatibility = 11 |
There was a problem hiding this comment.
This is 10 major versions behind, are you okay?
| @@ -64,18 +70,25 @@ dependencies { | |||
| //shadow 'org.spigotmc:spigot-api:1.15.2-R0.1-SNAPSHOT' | |||
| shadow 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT' | |||
There was a problem hiding this comment.
Please target latest minecraft, 1.21.10
| minimize() | ||
| } | ||
|
|
||
| build.dependsOn(shadowJar) No newline at end of file |
| @@ -1,2 +1,2 @@ | |||
| pluginGroup=com.gmail.val59000mc | |||
| pluginVersion=1.19.2 No newline at end of file | |||
| pluginVersion=1.20.0 No newline at end of file | |||
|
|
||
| # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||
| DEFAULT_JVM_OPTS='"-Xmx64m"' | ||
| DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' |
There was a problem hiding this comment.
...why is the heap only 64m big???? this review is a joke, but how did this ever work???
/kit <kit>command to make it easier to select a preferred kit/readycommand to make it easier to toggle the team ready state/scenarios vote <scenario>command to make it easier to vote for a specific scenarioThis also includes small additions/tweaks to the API to allow the above features to run smoothly
QOL Improvemnts suggested by Stixil #1