Skip to content

Commit

Permalink
release v1.7.6
Browse files Browse the repository at this point in the history
  • Loading branch information
jonagamerpro1234 committed Jan 8, 2023
1 parent 7a57277 commit 3c70f6c
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 94 deletions.
2 changes: 1 addition & 1 deletion CustomJoinAndQuitMessagesOld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>

<artifactId>CustomJoinAndQuitMessagesOld</artifactId>
<version>1.7.6-beta.4</version>
<version>1.7.6-Release</version>

<properties>
<java.version>11</java.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import java.util.List;

public class Json {
public class MessageBuilder {

private final Player player;
private final String text;
Expand All @@ -20,7 +20,7 @@ public class Json {
private String executeCommand;
private String openUrl;

public Json(Player player, String text) {
public MessageBuilder(Player player, String text) {
this.player = player;
this.text = text;
this.hoverText = null;
Expand All @@ -34,7 +34,7 @@ public String getText() {
return text;
}

public Json setHover(@NotNull List<String> hover) {
public MessageBuilder setHover(@NotNull List<String> hover) {
this.hoverText = new BaseComponent[hover.size()];
for (int i = 0; i < hover.size(); i++) {
TextComponent component = new TextComponent();
Expand All @@ -48,17 +48,17 @@ public Json setHover(@NotNull List<String> hover) {
return this;
}

public Json setSuggestCommand(String suggestCommand) {
public MessageBuilder setSuggestCommand(String suggestCommand) {
this.suggestCommand = suggestCommand;
return this;
}

public Json setExecuteCommand(String executeCommand) {
public MessageBuilder setExecuteCommand(String executeCommand) {
this.executeCommand = executeCommand;
return this;
}

public Json setOpenURL(String url) {
public MessageBuilder setOpenURL(String url) {
this.openUrl = url;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import github.scarsz.discordsrv.util.DiscordUtil;
import jss.customjoinandquitmessages.CustomJoinAndQuitMessages;
import jss.customjoinandquitmessages.hook.*;
import jss.customjoinandquitmessages.json.Json;
import jss.customjoinandquitmessages.json.MessageBuilder;
import jss.customjoinandquitmessages.manager.HookManager;
import jss.customjoinandquitmessages.manager.PlayerManager;
import jss.customjoinandquitmessages.utils.*;
Expand Down Expand Up @@ -113,10 +113,10 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) {

text = Util.color(Util.getVar(p, text));

Json json = new Json(p, text);
MessageBuilder messageBuilder = new MessageBuilder(p, text);

if (config.getBoolean("Config.Show-Chat-In-Console")) {
Logger.info(json.getText());
Logger.info(messageBuilder.getText());
}

if (isNormalType) {
Expand All @@ -128,15 +128,15 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) {

DiscordUtil.sendMessageBlocking(
DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid),
Util.colorless(json.getText()));
Util.colorless(messageBuilder.getText()));
}

if (essentialsXDiscordHook.isEnabled()) {
if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none"))
return;

essentialsXDiscordHook.sendJoinMessage(Settings.hook_essentialsDiscord_channelid,
Util.colorless(json.getText()));
Util.colorless(messageBuilder.getText()));
}
} else if (isModifyType) {
boolean isHover = Objects.equals(config.getString("Join.HoverEvent.Enabled"), "true");
Expand Down Expand Up @@ -168,34 +168,34 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) {
if (isClick) {
assert isClick_Mode != null;
if (isClick_Mode.equalsIgnoreCase("command")) {
json.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll();
messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll();
} else if (isClick_Mode.equalsIgnoreCase("url")) {
json.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll();
messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll();
} else if (isClick_Mode.equalsIgnoreCase("suggest")) {
json.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll();
messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll();
}
} else {
json.setHover(Hover_Text).sendToAll();
messageBuilder.setHover(Hover_Text).sendToAll();
}
} else {
if (isClick) {
assert isClick_Mode != null;
if (isClick_Mode.equalsIgnoreCase("command")) {
json.setExecuteCommand(Action_Command).sendToAll();
messageBuilder.setExecuteCommand(Action_Command).sendToAll();
} else if (isClick_Mode.equalsIgnoreCase("url")) {
json.setOpenURL(Action_Url).sendToAll();
messageBuilder.setOpenURL(Action_Url).sendToAll();
} else if (isClick_Mode.equalsIgnoreCase("suggest")) {
json.setSuggestCommand(Action_Suggest).sendToAll();
messageBuilder.setSuggestCommand(Action_Suggest).sendToAll();
}
} else {
json.sendToAll();
messageBuilder.sendToAll();
}
}

if (discordSRVHHook.isEnabled()) {
DiscordUtil.sendMessageBlocking(
DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid),
Util.colorless(json.getText()));
Util.colorless(messageBuilder.getText()));
}

if (isTitle) {
Expand Down Expand Up @@ -288,10 +288,10 @@ public void onQuit(@NotNull PlayerQuitEvent e) {
text = Util.color(text);
text = Util.getVar(p, text);

Json json = new Json(p, text);
MessageBuilder messageBuilder = new MessageBuilder(p, text);

if (config.getBoolean("Config.Show-Chat-In-Console")) {
Logger.info(json.getText());
Logger.info(messageBuilder.getText());
}

if (isNormalType) {
Expand All @@ -301,14 +301,14 @@ public void onQuit(@NotNull PlayerQuitEvent e) {
return;
DiscordUtil.sendMessageBlocking(
DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid),
Util.colorless(json.getText()));
Util.colorless(messageBuilder.getText()));
}

if (essentialsXDiscordHook.isEnabled()) {
if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none"))
return;
essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid,
Util.colorless(json.getText()));
Util.colorless(messageBuilder.getText()));
}
} else if (isModifyType) {

Expand All @@ -332,27 +332,27 @@ public void onQuit(@NotNull PlayerQuitEvent e) {
if (isClick) {
assert isClick_Mode != null;
if (isClick_Mode.equalsIgnoreCase("command")) {
json.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll();
messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll();
} else if (isClick_Mode.equalsIgnoreCase("url")) {
json.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll();
messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll();
} else if (isClick_Mode.equalsIgnoreCase("suggest")) {
json.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll();
messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll();
}
} else {
json.setHover(Hover_Text).sendToAll();
messageBuilder.setHover(Hover_Text).sendToAll();
}
} else {
if (isClick) {
assert isClick_Mode != null;
if (isClick_Mode.equalsIgnoreCase("command")) {
json.setExecuteCommand(Action_Command).sendToAll();
messageBuilder.setExecuteCommand(Action_Command).sendToAll();
} else if (isClick_Mode.equalsIgnoreCase("url")) {
json.setOpenURL(Action_Url).sendToAll();
messageBuilder.setOpenURL(Action_Url).sendToAll();
} else if (isClick_Mode.equalsIgnoreCase("suggest")) {
json.setSuggestCommand(Action_Suggest).sendToAll();
messageBuilder.setSuggestCommand(Action_Suggest).sendToAll();
}
} else {
json.sendToAll();
messageBuilder.sendToAll();
}
}

Expand All @@ -363,7 +363,7 @@ public void onQuit(@NotNull PlayerQuitEvent e) {

DiscordUtil.sendMessageBlocking(
DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid),
Util.colorless(json.getText()));
Util.colorless(messageBuilder.getText()));
}

if (essentialsXDiscordHook.isEnabled()) {
Expand All @@ -372,7 +372,7 @@ public void onQuit(@NotNull PlayerQuitEvent e) {
return;

essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid,
Util.colorless(json.getText()));
Util.colorless(messageBuilder.getText()));
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.cryptomorin.xseries.messages.ActionBar;
import com.cryptomorin.xseries.messages.Titles;
import jss.customjoinandquitmessages.CustomJoinAndQuitMessages;
import jss.customjoinandquitmessages.json.Json;
import jss.customjoinandquitmessages.json.MessageBuilder;
import jss.customjoinandquitmessages.utils.Logger;
import jss.customjoinandquitmessages.utils.Settings;
import jss.customjoinandquitmessages.utils.Util;
Expand Down Expand Up @@ -76,35 +76,35 @@ public void showFirstJoinMessage() {
Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command");
}

Json json = new Json(player, Util.color(Util.getVar(player, text)));
MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text)));

