Skip to content

Commit 175eac8

Browse files
authored
Merge branch 'Doclic:main' into main
2 parents 6df5ec7 + 59a4d29 commit 175eac8

37 files changed

+3001
-154
lines changed

.gitignore

Lines changed: 93 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# User-specific stuff
2+
.idea/
3+
4+
*.iml
5+
*.ipr
6+
*.iws
7+
8+
# IntelliJ
9+
out/
10+
111
# Compiled class file
212
*.class
313

@@ -7,9 +17,6 @@
717
# BlueJ files
818
*.ctxt
919

10-
# Mobile Tools for Java (J2ME)
11-
.mtj.tmp/
12-
1320
# Package Files #
1421
*.jar
1522
*.war
@@ -21,3 +28,86 @@
2128

2229
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2330
hs_err_pid*
31+
32+
*~
33+
34+
# temporary files which can be created if a process still has a handle open of a deleted file
35+
.fuse_hidden*
36+
37+
# KDE directory preferences
38+
.directory
39+
40+
# Linux trash folder which might appear on any partition or disk
41+
.Trash-*
42+
43+
# .nfs files are created when an open file is removed but is still being accessed
44+
.nfs*
45+
46+
# General
47+
.DS_Store
48+
.AppleDouble
49+
.LSOverride
50+
51+
# Icon must end with two \r
52+
Icon
53+
54+
# Thumbnails
55+
._*
56+
57+
# Files that might appear in the root of a volume
58+
.DocumentRevisions-V100
59+
.fseventsd
60+
.Spotlight-V100
61+
.TemporaryItems
62+
.Trashes
63+
.VolumeIcon.icns
64+
.com.apple.timemachine.donotpresent
65+
66+
# Directories potentially created on remote AFP share
67+
.AppleDB
68+
.AppleDesktop
69+
Network Trash Folder
70+
Temporary Items
71+
.apdisk
72+
73+
# Windows thumbnail cache files
74+
Thumbs.db
75+
Thumbs.db:encryptable
76+
ehthumbs.db
77+
ehthumbs_vista.db
78+
79+
# Dump file
80+
*.stackdump
81+
82+
# Folder config file
83+
[Dd]esktop.ini
84+
85+
# Recycle Bin used on file shares
86+
$RECYCLE.BIN/
87+
88+
# Windows Installer files
89+
*.cab
90+
*.msi
91+
*.msix
92+
*.msm
93+
*.msp
94+
95+
# Windows shortcuts
96+
*.lnk
97+
98+
target/
99+
100+
pom.xml.tag
101+
pom.xml.releaseBackup
102+
pom.xml.versionsBackup
103+
pom.xml.next
104+
105+
release.properties
106+
dependency-reduced-pom.xml
107+
buildNumber.properties
108+
.mvn/timing.properties
109+
.mvn/wrapper/maven-wrapper.jar
110+
.flattened-pom.xml
111+
112+
# Common working directory
113+
run/

1.19.1/pom.xml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<artifactId>NoEncryption-1.19.1</artifactId>
8+
<version>3.1</version>
9+
<packaging>jar</packaging>
10+
11+
<name>NoEncryption-1.19.1</name>
12+
13+
<description>Makes every player message a system message</description>
14+
15+
<parent>
16+
<groupId>me.doclic</groupId>
17+
<artifactId>NoEncryption</artifactId>
18+
<version>3.1</version>
19+
</parent>
20+
21+
<properties>
22+
<java.version>1.17</java.version>
23+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
24+
</properties>
25+
26+
<build>
27+
<plugins>
28+
<plugin>
29+
<groupId>org.apache.maven.plugins</groupId>
30+
<artifactId>maven-compiler-plugin</artifactId>
31+
<version>3.8.1</version>
32+
<configuration>
33+
<source>16</source>
34+
<target>16</target>
35+
</configuration>
36+
</plugin>
37+
<plugin>
38+
<groupId>org.apache.maven.plugins</groupId>
39+
<artifactId>maven-shade-plugin</artifactId>
40+
<version>3.2.4</version>
41+
<executions>
42+
<execution>
43+
<phase>package</phase>
44+
<goals>
45+
<goal>shade</goal>
46+
</goals>
47+
<configuration>
48+
<createDependencyReducedPom>false</createDependencyReducedPom>
49+
</configuration>
50+
</execution>
51+
</executions>
52+
</plugin>
53+
<plugin>
54+
<groupId>net.md-5</groupId>
55+
<artifactId>specialsource-maven-plugin</artifactId>
56+
<version>1.2.2</version>
57+
<executions>
58+
<execution>
59+
<phase>package</phase>
60+
<goals>
61+
<goal>remap</goal>
62+
</goals>
63+
<id>remap-obf</id>
64+
<configuration>
65+
<srgIn>org.spigotmc:minecraft-server:1.19.1-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
66+
<reverse>true</reverse>
67+
<remappedDependencies>org.spigotmc:spigot:1.19.1-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
68+
<remappedArtifactAttached>true</remappedArtifactAttached>
69+
<remappedClassifierName>remapped-obf</remappedClassifierName>
70+
</configuration>
71+
</execution>
72+
<execution>
73+
<phase>package</phase>
74+
<goals>
75+
<goal>remap</goal>
76+
</goals>
77+
<id>remap-spigot</id>
78+
<configuration>
79+
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
80+
<srgIn>org.spigotmc:minecraft-server:1.19.1-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
81+
<remappedDependencies>org.spigotmc:spigot:1.19.1-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
82+
</configuration>
83+
</execution>
84+
</executions>
85+
</plugin>
86+
</plugins>
87+
<resources>
88+
<resource>
89+
<directory>src/main/resources</directory>
90+
<filtering>true</filtering>
91+
</resource>
92+
</resources>
93+
</build>
94+
95+
<repositories>
96+
<repository>
97+
<id>papermc</id>
98+
<url>https://repo.papermc.io/repository/maven-public/</url>
99+
</repository>
100+
<repository>
101+
<id>spigot-repo</id>
102+
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
103+
</repository>
104+
</repositories>
105+
106+
<dependencies>
107+
<dependency>
108+
<groupId>io.papermc.paper</groupId>
109+
<artifactId>paper-api</artifactId>
110+
<version>1.19.1-R0.1-SNAPSHOT</version>
111+
<scope>provided</scope>
112+
</dependency>
113+
<dependency>
114+
<groupId>org.spigotmc</groupId>
115+
<artifactId>spigot</artifactId>
116+
<version>1.19.1-R0.1-SNAPSHOT</version>
117+
<scope>provided</scope>
118+
<classifier>remapped-mojang</classifier>
119+
</dependency>
120+
</dependencies>
121+
</project>

