Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/net/tcpshield/tcpshield/TCPShieldPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ default void initialization() {
String[] versionParts = jvmVersion.split("\\.");
int baseVersion = Integer.parseInt(versionParts[0]);
if (baseVersion < 11) // Java 8, and below, starts with 1, but since we are using Java 11 we can ignore sub values
this.getDebugger().warn("The Java version you are running is outdated for TCPShield and may cause issues. Update to atleast Java 11. Your version: Java %s", jvmVersion);
this.getDebugger().warn("The Java version you are running is outdated for TCPShield and may cause issues. Update to at least Java 11. Your version: Java %s", jvmVersion);
} catch (Throwable t) {
this.getDebugger().error("Failed to check java version for string: " + jvmVersion);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected void reset() throws ConfigResetException {
// Just ignore since it either does not exist, or we can overwrite
}

try (InputStream in = plugin.getResource("config.yml")) { // Have to use Bukkit's resource streaming or the resource wont be found
try (InputStream in = plugin.getResource("config.yml")) { // Have to use Bukkit's resource streaming or the resource won't be found
Files.copy(in, configFile.toPath());
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public PaperPlayer(PlayerHandshakeEvent handshakeEvent) {

/**
* Trys to grab the UUID of the handshake
* @return If found, the corrosponding uuid, if not, unknown
* @return If found, the corresponding uuid, if not, unknown
*/
@Override
public String getUUID() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
import net.tcpshield.tcpshield.util.exception.config.ConfigReloadException;
import net.tcpshield.tcpshield.util.exception.config.ConfigResetException;
import net.tcpshield.tcpshield.util.exception.phase.ConfigException;
import net.tcpshield.tcpshield.velocity.VelocityConfig;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public BungeePlayer(PendingConnection pendingConnection) {
/**
* Trys to grab the UUID of the handshake
*
* @return If found, the corrosponding uuid, if not, unknown
* @return If found, the corresponding uuid, if not, unknown
*/
@Override
public String getUUID() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public File getConfigFile() {
/*
* Plugin Constants
*/
protected final long maxTimestampDifference = 3; // In Unix Timesteps (Seconds)
protected final long maxTimestampDifference = 3; // In Unix Timestamps (Seconds)


public long getMaxTimestampDifference() {
Expand All @@ -74,7 +74,7 @@ public long getMaxTimestampDifference() {
*/

/**
* Deletes the current config saved to the disk and reinstalls the default config
* Deletes the current config saved to the disk and installs the default config
* @throws ConfigResetException Thrown if resetting fails
*/
protected abstract void reset() throws ConfigResetException;
Expand All @@ -94,7 +94,7 @@ public long getMaxTimestampDifference() {
/**
* Checks the provided nodes to see if they exist in the config
* @param nodes The nodes to check
* @throws ConfigException Thrown when a node isnt found
* @throws ConfigException Thrown when a node isn't found
*/
protected abstract void checkNodes(String... nodes) throws ConfigException;

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/net/tcpshield/tcpshield/util/Debugger.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void exception(Exception exception) {
protected final Logger logger;

/**
* Non-accessable constructor for creating a debugger
* Non-accessible constructor for creating a debugger
* @param logger The plugin's logger
*/
private Debugger(Logger logger) {
Expand All @@ -87,21 +87,21 @@ private Debugger(Logger logger) {
/**
* Outputs debug information with log level "INFO"
* @param format The output string to be formatted
* @param formats The formarts for the string
* @param formats The formats for the string
*/
public abstract void info(String format, Object... formats);

/**
* Outputs debug information with log level "WARNING"
* @param format The output string to be formatted
* @param formats The formarts for the string
* @param formats The formats for the string
*/
public abstract void warn(String format, Object... formats);

/**
* Outputs debug information with log level "SEVERE"
* @param format The output string to be formatted
* @param formats The formarts for the string
* @param formats The formats for the string
*/
public abstract void error(String format, Object... formats);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.lang.reflect.Field;

/**
* A util for reflection and manipulation
* An util for reflection and manipulation
*/
public class ReflectionUtil {

Expand Down Expand Up @@ -46,7 +46,7 @@ public static void setFinalField(Object object, Field field, Object value) thro
// if (modifiersField == null) {
// try {
// modifiersField = getDeclaredField(Field.class, "modifiers");
// } catch (ReflectionException e) { // workaround for when searching for the modifiers field on Java 12 or higher
// } catch (ReflectionException e) { // workaround for when searching for the modifiers' field on Java 12 or higher
// try {
// Method getDeclaredFields0 = Class.class.getDeclaredMethod("getDeclaredFields0", boolean.class);
// getDeclaredFields0.setAccessible(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class CIDRException extends TCPShieldException {

public CIDRException(Throwable throwable) {
super("An exception occured during the CIDR process", throwable);
super("An exception occurred during the CIDR process", throwable);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import net.tcpshield.tcpshield.util.exception.TCPShieldException;

/**
* An exception thrown during the config loading, reloeading, saving, etc. process of TCPShield
* An exception thrown during the config loading, reloading, saving, etc. process of TCPShield
*/
public class ConfigException extends TCPShieldException {

public ConfigException(Throwable throwable) {
super("An exception occured during the config process", throwable);
super("An exception occurred during the config process", throwable);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class HandshakeException extends TCPShieldException {

public HandshakeException(Throwable throwable) {
super("An exception occured during the handshake process", throwable);
super("An exception occurred during the handshake process", throwable);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class InitializationException extends TCPShieldException {

public InitializationException(Throwable throwable) {
super("An exception occured during the initalization process", throwable);
super("An exception occurred during the initialization process", throwable);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class ReflectionException extends TCPShieldException {

public ReflectionException(Throwable throwable) {
super("An exception occured during the reflection process", throwable);
super("An exception occurred during the reflection process", throwable);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public abstract class CIDRMatcher {
/**
* Creates a CIDRMatcher from a CIDR matching regex
* @param cidrMatchString The string containing the CIDR matching regex
* @return The corrosponding CIDRMatcher
* @return The corresponding CIDRMatcher
*/
public static CIDRMatcher create(String cidrMatchString) {
return new CIDRMatcher(cidrMatchString) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class CIDRValidator {
private final File ipWhitelistFolder;

private final List<CIDRMatcher> cidrMatchers;
private final Set<String> cache = new HashSet<>(); // Max potential size is equilivent to the amount of whitelisted IP's
private final Set<String> cache = new HashSet<>(); // Max potential size is equivalent to the amount of whitelisted IP's

public CIDRValidator(TCPShieldPlugin plugin) throws CIDRException {
this.plugin = plugin;
Expand All @@ -43,7 +43,7 @@ private List<CIDRMatcher> loadCIDRMatchers(List<String> whitelists) {
try {
matchers.add(CIDRMatcher.create(whitelist));
} catch (Exception e) {
plugin.getDebugger().warn("Exception occured while creating CIDRMatcher for \"%s\". Ignoring it.", whitelist);
plugin.getDebugger().warn("Exception occurred while creating CIDRMatcher for \"%s\". Ignoring it.", whitelist);
plugin.getDebugger().exception(e);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/**
* A timestamp validator that offsets system time with Google's to sync
* tiemstamps
* timestamps
*/
public class HTPDateTimestampValidator extends TimestampValidator {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import net.tcpshield.tcpshield.provider.PacketProvider;
import net.tcpshield.tcpshield.util.ReflectionUtil;
import net.tcpshield.tcpshield.util.exception.manipulate.PacketManipulationException;
import net.tcpshield.tcpshield.util.exception.phase.HandshakeException;
import net.tcpshield.tcpshield.util.exception.phase.InitializationException;
import net.tcpshield.tcpshield.util.exception.phase.ReflectionException;

Expand Down Expand Up @@ -87,7 +86,7 @@ public void setPacketHostname(String hostname) throws PacketManipulationExceptio
}

/**
* Adapted from https://github.com/VelocityPowered/Velocity/blob/17e6944daea8130e03903ccdfbf63f111c573849/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java
* Adapted from <a href="https://github.com/VelocityPowered/Velocity/blob/17e6944daea8130e03903ccdfbf63f111c573849/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java">GitHub</a>
*/
private String cleanAddress(String hostname) {
// Clean out any anything after any zero bytes (this includes BungeeCord forwarding and the
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/velocity-plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
}
],
"main": "net.tcpshield.tcpshield.velocity.TCPShieldVelocity"
}
}