if (isNormalType) {
json.send();
messageBuilder.send();
return;
} else if (isModifyType) {
if (isHover) {
if (isClick) {
if (isClick_Mode.equalsIgnoreCase("command")) {
json.setHover(Hover_Text).setExecuteCommand(Action_Command).send();
messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send();
} else if (isClick_Mode.equalsIgnoreCase("url")) {
json.setHover(Hover_Text).setOpenURL(Action_Url).send();
messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send();
} else if (isClick_Mode.equalsIgnoreCase("suggest")) {
json.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send();
messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send();
}
} else {
json.setHover(Hover_Text).send();
messageBuilder.setHover(Hover_Text).send();
}
} else {
if (isClick) {
if (isClick_Mode.equalsIgnoreCase("command")) {
json.setExecuteCommand(Action_Command).send();
messageBuilder.setExecuteCommand(Action_Command).send();
} else if (isClick_Mode.equalsIgnoreCase("url")) {
json.setOpenURL(Action_Url).send();
messageBuilder.setOpenURL(Action_Url).send();
} else if (isClick_Mode.equalsIgnoreCase("suggest")) {
json.setSuggestCommand(Action_Suggest).send();
messageBuilder.setSuggestCommand(Action_Suggest).send();
}
} else {
json.send();
messageBuilder.send();
}
}
}
Expand Down Expand Up @@ -155,35 +155,35 @@ public void showJoinMessage() {
Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command");
}

