-
Notifications
You must be signed in to change notification settings - Fork 2
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
9 changed files
with
145 additions
and
23 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
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
12 changes: 12 additions & 0 deletions
12
src/main/java/com/artillexstudios/axplayerwarps/utils/FormatUtils.java
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,12 @@ | ||
package com.artillexstudios.axplayerwarps.utils; | ||
|
||
import com.artillexstudios.axplayerwarps.hooks.currency.CurrencyHook; | ||
import com.artillexstudios.axplayerwarps.placeholders.Placeholders; | ||
|
||
public class FormatUtils { | ||
|
||
public static String formatCurrency(CurrencyHook currencyHook, double amount) { | ||
return currencyHook == null ? Placeholders.df.format(amount) : currencyHook.getDisplayName() | ||
.replace("%price%", Placeholders.df.format(amount)); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/com/artillexstudios/axplayerwarps/utils/WarpNameUtils.java
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,25 @@ | ||
package com.artillexstudios.axplayerwarps.utils; | ||
|
||
import static com.artillexstudios.axplayerwarps.AxPlayerWarps.CONFIG; | ||
|
||
public class WarpNameUtils { | ||
public enum ValidationResult { | ||
ALLOWED, | ||
CONTAINS_SPACES, | ||
INVALID_LENGTH | ||
} | ||
|
||
public static ValidationResult isAllowed(String name) { | ||
if (!CONFIG.getBoolean("warp-naming.allow-spaces", false) && name.contains(" ")) { | ||
return ValidationResult.CONTAINS_SPACES; | ||
} | ||
|
||
if (name.length() < CONFIG.getInt("warp-naming.length.min", 1) | ||
|| name.length() > CONFIG.getInt("warp-naming.length.max", 16) | ||
) { | ||
return ValidationResult.INVALID_LENGTH; | ||
} | ||
|
||
return ValidationResult.ALLOWED; | ||
} | ||
} |
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