Skip to content

Commit 3fcf6fd

Browse files
Signature strip confirmation
Add a confirmation that the plugin is doing it's job
2 parents 6a55369 + aa435d3 commit 3fcf6fd

File tree

9 files changed

+72
-3
lines changed

9 files changed

+72
-3
lines changed

1.19.1/src/main/java/me/doclic/noencryption/PlayerListener.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import io.netty.channel.ChannelPipeline;
77
import io.netty.channel.ChannelPromise;
88
import me.doclic.noencryption.compatibility.Compatibility;
9+
import me.doclic.noencryption.config.ConfigurationHandler;
10+
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
911
import org.bukkit.entity.Player;
1012
import org.bukkit.event.EventHandler;
1113
import org.bukkit.event.EventPriority;
@@ -40,6 +42,14 @@ public void write(ChannelHandlerContext channelHandlerContext, Object packet, Ch
4042

4143
});
4244

45+
if (ConfigurationHandler.getLoginProtectionMessage() != null) {
46+
if (!ConfigurationHandler.getLoginProtectionMessage().trim().equals("")) {
47+
player.sendMessage(
48+
LegacyComponentSerializer.legacy('&').deserialize(ConfigurationHandler.getLoginProtectionMessage())
49+
);
50+
}
51+
}
52+
4353
}
4454

4555
@EventHandler(priority = EventPriority.LOWEST)

1.19.1/src/main/java/me/doclic/noencryption/config/ConfigNodes.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,16 @@ public enum ConfigNodes {
3838
"# Note: Doesn't actually do anything, just here",
3939
"# for show, and example",
4040
"# Added in v3.0",
41-
"# Default: false");
41+
"# Default: false"),
42+
43+
LOGIN_PROTECTION_MESSAGE(null, "login_protection_message", "",
44+
" ",
45+
"# Displays a message to users when they log in that their messages are protected",
46+
"# ",
47+
"# Note: Leave blank to disable",
48+
"# ",
49+
"# Added in v3.0",
50+
"# Default: BLANK");
4251

4352

4453
private final String Notice;

1.19.1/src/main/java/me/doclic/noencryption/config/ConfigurationHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ private static int getInt(ConfigNodes node) {
175175
}
176176
}
177177

178+
public static String getLoginProtectionMessage() {
179+
return getString(ConfigNodes.LOGIN_PROTECTION_MESSAGE);
180+
}
181+
178182
/* public static String getDBTablePrefix() {
179183
return getString(ConfigNodes.DATABASE_TABLE_PREFIX);
180184
}

1.19.2/src/main/java/me/doclic/noencryption/PlayerListener.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import io.netty.channel.ChannelPipeline;
77
import io.netty.channel.ChannelPromise;
88
import me.doclic.noencryption.compatibility.Compatibility;
9+
import me.doclic.noencryption.config.ConfigurationHandler;
10+
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
911
import org.bukkit.entity.Player;
1012
import org.bukkit.event.EventHandler;
1113
import org.bukkit.event.EventPriority;
@@ -40,6 +42,14 @@ public void write(ChannelHandlerContext channelHandlerContext, Object packet, Ch
4042

4143
});
4244

45+
if (ConfigurationHandler.getLoginProtectionMessage() != null) {
46+
if (!ConfigurationHandler.getLoginProtectionMessage().trim().equals("")) {
47+
player.sendMessage(
48+
LegacyComponentSerializer.legacy('&').deserialize(ConfigurationHandler.getLoginProtectionMessage())
49+
);
50+
}
51+
}
52+
4353
}
4454

4555
@EventHandler(priority = EventPriority.LOWEST)

1.19.2/src/main/java/me/doclic/noencryption/config/ConfigNodes.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,16 @@ public enum ConfigNodes {
3838
"# Note: Doesn't actually do anything, just here",
3939
"# for show, and example",
4040
"# Added in v3.0",
41-
"# Default: false");
41+
"# Default: false"),
42+
43+
LOGIN_PROTECTION_MESSAGE(null, "login_protection_message", "",
44+
" ",
45+
"# Displays a message to users when they log in that their messages are protected",
46+
"# ",
47+
"# Note: Leave blank to disable",
48+
"# ",
49+
"# Added in v3.0",
50+
"# Default: BLANK");
4251

4352

4453
private final String Notice;

1.19.2/src/main/java/me/doclic/noencryption/config/ConfigurationHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ private static int getInt(ConfigNodes node) {
174174
}
175175
}
176176

177+
public static String getLoginProtectionMessage() {
178+
return getString(ConfigNodes.LOGIN_PROTECTION_MESSAGE);
179+
}
180+
177181
/* public static String getDBTablePrefix() {
178182
return getString(ConfigNodes.DATABASE_TABLE_PREFIX);
179183
}

1.19/src/main/java/me/doclic/noencryption/PlayerListener.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import io.netty.channel.ChannelPipeline;
77
import io.netty.channel.ChannelPromise;
88
import me.doclic.noencryption.compatibility.Compatibility;
9+
import me.doclic.noencryption.config.ConfigurationHandler;
10+
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
911
import org.bukkit.entity.Player;
1012
import org.bukkit.event.EventHandler;
1113
import org.bukkit.event.EventPriority;
@@ -40,6 +42,14 @@ public void write(ChannelHandlerContext channelHandlerContext, Object packet, Ch
4042

4143
});
4244

45+
if (ConfigurationHandler.getLoginProtectionMessage() != null) {
46+
if (!ConfigurationHandler.getLoginProtectionMessage().trim().equals("")) {
47+
player.sendMessage(
48+
LegacyComponentSerializer.legacy('&').deserialize(ConfigurationHandler.getLoginProtectionMessage())
49+
);
50+
}
51+
}
52+
4353
}
4454

4555
@EventHandler(priority = EventPriority.LOWEST)

1.19/src/main/java/me/doclic/noencryption/config/ConfigNodes.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,16 @@ public enum ConfigNodes {
3838
"# Note: Doesn't actually do anything, just here",
3939
"# for show, and example",
4040
"# Added in v3.0",
41-
"# Default: false");
41+
"# Default: false"),
42+
43+
LOGIN_PROTECTION_MESSAGE(null, "login_protection_message", "",
44+
" ",
45+
"# Displays a message to users when they log in that their messages are protected",
46+
"# ",
47+
"# Note: Leave blank to disable",
48+
"# ",
49+
"# Added in v3.0",
50+
"# Default: BLANK");
4251

4352

4453
private final String Notice;

1.19/src/main/java/me/doclic/noencryption/config/ConfigurationHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ private static int getInt(ConfigNodes node) {
174174
}
175175
}
176176

177+
public static String getLoginProtectionMessage() {
178+
return getString(ConfigNodes.LOGIN_PROTECTION_MESSAGE);
179+
}
180+
177181
/* public static String getDBTablePrefix() {
178182
return getString(ConfigNodes.DATABASE_TABLE_PREFIX);
179183
}

0 commit comments

Comments
 (0)