Merge remote-tracking branch 'refs/remotes/origin/develop' into update/ssm

This commit is contained in:
Sam 2017-04-29 23:40:16 +01:00
commit ee8f970673
7 changed files with 131 additions and 6 deletions

View File

@ -0,0 +1,54 @@
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);
}
}

View File

@ -0,0 +1,55 @@
package mineplex.game.clans;
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.MiniPlugin;
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);
}
}

View File

@ -280,6 +280,9 @@ public class Clans extends JavaPlugin
MinecraftServer.getServer().getPropertyManager().setProperty("debug", false);
SpigotConfig.debug = false;
// TODO temporary fix for book related crashes.
new BookRateLimiter();
}
public static String prettifyName(Material material)

View File

@ -1,9 +1,12 @@
package mineplex.clanshub;
import static mineplex.core.Managers.require;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.BookRateLimiter;
import mineplex.core.CustomTagFix;
import mineplex.core.PacketsInteractionFix;
import mineplex.core.account.CoreClientManager;
@ -65,8 +68,6 @@ import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.damage.DamageManager;
import static mineplex.core.Managers.require;
/**
* Main class for clans hub
*/
@ -183,6 +184,9 @@ public class ClansHub extends JavaPlugin
require(Titles.class);
require(TwoFactorAuth.class);
new WebsiteLinkManager(this, clientManager);
// TODO temporary fix for book related crashes.
new BookRateLimiter();
}
@Override

View File

@ -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,6 +79,7 @@ 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;
@ -244,6 +245,9 @@ public class Hub extends JavaPlugin implements IRelation
require(AprilFoolsTreasureHunt.class);
}
require(TwitchIntegrationFix.class);
// TODO temporary fix for book related crashes.
new BookRateLimiter();
}
@Override

View File

@ -1,9 +1,10 @@
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;
@ -16,6 +17,7 @@ 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;
@ -24,6 +26,7 @@ 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;
@ -86,7 +89,6 @@ 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
{
@ -237,6 +239,9 @@ public class Arcade extends JavaPlugin
MinecraftServer.getServer().getPropertyManager().setProperty("debug", false);
SpigotConfig.debug = false;
// TODO temporary fix for book related crashes.
new BookRateLimiter();
}
@Override

View File

@ -254,7 +254,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
public long PrepareTime = 9000;
public boolean PlaySoundGameStart = true;
public double XpMult = 1;
public double XpMult = 2;
public boolean SpeedMeasurement = false;