Update from upstream SpigotMC
Don't use Bukkit.getLogger as the CraftServer isn't loaded at this point SpigotMC/Spigot@5c48793ecf Modify the block placement limit to allow for the odd random packet or two SpigotMC/Spigot@7768676ae2
This commit is contained in:
@@ -14,14 +14,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
+ // Spigot start - limit place/interactions
|
+ // Spigot start - limit place/interactions
|
||||||
+ private long lastPlace = -1;
|
+ private long lastPlace = -1;
|
||||||
|
+ private int packets = 0;
|
||||||
+
|
+
|
||||||
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
|
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
|
||||||
+ boolean throttled = false;
|
+ boolean throttled = false;
|
||||||
+ if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 5) {
|
+ if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) {
|
||||||
+ throttled = true;
|
+ throttled = true;
|
||||||
+ } else
|
+ } else if ( packetplayinblockplace.timestamp - lastPlace >= 30 || lastPlace == -1 )
|
||||||
+ {
|
+ {
|
||||||
+ lastPlace = packetplayinblockplace.timestamp;
|
+ lastPlace = packetplayinblockplace.timestamp;
|
||||||
|
+ packets = 0;
|
||||||
+ }
|
+ }
|
||||||
+ // Spigot end
|
+ // Spigot end
|
||||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Spigot Start
|
+ // Spigot Start
|
||||||
+ } catch ( java.io.FileNotFoundException ex )
|
+ } catch ( java.io.FileNotFoundException ex )
|
||||||
+ {
|
+ {
|
||||||
+ org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.INFO, "Unable to find file {0}, creating it.", this.c );
|
+ a.info( "Unable to find file {0}, creating it.", this.c );
|
||||||
+ } catch ( net.minecraft.util.com.google.gson.JsonSyntaxException ex )
|
+ } catch ( net.minecraft.util.com.google.gson.JsonSyntaxException ex )
|
||||||
+ {
|
+ {
|
||||||
+ org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.WARNING, "Unable to read file {0}, backing it up to {0}.backup and creating new copy.", this.c );
|
+ a.warn( "Unable to read file {0}, backing it up to {0}.backup and creating new copy.", this.c );
|
||||||
+ File backup = new File( this.c + ".backup" );
|
+ File backup = new File( this.c + ".backup" );
|
||||||
+ this.c.renameTo( backup );
|
+ this.c.renameTo( backup );
|
||||||
+ this.c.delete();
|
+ this.c.delete();
|
||||||
@@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
;
|
;
|
||||||
+ // Spigot Start
|
+ // Spigot Start
|
||||||
+ } catch (net.minecraft.util.com.google.gson.JsonSyntaxException ex) {
|
+ } catch (net.minecraft.util.com.google.gson.JsonSyntaxException ex) {
|
||||||
+ org.bukkit.Bukkit.getLogger().warning( "Usercache.json is corrupted or has bad formatting. Deleting it to prevent further issues.");
|
+ JsonList.a.warn( "Usercache.json is corrupted or has bad formatting. Deleting it to prevent further issues." );
|
||||||
+ this.g.delete();
|
+ this.g.delete();
|
||||||
+ // Spigot End
|
+ // Spigot End
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||||
Date: Wed, 16 Jul 2014 14:11:08 -0500
|
Date: Thu, 24 Jul 2014 22:19:44 -0500
|
||||||
Subject: [PATCH] Toggle for player interact limiter
|
Subject: [PATCH] Toggle for player interact limiter
|
||||||
|
|
||||||
|
|
||||||
@@ -21,10 +21,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
|
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
|
||||||
boolean throttled = false;
|
boolean throttled = false;
|
||||||
- if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 5) {
|
- if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) {
|
||||||
+ if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 5 && PaperSpigotConfig.interactLimitEnabled) {
|
+ if (PaperSpigotConfig.interactLimitEnabled && lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) {
|
||||||
throttled = true;
|
throttled = true;
|
||||||
} else
|
} else if ( packetplayinblockplace.timestamp - lastPlace >= 30 || lastPlace == -1 )
|
||||||
{
|
{
|
||||||
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
|
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
|||||||
Reference in New Issue
Block a user