Skip to content

Commit

Permalink
Fixed %mine% replacement text showing and not being replaced for play…
Browse files Browse the repository at this point in the history
…er messages on automated single mine filling

Fixed spacing of time units
  • Loading branch information
JamieS1211 committed Mar 27, 2018
1 parent 582001f commit f2ef3b0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
defaultTasks 'build', 'shadowJar'

group = 'io.github.jamies1211.minereset'
version = '1.0.10'
version = '1.0.11'
description = 'MineReset'
sourceCompatibility = 1.8

Expand Down
9 changes: 4 additions & 5 deletions src/main/java/com/github/jamies1211/minereset/MineReset.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
*/

@SuppressWarnings("ArraysAsListWithZeroOrOneArgument")
@Plugin(id = "minereset", name = "MineReset", version = "1.0.10",
@Plugin(id = "minereset", name = "MineReset", version = "1.0.11",
description = "Resets mines",
authors = {"JamieS1211"},
url = "http://pixelmonweb.officialtjp.com")
Expand Down Expand Up @@ -534,13 +534,12 @@ public void cycle() {

} else {

if (!SendMessages.messageToAllPlayers(fillingChatType, minePrefix + listOfMines + " " + resettingNowSingular) &&
fillingChatType != 0) {
if (!SendMessages.messageToAllPlayers(fillingChatType, minePrefix + resettingNowSingular.replace("%mine%", listOfMines.toString()))
&& fillingChatType != 0) {
MessageChannel.TO_CONSOLE.send(TextSerializers.FORMATTING_CODE.deserialize(minePrefix + invalidFillChatType));
}

MessageChannel.TO_CONSOLE.send(TextSerializers.FORMATTING_CODE.deserialize(minePrefix +
listOfMines + " " + resettingNowSingular));
MessageChannel.TO_CONSOLE.send(TextSerializers.FORMATTING_CODE.deserialize(minePrefix + resettingNowSingular.replace("%mine%", listOfMines.toString())));

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,38 @@ public static String secondsToTimeString(int totalSeconds) {
final int hours = ((((totalSeconds - seconds) / 60) - minutes) / 60); // Hours rounded down.


String secondUnit = Messages.secondUnitPlural;
String minuteUnit = Messages.minuteUnitPlural;
String hourUnit = Messages.hourUnitPlural;
String secondUnit = Messages.secondUnitPlural + " ";
String minuteUnit = Messages.minuteUnitPlural + " ";
String hourUnit = Messages.hourUnitPlural + " ";

String secondsString = Integer.toString(seconds);
String minutesString = Integer.toString(minutes);
String hoursString = Integer.toString(hours);

if (seconds == 1) { // Removes plural if not needed.
secondUnit = Messages.secondUnitSingular;
secondUnit = Messages.secondUnitSingular + " ";
} else if (seconds == 0 && (hours != 0 || minutes != 0)) {
secondsString = "";
secondUnit = "";
}

if (minutes == 1) { // Removes plural if not needed.
minuteUnit = Messages.minuteUnitSingular;
minuteUnit = Messages.minuteUnitSingular + " ";
} else if (minutes == 0) {
minutesString = "";
minuteUnit = "";
}

if (hours == 1) { // Removes plural if not needed.
hourUnit = Messages.hourUnitSingular;
hourUnit = Messages.hourUnitSingular + " ";
} else if (hours == 0) {
hoursString = "";
hourUnit = "";
}



return hoursString + hourUnit + " " + minutesString + minuteUnit + " " + secondsString + secondUnit + " ";
return hoursString + hourUnit + minutesString + minuteUnit + secondsString + secondUnit;
}

}

0 comments on commit f2ef3b0

Please sign in to comment.