| 8 | import java.awt.*; |
| 9 | |
| 10 | public class FConst { |
| 11 | public static final Color COLOR_ERROR = new Color(255, 0, 0); |
| 12 | public static final Color COLOR_SUCCESS = new Color(0, 255, 0); |
| 13 | public static final Color COLOR_WARNING = new Color(255, 255, 0); |
| 14 | public static final Color COLOR_INFO = new Color(255, 255, 255); |
| 15 | public static final Feedback TELEPORT = Feedback.builder() |
| 16 | .sound(SoundFeedback.builder() |
| 17 | .sound(Sound.ENTITY_ENDER_EYE_LAUNCH) |
| 18 | .volume(0.7f) |
| 19 | .pitch(1.25f) |
| 20 | .build()) |
| 21 | .build(); |
| 22 | |
| 23 | public static Feedback error(String message, Object... args) { |
| 24 | return Feedback.builder() |
| 25 | .message(errorText(message, args)) |
| 26 | .sound(SoundFeedback.builder().sound(Sound.BLOCK_DEEPSLATE_BREAK).pitch(0.5f).volume(1f).build()) |
| 27 | .build(); |
| 28 | } |
| 29 | |
| 30 | public static Feedback success(String message, Object... args) { |
| 31 | return Feedback.builder() |
| 32 | .message(successText(message, args)) |
| 33 | .sound(SoundFeedback.builder().sound(Sound.BLOCK_AMETHYST_BLOCK_PLACE).pitch(1.5f).volume(1f).build()) |
| 34 | .sound(SoundFeedback.builder().sound(Sound.ITEM_ARMOR_EQUIP_ELYTRA).pitch(1.1f).volume(1f).build()) |
| 35 | .build(); |
| 36 | } |
| 37 | |
| 38 | public static Feedback warning(String message, Object... args) { |
| 39 | return Feedback.builder() |
| 40 | .message(warningText(message, args)) |
| 41 | .sound(SoundFeedback.builder().sound(Sound.ITEM_ARMOR_EQUIP_CHAIN).pitch(0.6f).volume(1f).build()) |
| 42 | .build(); |
| 43 | } |
| 44 | |
| 45 | public static Feedback info(String message, Object... args) { |
| 46 | return Feedback.builder() |
| 47 | .message(infoText(message, args)) |
| 48 | .sound(SoundFeedback.builder().sound(Sound.ITEM_ARMOR_EQUIP_LEATHER).pitch(1.1f).volume(1f).build()) |
| 49 | .build(); |
| 50 | } |
| 51 | |
| 52 | public static TextComponent errorText(String message, Object... args) { |
| 53 | return Component.text(message.formatted(args)).color(TextColor.color(FConst.COLOR_ERROR.getRGB())); |
| 54 | } |
| 55 | |
| 56 | public static TextComponent successText(String message, Object... args) { |
| 57 | return Component.text(message.formatted(args)).color(TextColor.color(FConst.COLOR_SUCCESS.getRGB())); |
| 58 | } |
| 59 | |
| 60 | public static TextComponent warningText(String message, Object... args) { |
| 61 | return Component.text(message.formatted(args)).color(TextColor.color(FConst.COLOR_WARNING.getRGB())); |
| 62 | } |
| 63 | |
| 64 | public static TextComponent infoText(String message, Object... args) { |
| 65 | return Component.text(message.formatted(args)).color(TextColor.color(FConst.COLOR_INFO.getRGB())); |
| 66 | } |
| 67 | |