Skip to content

Commit

Permalink
option to disable welcome message
Browse files Browse the repository at this point in the history
  • Loading branch information
velnias75 committed Jun 4, 2022
1 parent 0a748df commit b1ba9f7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G

projectGroup=de.rangun
projectName=PandaCrossing
projectBaseVersion=0.5.2-SNAPSHOT
projectBaseVersion=0.5.2-beta
projectDescription=Creates QR codes
projectArchiveBaseName=pandacrossing

Expand Down
27 changes: 18 additions & 9 deletions src/main/java/de/rangun/pandacrossing/PandaCrossingMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,32 @@ public void onInitializeClient() {

ClientPlayConnectionEvents.JOIN.register((handler, sender, client) -> {

final MutableText welcomeMsg = new LiteralText("Welcome to PandaCrossing, ").formatted(Formatting.AQUA)
.append(new LiteralText(client.player.getDisplayName().asString()).formatted(Formatting.RED)
.append(new LiteralText(" :-)").formatted(Formatting.AQUA)));
boolean showMsg = true;

if (hasClothConfig2()) {
showMsg = (new ClothConfig2Utils().getConfig()).show_welcome_message;
}

if (showMsg) {

final MutableText welcomeMsg = new LiteralText("Welcome to PandaCrossing, ").formatted(Formatting.AQUA)
.append(new LiteralText(client.player.getDisplayName().asString()).formatted(Formatting.RED)
.append(new LiteralText(" :-)").formatted(Formatting.AQUA)));

// if (!hasPermission(client.player)) {
// welcomeMsg.append("\n").append(
// new LiteralText("You don't seem to have the permission to use PandaCrossing on this server :-(")
// .formatted(Formatting.DARK_RED));
// }

if (hasClothConfig2()) {
welcomeMsg.append("\n").append(new LiteralText("Press \'"))
.append(keyBinding.getBoundKeyLocalizedText())
.append(new LiteralText("\' to access the settings menu."));
}
if (hasClothConfig2()) {
welcomeMsg.append("\n").append(new LiteralText("Press \'"))
.append(keyBinding.getBoundKeyLocalizedText())
.append(new LiteralText("\' to access the settings menu."));
}

client.inGameHud.addChatMessage(MessageType.SYSTEM, welcomeMsg, Util.NIL_UUID);
client.inGameHud.addChatMessage(MessageType.SYSTEM, welcomeMsg, Util.NIL_UUID);
}
});

ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public enum ECL {

public boolean animation_mode = false;

public boolean show_welcome_message = true;

@Override
public void validatePostLoad() throws ValidationException {

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/panda_crossing/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"text.autoconfig.panda_crossing.option.error_correction_level.@Tooltip[1]": "Medium: ~15% correction",
"text.autoconfig.panda_crossing.option.error_correction_level.@Tooltip[2]": "Quartile: ~25% correction",
"text.autoconfig.panda_crossing.option.error_correction_level.@Tooltip[3]": "High: ~30% correction",
"text.autoconfig.panda_crossing.option.show_welcome_message": "Show welcome message",
"text.panda_crossing.undo.success": "undo successful",
"text.panda_crossing.undo.nothing": "nothing to undo",
"text.panda_crossing.qrcommand.finished": "QR-Code processing finished."
Expand Down

0 comments on commit b1ba9f7

Please sign in to comment.