Revert "Rate limit book/sign edits as a temporary measure against a crash exploit"
This reverts commit f5cba1eb1e
.
This commit is contained in:
parent
d99f51f3a9
commit
6ae6f7b627
@ -1,54 +0,0 @@
|
||||
package mineplex.core;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInCustomPayload;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.packethandler.PacketHandler.ListenerPriority;
|
||||
|
||||
/**
|
||||
* A temporary fix for book-related crashes. Adds a rate limit to book/sign edits.
|
||||
* <p>
|
||||
* See:
|
||||
* https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/1c3428e534283395dd1b85641a96a6f16842fc1e
|
||||
* https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/4acd0f49e07e0912096e79494472535baf0db2ab
|
||||
*/
|
||||
public class BookRateLimiter extends MiniPlugin
|
||||
{
|
||||
|
||||
private final PacketHandler _packetHandler = require(PacketHandler.class);
|
||||
private final Cache<UUID, Integer> _cache = CacheBuilder.newBuilder()
|
||||
.expireAfterWrite(1, TimeUnit.SECONDS)
|
||||
.build();
|
||||
|
||||
public BookRateLimiter()
|
||||
{
|
||||
super("PacketRateLimiter");
|
||||
|
||||
_packetHandler.addPacketHandler(info ->
|
||||
{
|
||||
PacketPlayInCustomPayload packet = (PacketPlayInCustomPayload) info.getPacket();
|
||||
String s = packet.a();
|
||||
if (!s.equals("MC|BEdit") && !s.equals("MC|BSign"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_cache.asMap().containsKey(info.getPlayer().getUniqueId()))
|
||||
{
|
||||
info.setCancelled(true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_cache.put(info.getPlayer().getUniqueId(), 0);
|
||||
|
||||
}, ListenerPriority.LOW, true, PacketPlayInCustomPayload.class);
|
||||
}
|
||||
|
||||
}
|
@ -280,9 +280,6 @@ public class Clans extends JavaPlugin
|
||||
|
||||
MinecraftServer.getServer().getPropertyManager().setProperty("debug", false);
|
||||
SpigotConfig.debug = false;
|
||||
|
||||
// TODO temporary fix for book related crashes.
|
||||
new PacketRateLimiter();
|
||||
}
|
||||
|
||||
public static String prettifyName(Material material)
|
||||
|
@ -183,9 +183,6 @@ public class ClansHub extends JavaPlugin
|
||||
require(Titles.class);
|
||||
require(TwoFactorAuth.class);
|
||||
new WebsiteLinkManager(this, clientManager);
|
||||
|
||||
// TODO temporary fix for book related crashes.
|
||||
new PacketRateLimiter();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,13 +2,13 @@ package mineplex.hub;
|
||||
|
||||
import static mineplex.core.Managers.require;
|
||||
|
||||
import mineplex.hub.modules.AprilFoolsTreasureHunt;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.CustomTagFix;
|
||||
import mineplex.core.BookRateLimiter;
|
||||
import mineplex.core.PacketsInteractionFix;
|
||||
import mineplex.core.TwitchIntegrationFix;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
@ -79,7 +79,6 @@ import mineplex.core.updater.Updater;
|
||||
import mineplex.core.velocity.VelocityFix;
|
||||
import mineplex.core.visibility.VisibilityManager;
|
||||
import mineplex.core.website.WebsiteLinkManager;
|
||||
import mineplex.hub.modules.AprilFoolsTreasureHunt;
|
||||
import mineplex.hub.modules.BillboardManager;
|
||||
import mineplex.hub.queue.QueueManager;
|
||||
import mineplex.hub.server.ServerManager;
|
||||
@ -245,9 +244,6 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
require(AprilFoolsTreasureHunt.class);
|
||||
}
|
||||
require(TwitchIntegrationFix.class);
|
||||
|
||||
// TODO temporary fix for book related crashes.
|
||||
new BookRateLimiter();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,10 +1,9 @@
|
||||
package nautilus.game.arcade;
|
||||
|
||||
import static mineplex.core.Managers.require;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.aprilfools.AprilFoolsManager;
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -17,7 +16,6 @@ import org.spigotmc.SpigotConfig;
|
||||
|
||||
import mineplex.core.CustomTagFix;
|
||||
import mineplex.core.FoodDupeFix;
|
||||
import mineplex.core.BookRateLimiter;
|
||||
import mineplex.core.PacketsInteractionFix;
|
||||
import mineplex.core.TimingsFix;
|
||||
import mineplex.core.TwitchIntegrationFix;
|
||||
@ -26,7 +24,6 @@ import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.antihack.RelationProvider;
|
||||
import mineplex.core.antihack.logging.AntihackLogger;
|
||||
import mineplex.core.aprilfools.AprilFoolsManager;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.blood.Blood;
|
||||
import mineplex.core.boosters.BoosterManager;
|
||||
@ -89,6 +86,7 @@ import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
import nautilus.game.arcade.anticheatmetadata.GameInfoMetadata;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameServerConfig;
|
||||
import static mineplex.core.Managers.require;
|
||||
|
||||
public class Arcade extends JavaPlugin
|
||||
{
|
||||
@ -239,9 +237,6 @@ public class Arcade extends JavaPlugin
|
||||
|
||||
MinecraftServer.getServer().getPropertyManager().setProperty("debug", false);
|
||||
SpigotConfig.debug = false;
|
||||
|
||||
// TODO temporary fix for book related crashes.
|
||||
new BookRateLimiter();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user