Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
Add Toggleable offline mode warning (#20)
Browse files Browse the repository at this point in the history
* Toggleable offline mode warning

* rebuild
  • Loading branch information
imirochi committed Nov 5, 2022
1 parent 7501f59 commit 78e77a6
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions patches/server/0032-Toggleable-offline-mode-warning.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Irochi <[email protected]>
Date: Tue, 25 Oct 2022 23:40:57 +0900
Subject: [PATCH] Toggleable offline mode warning


diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 1f847ac2b0b8096015da1e830a6cd664f1cef244..d29af9f0a2abcc4baa166acbf1bb44ba9ff257f9 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -326,18 +326,22 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
// CraftBukkit end

if (!this.usesAuthentication()) {
- DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
- DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
- // Spigot start
- if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()) { // Purpur
- DedicatedServer.LOGGER.warn("Whilst this makes it possible to use BungeeCord or Velocity, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose."); // Purpur
- DedicatedServer.LOGGER.warn("Please see http://www.spigotmc.org/wiki/firewall-guide/ for further information.");
- } else {
- DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
- DedicatedServer.LOGGER.warn("You will not be offered any support as long as the server allows offline-mode players to join."); // Purpur
+ // Prismarine start - Toggleable offline mode warning
+ if (net.prismarineteam.prismarine.PrismarineConfig.offlineWarning) {
+ DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
+ DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
+ // Spigot start
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()) { // Purpur
+ DedicatedServer.LOGGER.warn("Whilst this makes it possible to use BungeeCord or Velocity, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose."); // Purpur
+ DedicatedServer.LOGGER.warn("Please see http://www.spigotmc.org/wiki/firewall-guide/ for further information.");
+ } else {
+ DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
+ DedicatedServer.LOGGER.warn("You will not be offered any support as long as the server allows offline-mode players to join."); // Purpur
+ }
+ // Spigot end
+ DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
}
- // Spigot end
- DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
+ // Prismarine end - Toggleable offline mode warning
}


diff --git a/src/main/java/net/prismarineteam/prismarine/PrismarineConfig.java b/src/main/java/net/prismarineteam/prismarine/PrismarineConfig.java
index 61d0ae70a682c4bfc3328b7c1b5a47e376b4e736..2d88404d8bf305c01c7cb5f80db645e9939471f1 100644
--- a/src/main/java/net/prismarineteam/prismarine/PrismarineConfig.java
+++ b/src/main/java/net/prismarineteam/prismarine/PrismarineConfig.java
@@ -244,4 +244,9 @@ public class PrismarineConfig {
private static void maxArmorAttributeValue() {
maxArmorAttributeValue = (float) getDouble("settings.max-armor-attribute-value", maxArmorAttributeValue);
}
+
+ public static boolean offlineWarning = true;
+ private static void offlineWarning() {
+ offlineWarning = getBoolean("settings.offline-warning", offlineWarning);
+ }
}
\ No newline at end of file

0 comments on commit 78e77a6

Please sign in to comment.