Json json = new Json(player, Util.color(Util.getVar(player, text)));
MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text)));

if (isNormalType) {
json.send();
messageBuilder.send();
return;
} else if (isModifyType) {
if (isHover) {
if (isClick) {
if (isClick_Mode.equalsIgnoreCase("command")) {
json.setHover(Hover_Text).setExecuteCommand(Action_Command).send();
messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send();
} else if (isClick_Mode.equalsIgnoreCase("url")) {
json.setHover(Hover_Text).setOpenURL(Action_Url).send();
messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send();
} else if (isClick_Mode.equalsIgnoreCase("suggest")) {
json.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send();
messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send();
}
} else {
json.setHover(Hover_Text).send();
messageBuilder.setHover(Hover_Text).send();
}
} else {
if (isClick) {
if (isClick_Mode.equalsIgnoreCase("command")) {
json.setExecuteCommand(Action_Command).send();
messageBuilder.setExecuteCommand(Action_Command).send();
} else if (isClick_Mode.equalsIgnoreCase("url")) {
json.setOpenURL(Action_Url).send();
messageBuilder.setOpenURL(Action_Url).send();
} else if (isClick_Mode.equalsIgnoreCase("suggest")) {
json.setSuggestCommand(Action_Suggest).send();
messageBuilder.setSuggestCommand(Action_Suggest).send();
}
} else {
json.send();
messageBuilder.send();
}
}
}
Expand Down Expand Up @@ -234,35 +234,35 @@ public void showQuitMessage() {
Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command");
}

Json json = new Json(player, Util.color(Util.getVar(player, text)));
MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text)));

if (isNormalType) {
json.send();
messageBuilder.send();
return;
} else if (isModifyType) {
if (isHover) {
if (isClick) {
if (isClick_Mode.equalsIgnoreCase("command")) {
json.setHover(Hover_Text).setExecuteCommand(Action_Command).send();
messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send();
} else if (isClick_Mode.equalsIgnoreCase("url")) {
json.setHover(Hover_Text).setOpenURL(Action_Url).send();
messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send();
} else if (isClick_Mode.equalsIgnoreCase("suggest")) {
json.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send();
messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send();
}
} else {
json.setHover(Hover_Text).send();
messageBuilder.setHover(Hover_Text).send();
}
} else {
if (isClick) {
if (isClick_Mode.equalsIgnoreCase("command")) {
json.setExecuteCommand(Action_Command).send();
messageBuilder.setExecuteCommand(Action_Command).send();
} else if (isClick_Mode.equalsIgnoreCase("url")) {
json.setOpenURL(Action_Url).send();
messageBuilder.setOpenURL(Action_Url).send();
} else if (isClick_Mode.equalsIgnoreCase("suggest")) {
json.setSuggestCommand(Action_Suggest).send();
messageBuilder.setSuggestCommand(Action_Suggest).send();
}
} else {
json.send();
messageBuilder.send();
}
}
}
Expand Down
Loading

0 comments on commit 3c70f6c

Please sign in to comment.