Skip to content

Commit

Permalink
Clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
esotericenderman committed Aug 12, 2024
1 parent 1b9b751 commit fd0daa4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class PlayerDataManager {

private final TemplatePaperPlugin plugin;

private final String playerDataFilesExtension = ".json";

private final String playerDataFolderName = "player-data";
private final String playerDataFolderPath;
private final File playerDataFolder;
Expand Down Expand Up @@ -79,7 +81,7 @@ public void save() {
UUID uuid = entry.getKey();
PlayerProfile profile = entry.getValue();

File file = new File(playerDataFolderPath + File.separator + uuid.toString() + ".json");
File file = new File(playerDataFolderPath + File.separator + uuid.toString() + playerDataFilesExtension);

FileWriter writer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@ public class FileUtil {

private static final String FILE_EXTENSION_SEPARATOR = ".";

private static final String FILE_MIME_TYPE_TYPE_SUBTYPE_SEPARATOR = "/";

public static String getFileExtensionSeparator() {
return FILE_EXTENSION_SEPARATOR;
}

public static String getFileMimeTypeTypeSubtypeSeparator() {
return FILE_MIME_TYPE_TYPE_SUBTYPE_SEPARATOR;
}

public static List<String> getResourceFileFolderResourceFilePaths(String resourceFileFolderPath) throws IOException {
ClassLoader classLoader = FileUtil.class.getClassLoader();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class LanguageManager {

private final TemplatePaperPlugin plugin;

private final String languageMessageFilesExtension = ".yaml";

private final String languagesFolderName = "languages";
private final String languagesFolderPath;
private final File languagesFolder;
Expand Down Expand Up @@ -62,7 +64,7 @@ private void loadLanguageMessages() {
for (File languageMessagesFile : languagesFolder.listFiles()) {
String languageName = languageMessagesFile.getName().split("\\.", 2)[0];

String languageMessagesResourcePath = languagesFolderName + File.separator + languageName + ".yaml";
String languageMessagesResourcePath = languagesFolderName + File.separator + languageName + languageMessageFilesExtension;
plugin.saveResource(languageMessagesResourcePath, false);

YamlConfiguration messagesConfiguration = YamlConfiguration.loadConfiguration(languageMessagesFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ResourcePackManager {

private final String resourcePackFileType = "application";
private final String resourcePackFileExtension = "zip";
private final String resourcePackFileMimeType = resourcePackFileType + "/" + resourcePackFileExtension;
private final String resourcePackFileMimeType = resourcePackFileType + FileUtil.getFileMimeTypeTypeSubtypeSeparator() + resourcePackFileExtension;

private String resourcePackZipFilePath;
private File resourcePackZipFile;
Expand Down

0 comments on commit fd0daa4

Please sign in to comment.