Skip to content

Commit

Permalink
chore: rework message types and update custom characters (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
Snabeldier authored Jan 24, 2025
1 parent c77ff75 commit 4ce8f20
Show file tree
Hide file tree
Showing 14 changed files with 166 additions and 120 deletions.
22 changes: 0 additions & 22 deletions src/main/java/minevalley/core/api/chat/types/ActionBarType.java

This file was deleted.

29 changes: 0 additions & 29 deletions src/main/java/minevalley/core/api/chat/types/MessageType.java

This file was deleted.

99 changes: 51 additions & 48 deletions src/main/java/minevalley/core/api/enums/CustomCharacter.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,64 +6,67 @@
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public enum CustomCharacter {

MV('\uef00'),
MV_BW('\uef01'),
SUPPORT_QUESTION_MARK('\uef02'),
HELP_QUESTION_MARK('\uef03'),
TEAM('\uef04'),
EMOJI_HEART('\ue000'),
EMOJI_LAUGH('\ue001'),
EMOJI_SMILE('\ue002'),
EMOJI_GRIN('\ue003'),
EMOJI_WINK('\ue004'),
EMOJI_WINKING_WITH_TONGUE('\ue005'),
EMOJI_KISSES('\ue006'),
EMOJI_SHOCK('\ue007'),
EMOJI_BIG_SHOCK('\ue008'),
EMOJI_PAIN('\ue009'),
EMOJI_ANNOYED('\ue010'),
EMOJI_CRYING('\ue011'),

SUPPORT_QUESTION_MARK_TRANSPARENT('\uef05'),
RADIO('\uea00'),
SHOUT('\uea01'),
EXCLAMATION_MARK('\uea02'),
CROSS('\uea03'),
CHECKMARK('\uea04'),
LOG('\uea05'),
BUG('\uea06'),
EYE('\uea07'),
WRENCH('\uea08'),
CIRCLE('\uea09'),
HOUSE('\uea10'),
EURO_NOTES('\uea11'),
DRIFTING_CAR('\uea12'),

MEDICS('\uef06'),
COPS('\uef07'),
MAIL('\uef08'),
DISPOSAL('\uef09'),
HANDCUFFS('\uef10'),
BELL('\ueb00'),
PHONE('\ueb01'),

MEDICS_TRANSPARENT('\uef11'),
COPS_TRANSPARENT('\uef12'),
MAIL_TRANSPARENT('\uef13'),
DISPOSAL_TRANSPARENT('\uef14'),
HANDCUFFS_TRANSPARENT('\uef15'),
MV('\uec00'),
MV_BW('\uec01'),

EURO_NOTES('\uef16'),
BELL('\uef17'),
DRIFTING_CAR('\uef18'),
PHONE('\uef19'),
HELP_QUESTION_MARK('\ued00'),
TEAM('\ued01'),

MEDICS('\uee00'),
COPS('\uee01'),
MAIL('\uee02'),
DISPOSAL('\uee03'),
HANDCUFFS('\uee04'),
PREMIUM('\uee05'),
SUPPORT_QUESTION_MARK('\uee06'),

EMOJI_HEART('\uef20'),
EMOJI_LAUGH('\uef21'),
EMOJI_SMILE('\uef22'),
EMOJI_GRIN('\uef23'),
EMOJI_WINK('\uef24'),
EMOJI_WINKING_WITH_TONGUE('\uef25'),
EMOJI_KISSES('\uef26'),
EMOJI_SHOCK('\uef27'),
EMOJI_BIG_SHOCK('\uef28'),
EMOJI_PAIN('\uef29'),
EMOJI_ANNOYED('\uef30'),
EMOJI_CRYING('\uef31'),
MEDICS_TRANSPARENT('\uef00'),
COPS_TRANSPARENT('\uef01'),
MAIL_TRANSPARENT('\uef02'),
DISPOSAL_TRANSPARENT('\uef03'),
HANDCUFFS_TRANSPARENT('\uef04'),
PREMIUM_TRANSPARENT('\uef05'),
SUPPORT_QUESTION_MARK_TRANSPARENT('\uef06'),

PREMIUM('\uef32'),

RADIO('\uef33'),
SHOUT('\uef34'),
CROSS('\uef35'),
CHECKMARK('\uef36'),
LOG('\uef37'),
BUG('\uef38'),
EYE('\uef39'),
WRENCH('\uef40'),
CIRCLE('\uef41'),
HOUSE('\uef42'),

PREMIUM_TRANSPARENT('\uef43'),

SINGLE_WHITE_SPACE('\uef44');
SINGLE_WHITE_SPACE('\ueeee');

private final char c;

@SuppressWarnings("unused")
public char getChar() {
return c;
}

@Override
public String toString() {
return Character.toString(c);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package minevalley.core.api.chat;
package minevalley.core.api.messaging;

import minevalley.core.api.chat.clickable.ChatMenu;
import minevalley.core.api.chat.clickable.ClickableOption;
import minevalley.core.api.chat.instruction.Instruction;
import minevalley.core.api.chat.types.ActionBarType;
import minevalley.core.api.chat.types.MessageType;
import minevalley.core.api.messaging.clickable.ChatMenu;
import minevalley.core.api.messaging.clickable.ClickableOption;
import minevalley.core.api.messaging.instruction.Instruction;
import minevalley.core.api.messaging.types.ActionBarType;
import minevalley.core.api.messaging.types.MessageType;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.ComponentLike;
import net.kyori.adventure.text.TextComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package minevalley.core.api.chat;
package minevalley.core.api.messaging;

import minevalley.core.api.chat.clickable.ChatMenu;
import minevalley.core.api.chat.clickable.ClickableOption;
import minevalley.core.api.chat.instruction.Instruction;
import minevalley.core.api.messaging.clickable.ChatMenu;
import minevalley.core.api.messaging.clickable.ClickableOption;
import minevalley.core.api.messaging.instruction.Instruction;
import minevalley.core.api.utils.ClickableMessage;
import net.kyori.adventure.text.ComponentLike;
import org.jetbrains.annotations.Contract;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package minevalley.core.api.chat.clickable;
package minevalley.core.api.messaging.clickable;

import minevalley.core.api.chat.MessageReceiver;
import minevalley.core.api.messaging.MessageReceiver;

/**
* The {@code ChatMenu} is an interface that represents a chat menu that was sent to a {@link MessageReceiver}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package minevalley.core.api.chat.clickable;
package minevalley.core.api.messaging.clickable;

import minevalley.core.api.chat.MessageReceiver;
import minevalley.core.api.messaging.MessageReceiver;
import minevalley.core.api.users.OnlineUser;
import net.kyori.adventure.text.ComponentLike;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package minevalley.core.api.chat.instruction;
package minevalley.core.api.messaging.instruction;

import minevalley.core.api.chat.MessageReceiver;
import minevalley.core.api.messaging.MessageReceiver;

import javax.annotation.Nonnull;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package minevalley.core.api.messaging.types;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import minevalley.core.api.enums.CustomCharacter;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;

import javax.annotation.Nonnull;

import static minevalley.core.api.enums.CustomCharacter.CHECKMARK;
import static minevalley.core.api.enums.CustomCharacter.CROSS;
import static net.kyori.adventure.text.format.NamedTextColor.*;

@Getter(onMethod_ = @Nonnull)
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public enum ActionBarType {

/**
* Used to signal the failure of a process or an action.
*/
ERROR(CROSS, RED),

/**
* Used to signal the success of a process or action.
*/
SUCCESS(CHECKMARK, GREEN);

private final CustomCharacter symbol;
private final NamedTextColor color;

@SuppressWarnings("unused")
public TextComponent getPrefix() {
return Component.space()
.append(Component.text(symbol.getChar(), color))
.append(Component.text(" ━ ", DARK_GRAY));
}
}
54 changes: 54 additions & 0 deletions src/main/java/minevalley/core/api/messaging/types/MessageType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package minevalley.core.api.messaging.types;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import minevalley.core.api.enums.CustomCharacter;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;

import javax.annotation.Nonnull;

import static minevalley.core.api.enums.CustomCharacter.*;
import static net.kyori.adventure.text.format.NamedTextColor.*;

@Getter(onMethod_ = @Nonnull)
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public enum MessageType {

/**
* Used to signal a warning.
*/
WARNING(EXCLAMATION_MARK, YELLOW),

/**
* Used to signal the failure of a process or an action.
*/
ERROR(CROSS, RED),

/**
* Used to signal the success of a process or action.
*/
SUCCESS(CHECKMARK, GREEN),

/**
* Used to signal an information.
*/
INFO(MV, WHITE),

/**
* Used to signal an information in black and white.
*/
INFO_BW(MV_BW, WHITE);

private final CustomCharacter symbol;
private final NamedTextColor color;

@SuppressWarnings("unused")
public TextComponent getPrefix() {
return Component.space()
.append(Component.text(symbol.getChar(), color))
.append(Component.text(" ━ ", DARK_GRAY));
}
}
2 changes: 1 addition & 1 deletion src/main/java/minevalley/core/api/npc/NPC.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import minevalley.core.api.armorstand.FakeArmorStand;
import minevalley.core.api.chat.MessageSender;
import minevalley.core.api.messaging.MessageSender;
import minevalley.core.api.modifiers.EquipmentModifier;
import minevalley.core.api.modifiers.InteractionModifier;
import minevalley.core.api.modifiers.LocationModifier;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/minevalley/core/api/server/Server.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package minevalley.core.api.server;

import minevalley.core.api.chat.MessageReceiver;
import minevalley.core.api.messaging.MessageReceiver;

import javax.annotation.Nonnull;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/minevalley/core/api/team/Team.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package minevalley.core.api.team;

import minevalley.core.api.chat.MessageReceiver;
import minevalley.core.api.chat.instruction.Instruction;
import minevalley.core.api.messaging.MessageReceiver;
import minevalley.core.api.messaging.instruction.Instruction;

import javax.annotation.Nonnull;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/minevalley/core/api/users/OnlineUser.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package minevalley.core.api.users;

import minevalley.core.api.chat.MessageReceiver;
import minevalley.core.api.messaging.MessageReceiver;
import minevalley.core.api.economy.AccountUser;
import minevalley.core.api.economy.BankAccount;
import minevalley.core.api.enums.sounds.AmbientSound;
Expand Down

0 comments on commit 4ce8f20

Please sign in to comment.