mirror of
https://github.com/PaperMC/Waterfall.git
synced 2025-01-15 20:22:11 +01:00
Split more firewall system
This commit is contained in:
parent
784e14bd22
commit
a93d1293a4
@ -1,5 +1,5 @@
|
|||||||
From 274f6347ded5b72104c30c9663912270b1c1b116 Mon Sep 17 00:00:00 2001
|
From 167e8a9506af076d4af164489583c3a7957d16af Mon Sep 17 00:00:00 2001
|
||||||
From: linsaftw <linsaftw@users.noreply.github.com>
|
From: Juan Cruz Linsalata <LinsaFTW@users.noreply.github.com>
|
||||||
Date: Mon, 12 Oct 2020 15:40:53 -0300
|
Date: Mon, 12 Oct 2020 15:40:53 -0300
|
||||||
Subject: [PATCH] FlameCord General Patch
|
Subject: [PATCH] FlameCord General Patch
|
||||||
|
|
||||||
@ -55,10 +55,10 @@ index 00000000..8957c79a
|
|||||||
\ No newline at end of file
|
\ No newline at end of file
|
||||||
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
|
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 00000000..b7268e1d
|
index 00000000..650cb302
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
|
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
|
||||||
@@ -0,0 +1,81 @@
|
@@ -0,0 +1,72 @@
|
||||||
+package dev._2lstudios.flamecord.configuration;
|
+package dev._2lstudios.flamecord.configuration;
|
||||||
+
|
+
|
||||||
+import java.io.File;
|
+import java.io.File;
|
||||||
@ -74,12 +74,7 @@ index 00000000..b7268e1d
|
|||||||
+
|
+
|
||||||
+public class FlameCordConfiguration {
|
+public class FlameCordConfiguration {
|
||||||
+ @Getter
|
+ @Getter
|
||||||
+ private boolean loggerInitialhandler = false, loggerExceptions = false, loggerDump = false, firewallNotify = true,
|
+ private boolean loggerInitialhandler = false, loggerExceptions = false, loggerDump = false;
|
||||||
+ firewallEnabled = true;
|
|
||||||
+ @Getter
|
|
||||||
+ private int firewallSeconds = 60;
|
|
||||||
+ @Getter
|
|
||||||
+ private Collection<String> firewallNames = new HashSet<>(Arrays.asList(new String[] { "mcspam" }));
|
|
||||||
+
|
+
|
||||||
+ public FlameCordConfiguration(final ConfigurationProvider configurationProvider) {
|
+ public FlameCordConfiguration(final ConfigurationProvider configurationProvider) {
|
||||||
+ try {
|
+ try {
|
||||||
@ -98,10 +93,6 @@ index 00000000..b7268e1d
|
|||||||
+ configuration);
|
+ configuration);
|
||||||
+ this.loggerExceptions = setIfUnexistant("logger.exceptions", this.loggerExceptions, configuration);
|
+ this.loggerExceptions = setIfUnexistant("logger.exceptions", this.loggerExceptions, configuration);
|
||||||
+ this.loggerDump = setIfUnexistant("logger.dump", this.loggerDump, configuration);
|
+ this.loggerDump = setIfUnexistant("logger.dump", this.loggerDump, configuration);
|
||||||
+ this.firewallEnabled = setIfUnexistant("firewall.enabled", this.firewallEnabled, configuration);
|
|
||||||
+ this.firewallNotify = setIfUnexistant("firewall.notify", this.firewallNotify, configuration);
|
|
||||||
+ this.firewallSeconds = setIfUnexistant("firewall.seconds", this.firewallSeconds, configuration);
|
|
||||||
+ this.firewallNames = setIfUnexistant("firewall.names", this.firewallNames, configuration);
|
|
||||||
+
|
+
|
||||||
+ if (!configurationExists) {
|
+ if (!configurationExists) {
|
||||||
+ configurationProvider.save(configuration, configurationFile);
|
+ configurationProvider.save(configuration, configurationFile);
|
||||||
@ -142,10 +133,10 @@ index 00000000..b7268e1d
|
|||||||
+}
|
+}
|
||||||
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java
|
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 00000000..c88077ad
|
index 00000000..ebfaa761
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java
|
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java
|
||||||
@@ -0,0 +1,129 @@
|
@@ -0,0 +1,121 @@
|
||||||
+package dev._2lstudios.flamecord.configuration;
|
+package dev._2lstudios.flamecord.configuration;
|
||||||
+
|
+
|
||||||
+import java.io.File;
|
+import java.io.File;
|
||||||
@ -230,17 +221,9 @@ index 00000000..c88077ad
|
|||||||
+ setIfUnexistant("command_ip", "&9IP of {0} is {1}", configuration);
|
+ setIfUnexistant("command_ip", "&9IP of {0} is {1}", configuration);
|
||||||
+
|
+
|
||||||
+ // FlameCord
|
+ // FlameCord
|
||||||
+ setIfUnexistant("firewall_added", "&e{0}&c had been firewalled from the proxy!", configuration);
|
|
||||||
+ setIfUnexistant("firewall_blocked", "&e{0}&c is firewalled from the proxy, request blocked!",
|
|
||||||
+ configuration);
|
|
||||||
+ setIfUnexistant("firewall_info",
|
|
||||||
+ "&aThere are&b {0} &aaddresses firewalled!\n&aThe firewall will clear in &b{1} &aseconds!",
|
|
||||||
+ configuration);
|
|
||||||
+ setIfUnexistant("firewall_cleared", "&b{0}&a addresses had been automatically removed from the firewall!",
|
|
||||||
+ configuration);
|
|
||||||
+ setIfUnexistant("flamecord_reload", "&aAll files had been successfully reloaded!", configuration);
|
+ setIfUnexistant("flamecord_reload", "&aAll files had been successfully reloaded!", configuration);
|
||||||
+ setIfUnexistant("flamecord_help",
|
+ setIfUnexistant("flamecord_help",
|
||||||
+ "&aFlameCord&b {0}&a by&b LinsaFTW&a &&b Sammwy&r\n&e /flamecord reload&7 >&b Reloads FlameCord files!\n&e /flamecord firewall&7 >&b Shows information about the Firewall!\n&e /flamecord help&7 >&b Shows this message!",
|
+ "&aFlameCord&b {0}&a by&b LinsaFTW&a &&b Sammwy&r\n&e /flamecord reload&7 >&b Reloads FlameCord files!\n&e /flamecord help&7 >&b Shows this message!",
|
||||||
+ configuration);
|
+ configuration);
|
||||||
+ setIfUnexistant("flamecord_nopermission", "&cYou don't have permission to do this!", configuration);
|
+ setIfUnexistant("flamecord_nopermission", "&cYou don't have permission to do this!", configuration);
|
||||||
+
|
+
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
From b18c16e3bb5a0e71261a854327ec7966b6af279e Mon Sep 17 00:00:00 2001
|
From 59870243f92af6df6734c1860ee0038b2205b1ec Mon Sep 17 00:00:00 2001
|
||||||
From: linsaftw <linsaftw@users.noreply.github.com>
|
From: linsaftw <linsaftw@users.noreply.github.com>
|
||||||
Date: Fri, 30 Apr 2021 19:23:36 -0300
|
Date: Fri, 30 Apr 2021 19:23:36 -0300
|
||||||
Subject: [PATCH] Firewall System
|
Subject: [PATCH] Firewall System
|
||||||
@ -63,6 +63,58 @@ index 8957c79a..fd889644 100644
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
\ No newline at end of file
|
\ No newline at end of file
|
||||||
|
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
|
||||||
|
index 650cb302..b7268e1d 100644
|
||||||
|
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
|
||||||
|
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
|
||||||
|
@@ -13,7 +13,12 @@ import net.md_5.bungee.config.ConfigurationProvider;
|
||||||
|
|
||||||
|
public class FlameCordConfiguration {
|
||||||
|
@Getter
|
||||||
|
- private boolean loggerInitialhandler = false, loggerExceptions = false, loggerDump = false;
|
||||||
|
+ private boolean loggerInitialhandler = false, loggerExceptions = false, loggerDump = false, firewallNotify = true,
|
||||||
|
+ firewallEnabled = true;
|
||||||
|
+ @Getter
|
||||||
|
+ private int firewallSeconds = 60;
|
||||||
|
+ @Getter
|
||||||
|
+ private Collection<String> firewallNames = new HashSet<>(Arrays.asList(new String[] { "mcspam" }));
|
||||||
|
|
||||||
|
public FlameCordConfiguration(final ConfigurationProvider configurationProvider) {
|
||||||
|
try {
|
||||||
|
@@ -32,6 +37,10 @@ public class FlameCordConfiguration {
|
||||||
|
configuration);
|
||||||
|
this.loggerExceptions = setIfUnexistant("logger.exceptions", this.loggerExceptions, configuration);
|
||||||
|
this.loggerDump = setIfUnexistant("logger.dump", this.loggerDump, configuration);
|
||||||
|
+ this.firewallEnabled = setIfUnexistant("firewall.enabled", this.firewallEnabled, configuration);
|
||||||
|
+ this.firewallNotify = setIfUnexistant("firewall.notify", this.firewallNotify, configuration);
|
||||||
|
+ this.firewallSeconds = setIfUnexistant("firewall.seconds", this.firewallSeconds, configuration);
|
||||||
|
+ this.firewallNames = setIfUnexistant("firewall.names", this.firewallNames, configuration);
|
||||||
|
|
||||||
|
if (!configurationExists) {
|
||||||
|
configurationProvider.save(configuration, configurationFile);
|
||||||
|
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java
|
||||||
|
index ebfaa761..c88077ad 100644
|
||||||
|
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java
|
||||||
|
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java
|
||||||
|
@@ -82,9 +82,17 @@ public class MessagesConfiguration {
|
||||||
|
setIfUnexistant("command_ip", "&9IP of {0} is {1}", configuration);
|
||||||
|
|
||||||
|
// FlameCord
|
||||||
|
+ setIfUnexistant("firewall_added", "&e{0}&c had been firewalled from the proxy!", configuration);
|
||||||
|
+ setIfUnexistant("firewall_blocked", "&e{0}&c is firewalled from the proxy, request blocked!",
|
||||||
|
+ configuration);
|
||||||
|
+ setIfUnexistant("firewall_info",
|
||||||
|
+ "&aThere are&b {0} &aaddresses firewalled!\n&aThe firewall will clear in &b{1} &aseconds!",
|
||||||
|
+ configuration);
|
||||||
|
+ setIfUnexistant("firewall_cleared", "&b{0}&a addresses had been automatically removed from the firewall!",
|
||||||
|
+ configuration);
|
||||||
|
setIfUnexistant("flamecord_reload", "&aAll files had been successfully reloaded!", configuration);
|
||||||
|
setIfUnexistant("flamecord_help",
|
||||||
|
- "&aFlameCord&b {0}&a by&b LinsaFTW&a &&b Sammwy&r\n&e /flamecord reload&7 >&b Reloads FlameCord files!\n&e /flamecord help&7 >&b Shows this message!",
|
||||||
|
+ "&aFlameCord&b {0}&a by&b LinsaFTW&a &&b Sammwy&r\n&e /flamecord reload&7 >&b Reloads FlameCord files!\n&e /flamecord firewall&7 >&b Shows information about the Firewall!\n&e /flamecord help&7 >&b Shows this message!",
|
||||||
|
configuration);
|
||||||
|
setIfUnexistant("flamecord_nopermission", "&cYou don't have permission to do this!", configuration);
|
||||||
|
|
||||||
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/firewall/FirewallException.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/firewall/FirewallException.java
|
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/firewall/FirewallException.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/firewall/FirewallException.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 00000000..6a661898
|
index 00000000..6a661898
|
||||||
|
Loading…
Reference in New Issue
Block a user