mirror of
https://github.com/moparisthebest/MoparClassic
synced 2024-12-21 23:18:52 -05:00
Players are now destroyed once they hit the threshold (fixed an off by one bug).
This commit is contained in:
parent
428c3ec7cb
commit
2b976a8041
@ -79,6 +79,12 @@ public class Formulae {
|
|||||||
private static Random r = new Random();
|
private static Random r = new Random();
|
||||||
public static final int[] runeIDs = { 31, 32, 33, 34, 35, 36, 37, 38, 40,
|
public static final int[] runeIDs = { 31, 32, 33, 34, 35, 36, 37, 38, 40,
|
||||||
41, 42, 46, 619, 825 };
|
41, 42, 46, 619, 825 };
|
||||||
|
/**
|
||||||
|
* Safe packets:<br>
|
||||||
|
* PlayerAppearanceUpdater<br>
|
||||||
|
* FollowRequest<br>
|
||||||
|
* InvUseOnItem<br>
|
||||||
|
*/
|
||||||
public static final int[] safePacketIDs = { 70, 123, 128, 255 };
|
public static final int[] safePacketIDs = { 70, 123, 128, 255 };
|
||||||
public static final String[] statArray = { "attack", "defense", "strength",
|
public static final String[] statArray = { "attack", "defense", "strength",
|
||||||
"hits", "ranged", "prayer", "magic", "cooking", "woodcut",
|
"hits", "ranged", "prayer", "magic", "cooking", "woodcut",
|
||||||
|
@ -584,6 +584,12 @@ public final class Player extends Mob {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method acts as a throttle for packets, and adds them to a list.<br>
|
||||||
|
* If the player sends more than 20 packets per second they're disconnected (60 packets per 3000ms)
|
||||||
|
*
|
||||||
|
* @param p - the packet to add...
|
||||||
|
*/
|
||||||
public void addPacket(RSCPacket p) {
|
public void addPacket(RSCPacket p) {
|
||||||
long now = GameEngine.getTime();
|
long now = GameEngine.getTime();
|
||||||
if (now - lastCount > 3000) {
|
if (now - lastCount > 3000) {
|
||||||
@ -591,7 +597,7 @@ public final class Player extends Mob {
|
|||||||
packetCount = 0;
|
packetCount = 0;
|
||||||
}
|
}
|
||||||
if (!DataConversions.inArray(Formulae.safePacketIDs, p.getID())
|
if (!DataConversions.inArray(Formulae.safePacketIDs, p.getID())
|
||||||
&& packetCount++ >= 60) {
|
&& ++packetCount >= 60) {
|
||||||
destroy(false);
|
destroy(false);
|
||||||
}
|
}
|
||||||
if (lastPackets.size() >= 60) {
|
if (lastPackets.size() >= 60) {
|
||||||
|
Loading…
Reference in New Issue
Block a user