-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
211 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
package com.gaetan.staffpin.config; | ||
|
||
import com.gaetan.api.message.Message; | ||
import com.gaetan.staffpin.StaffPlugin; | ||
import org.bukkit.configuration.file.FileConfiguration; | ||
|
||
public final class ConfigManager { | ||
/** | ||
* Reference to the main class | ||
*/ | ||
private final StaffPlugin staffPlugin; | ||
|
||
/** | ||
* Cache for the config | ||
*/ | ||
private String enterPin, timeFinish, | ||
correctPin, incorrectPin, noPin, pinSet, pinPermission; | ||
|
||
/** | ||
* Constructor for the ConfigManager class. | ||
* | ||
* @param staffPlugin Reference to the main class | ||
*/ | ||
public ConfigManager(final StaffPlugin staffPlugin) { | ||
this.staffPlugin = staffPlugin; | ||
|
||
this.load(); | ||
} | ||
|
||
/** | ||
* Method to cache the config | ||
*/ | ||
private void load() { | ||
final FileConfiguration config = this.staffPlugin.getConfig(); | ||
final String prefix = Message.tl(config.getString("lang.prefix")); | ||
|
||
this.enterPin = prefix + Message.tl(config.getString("lang.enter_ping")); | ||
this.timeFinish = prefix + Message.tl(config.getString("lang.time_finish")); | ||
this.correctPin = prefix + Message.tl(config.getString("lang.pin.correct")); | ||
this.incorrectPin = prefix + Message.tl(config.getString("lang.pin.incorrect")); | ||
this.noPin = prefix + Message.tl(config.getString("lang.pin.dont_have")); | ||
this.pinSet = prefix + Message.tl(config.getString("lang.pin.set")); | ||
|
||
this.pinPermission = config.getString("permission.pin"); | ||
} | ||
|
||
/** | ||
* Getter to get the message for enter the pin. | ||
* | ||
* @return The enter message | ||
*/ | ||
public String getEnterPin() { | ||
return this.enterPin; | ||
} | ||
|
||
/** | ||
* Getter to get the message when the cooldown get his end. | ||
* | ||
* @return The end message | ||
*/ | ||
public String getTimeFinish() { | ||
return this.timeFinish; | ||
} | ||
|
||
/** | ||
* Getter to get the correct pin message. | ||
* | ||
* @return The correct pin message | ||
*/ | ||
public String getCorrectPin() { | ||
return this.correctPin; | ||
} | ||
|
||
/** | ||
* Getter to get the incorrect pin message. | ||
* | ||
* @return The incorrect pin message | ||
*/ | ||
public String getIncorrectPin() { | ||
return this.incorrectPin; | ||
} | ||
|
||
/** | ||
* Getter to get the no pin message. | ||
* | ||
* @return The nopin message | ||
*/ | ||
public String getNoPin() { | ||
return this.noPin; | ||
} | ||
|
||
/** | ||
* Getter to get the pin set message. | ||
* | ||
* @return The pin set message | ||
*/ | ||
public String getPinSet() { | ||
return this.pinSet; | ||
} | ||
|
||
/** | ||
* Getter to get the pin permission. | ||
* | ||
* @return The pin permission | ||
*/ | ||
public String getPinPermission() { | ||
return this.pinPermission; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.