Changed minimum characters to 2 for validity check

This commit is contained in:
Ammar Askar 2013-04-14 21:32:19 +05:00
parent 7955ab6342
commit 9d524e7755

View File

@ -1,6 +1,6 @@
From d8a60325ae53f811ad456e3b0738de3ccd02360e Mon Sep 17 00:00:00 2001 From 2869840ad478538331bca1e3440b41dd554cf429 Mon Sep 17 00:00:00 2001
From: Benjamin James Harrison-Sims <tehrainbowguy@gmail.com> From: Benjamin James Harrison-Sims <tehrainbowguy@gmail.com>
Date: Sun, 14 Apr 2013 03:08:51 +0100 Date: Sun, 14 Apr 2013 21:19:57 +0500
Subject: [PATCH] Prevent handshake spam from invalid names. Subject: [PATCH] Prevent handshake spam from invalid names.
@ -25,7 +25,7 @@ index 343af93..aa6609b 100644
public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
index 504bd8b..5bf5c10 100644 index 504bd8b..ff28a99 100644
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java --- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java +++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
@@ -9,6 +9,8 @@ import org.bukkit.configuration.file.YamlConfiguration; @@ -9,6 +9,8 @@ import org.bukkit.configuration.file.YamlConfiguration;
@ -41,10 +41,10 @@ index 504bd8b..5bf5c10 100644
private static Metrics metrics; private static Metrics metrics;
public static List<String> bungeeIPs; public static List<String> bungeeIPs;
public static int textureResolution = 16; public static int textureResolution = 16;
+ public static final Pattern validName = Pattern.compile("^[a-zA-Z0-9_]{3,16}$"); + public static final Pattern validName = Pattern.compile("^[a-zA-Z0-9_]{2,16}$");
public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) { public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) {
commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps")); commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps"));
-- --
1.8.2.1 1.7.11.msysgit.0