Updates some KnarLib code
All checks were successful
KnarCraft/PlayerPayouts/pipeline/head This commit looks good

This commit is contained in:
Kristian Knarvik 2024-01-25 16:39:42 +01:00
parent 72722029f9
commit a5d9c949b9
3 changed files with 5 additions and 15 deletions

View File

@ -40,7 +40,6 @@ public final class PlayerPayouts extends JavaPlugin {
private Configuration configuration; private Configuration configuration;
private IEssentials essentials = null; private IEssentials essentials = null;
private Translator translator;
private StringFormatter stringFormatter; private StringFormatter stringFormatter;
private static PlayerPayouts playerPayouts; private static PlayerPayouts playerPayouts;
@ -55,7 +54,7 @@ public final class PlayerPayouts extends JavaPlugin {
this.saveConfig(); this.saveConfig();
this.configuration = new Configuration(fileConfiguration); this.configuration = new Configuration(fileConfiguration);
translator = new Translator(); Translator translator = new Translator();
translator.registerMessageCategory(Translatable.GROUP_PAYOUTS_UNAVAILABLE); translator.registerMessageCategory(Translatable.GROUP_PAYOUTS_UNAVAILABLE);
translator.loadLanguages(this.getDataFolder(), "en", translator.loadLanguages(this.getDataFolder(), "en",
fileConfiguration.getString("language", "en")); fileConfiguration.getString("language", "en"));
@ -143,15 +142,6 @@ public final class PlayerPayouts extends JavaPlugin {
return getInstance().stringFormatter; return getInstance().stringFormatter;
} }
/**
* Gets the translator
*
* @return <p>A translator</p>
*/
public static Translator getTranslator() {
return getInstance().translator;
}
/** /**
* Pay all players that have been on the server long enough * Pay all players that have been on the server long enough
*/ */

View File

@ -83,8 +83,8 @@ public class SetGroupPaymentCommand implements CommandExecutor {
Double payout = Double.parseDouble(arguments[1]); Double payout = Double.parseDouble(arguments[1]);
configuration.setGroupPayout(group, payout); configuration.setGroupPayout(group, payout);
stringFormatter.displaySuccessMessage(commandSender, stringFormatter.replacePlaceholders( stringFormatter.displaySuccessMessage(commandSender, stringFormatter.replacePlaceholders(
Translatable.GROUP_PAYOUT_SET, new String[]{"{group}", "{value}"}, Translatable.GROUP_PAYOUT_SET, List.of("{group}", "{value}"),
new String[]{group, String.valueOf(payout)})); List.of(group, String.valueOf(payout))));
} }
return true; return true;
} catch (NumberFormatException exception) { } catch (NumberFormatException exception) {

View File

@ -89,8 +89,8 @@ public class SetPlayerPaymentCommand implements CommandExecutor {
Double payout = Double.parseDouble(arguments[1]); Double payout = Double.parseDouble(arguments[1]);
configuration.setPlayerPayout(playerId, payout); configuration.setPlayerPayout(playerId, payout);
stringFormatter.displaySuccessMessage(commandSender, stringFormatter.replacePlaceholders( stringFormatter.displaySuccessMessage(commandSender, stringFormatter.replacePlaceholders(
Translatable.PLAYER_PAYOUT_SET, new String[]{"{player}", "{value}"}, Translatable.PLAYER_PAYOUT_SET, List.of("{player}", "{value}"),
new String[]{playerName, String.valueOf(payout)})); List.of(playerName, String.valueOf(payout))));
} }
return true; return true;
} catch (NumberFormatException exception) { } catch (NumberFormatException exception) {