Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
ChatBubble: add spawn height setting
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFaser committed Nov 19, 2023
1 parent 95c36e3 commit 05bb524
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,20 @@ public void add(@NotNull Player player, @NotNull String message) {
fPlayer.addChatBubble(message);
}

public void spawn(@NotNull Player player, @NotNull String message, @NotNull String color, int maxPerLine, int readSpeed) {
public void spawn(@NotNull Player player, @NotNull String message, @NotNull String color, int height, int maxPerLine, int readSpeed) {
List<String> messageStrings = divideText(message, maxPerLine);

int duration = (message.length() + 8 * messageStrings.size()) * 1200 / readSpeed;

Entity lastVehicle = player;

while (height > 0) {
if (lastVehicle == null) return;

lastVehicle = spawnStringBubble(lastVehicle, "", lastVehicle.getLocation(), duration);
height--;
}

for (int x = messageStrings.size() - 1; x > -1; x--) {
if(lastVehicle == null) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ public void run() {
int maxPerLine = config.getVaultInt(player, getModule() + ".max-per-line");
String color = config.getVaultString(player, getModule() + ".color");
int readSpeed = config.getVaultInt(player, getModule() + ".read-speed");
int height = config.getVaultInt(player, getModule() + ".height");

((ChatBubbleModule) getModule()).spawn(player, message, MessageUtil.formatAll(player, color),
maxPerLine, readSpeed);
height, maxPerLine, readSpeed);
});
}
}
1 change: 1 addition & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ default:
chat-bubble:
enable: true
color: "#999999"
height: 1
max-per-line: 35
read-speed: 800

Expand Down

0 comments on commit 05bb524

Please sign in to comment.