src/main/java/me/doclic/noencryption/NoEncryption.java renamed to 1.19.1/src/main/java/me/doclic/noencryption/NoEncryption.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package me.doclic.noencryption;
22

33
import me.doclic.noencryption.compatibility.Compatibility;
4+
import me.doclic.noencryption.config.ConfigurationHandler;
5+
import me.doclic.noencryption.utils.FileMgmt;
46
import org.bukkit.Bukkit;
57
import org.bukkit.plugin.java.JavaPlugin;
68

@@ -11,6 +13,17 @@ public void onEnable() {
1113

1214
if (Compatibility.SERVER_COMPATIBLE) {
1315

16+
FileMgmt.initialize(this);
17+
ConfigurationHandler.initialize(this);
18+
19+
if (!ConfigurationHandler.loadSettings()) {
20+
getLogger().severe("Configuration could not be loaded, disabling...");
21+
Bukkit.getPluginManager().disablePlugin(this);
22+
return;
23+
}
24+
25+
ConfigurationHandler.printChanges();
26+
1427
Bukkit.getPluginManager().registerEvents(new PlayerListener(), this);
1528

1629
getLogger().info("Compatibility successful!");
@@ -27,4 +40,8 @@ public void onEnable() {
2740
}
2841

2942
}
43+
44+
public String getRootFolder() {
45+
return this.getDataFolder().getPath();
46+
}
3047
}

src/main/java/me/doclic/noencryption/PlayerListener.java renamed to 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)

src/main/java/me/doclic/noencryption/compatibility/Compatibility.java renamed to 1.19.1/src/main/java/me/doclic/noencryption/compatibility/Compatibility.java

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,19 @@ public class Compatibility {
1111
public static final CompatiblePlayer COMPATIBLE_PLAYER;
1212
public static final CompatiblePacketListener COMPATIBLE_PACKET_LISTENER;
1313

14+
public static final String PLUGIN_COMPATIBLE_VERSION;
1415
public static final boolean SERVER_COMPATIBLE;
1516
public static final String SERVER_VERSION;
1617

1718
static {
1819

1920
String minecraftVersion;
2021

22+
PLUGIN_COMPATIBLE_VERSION = "1.19.1-R0.1-SNAPSHOT";
23+
2124
try {
2225

23-
minecraftVersion = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]; // Gets the server version
26+
minecraftVersion = Bukkit.getBukkitVersion();
2427

2528

2629
} catch (ArrayIndexOutOfBoundsException exception) {
@@ -31,12 +34,10 @@ public class Compatibility {
3134

3235
Bukkit.getLogger().info("Your server is running version " + minecraftVersion);
3336

34-
if (minecraftVersion != null) {
35-
36-
final String versionPackage = getVersionPackage(minecraftVersion);
37+
if (minecraftVersion != null && minecraftVersion.equals(PLUGIN_COMPATIBLE_VERSION)) {
3738

38-
COMPATIBLE_PLAYER = instantiate(getCompatibleClass(CompatiblePlayer.class, minecraftVersion, versionPackage));
39-
COMPATIBLE_PACKET_LISTENER = instantiate(getCompatibleClass(CompatiblePacketListener.class, minecraftVersion, versionPackage));
39+
COMPATIBLE_PLAYER = instantiate(CompatiblePlayer.class);
40+
COMPATIBLE_PACKET_LISTENER = instantiate(CompatiblePacketListener.class);
4041

4142
SERVER_COMPATIBLE = true;
4243

@@ -51,28 +52,6 @@ public class Compatibility {
5152

5253
}
5354

54-
private static String getVersionPackage(String minecraftVersion) {
55-
56-
return Compatibility.class.getPackage().getName() + "." + minecraftVersion;
57-
58-
}
59-
60-
private static <T> Class<? extends T> getCompatibleClass(Class<T> clazz, String minecraftVersion, String versionPackage) {
61-
62-
try {
63-
final Class<?> compatibleClass = Class.forName(versionPackage + "." + clazz.getSimpleName() + "_" + minecraftVersion);
64-
if (compatibleClass.getSuperclass() != clazz && !Arrays.asList(compatibleClass.getInterfaces()).contains(clazz)) {
65-
return null;
66-
}
67-
else
68-
//noinspection unchecked
69-
return (Class<? extends T>) compatibleClass;
70-
} catch (ClassNotFoundException e) {
71-
return null;
72-
}
73-
74-
}
75-
7655
private static <T> T instantiate(Class<T> clazz) {
7756

7857
if (clazz == null) return null;

0 commit comments

Comments
 (0)