Jump to content
Fuzenseth

[PI] Duping detection

Recommended Posts

[CENTER]Tired of seeing people abusing dupes in PI's since there's so many of them. I have made a very basic dupe detection to detect these guys and set them banned instant.

[B]Note:[/B]
The Configuration.java represents Config.java in regular PI

Usage:
Player X dupes ags
Player X keeps duping the ags, now he passes the duping limit
Server - detects the player, adds to the ban list, force logouts and finishes the ban.
Server - Tells in console who has been duping to inform you.

Add to anywhere (DupeDetection.java)

[CODE]package server.antimacro;

import server.Connection;
import server.configuration.Configuration;
import server.model.players.Client;
import server.model.players.PlayerHandler;
/**
* @author Fuzen Seth
* [MENTION=98951]infor[/MENTION]mation Basic duping detection.
* [MENTION=3199]Sin[/MENTION]ce 23.9.2014
* @update 1.0
*/
public class DupeDetection {

/** Possible duping items. (un-noted ids) */
public static final int[] DUPING_ITEMS = {11694,11696,11698,11700,11724,11726};

/** Item amount to ban duper.*/
public static final int MAX_DUPE_LIMIT = 100;
/** true: Checks inventory e.g 28 ags (un-noted) */
public static final boolean INVENTORY_CHECK_ENABLED = false;

/** Dupe decect instance*/
private static DupeDetection detection = new DupeDetection();

/** Scans the player's items and gives a ban.*/
public void scan(Client client) {
if (client.playerRights > 1)
return;
for (int item : DUPING_ITEMS)
if (client.getItems().getItemAmount(item) > MAX_DUPE_LIMIT ||
INVENTORY_CHECK_ENABLED && client.getItems().getItemAmount(item) > 27) {
ban(client);
client.forceLogout();
}
}

/** Bans player directly. */
public void ban(Client c) {
try {
Connection.addNameToBanList(c.playerName);
Connection.addNameToFile(c.playerName);
for (int i = 0; i < Configuration.MAX_PLAYERS; i++) {
if (PlayerHandler.players[i] != null) {
if (PlayerHandler.players[i].playerName
.equalsIgnoreCase(c.playerName)) {
PlayerHandler.players[i].disconnected = true;
System.out.println(""+c.playerName+" was banned for duping items.");
}
}
}
} catch (Exception e) {
System.out.print("Player "+c.playerName+" has logged out.");
}
}

public static DupeDetection getDetection() {
return detection;
}

}
[/CODE]

Next go to Client.java and find
[CODE]public void process() {[/CODE]

Under that add this

[CODE]DupeDetection.getDetection().scan(this);[/CODE]


Also add to Client java this force logout.
[code] /**
* Sends to the player a forced logout.
*/
public void forceLogout() {
if (this.clan != null) {
this.clan.removeMember(this);
}
outStream.createFrame(109);
setConnected(false);
if (hasNpc == true)
getSummoning().pickUpClean(this, summonId);
CycleEventHandler.getSingleton().stopEvents(this);
properLogout = true;
ConnectedFrom.addConnectedFrom(this, connectedFrom);
}
[/code]
[U]
Congrats you cannot abuse dupes anymore.[/U]


Media
[img]http://puu.sh/bKdKg/bc6fdb76e8.jpg[/img]
[img]http://puu.sh/bKezr/0dce6105ab.jpg[/img]

Console action when server auto-bans a player.
[img]http://puu.sh/bKeFB/9db6effaeb.png[/img]


[B][U]I find this system a must-have if you're hosting a PI since theres just simply too many dupes[/U][/B] and many unidentified. Also i'm pretty sure that [B]someone is going to ask does it ban staff members too? answer: No.[/B]

*Credits
*Fuzen Seth
*Format[/CENTER] Edited by FUZENSETH

Share this post


Link to post
Share on other sites
This is a little unstable in my opinion, because basically what you are doing is; If the player has that item in their inventory and it is more than 100. Then the player is getting Banned.. What if the player is just picking up an item or something, or there was a drop party etc. I'd rethink this through. But nice contribution.

This system will end up banning innocent players.

Share this post


Link to post
Share on other sites
[quote name='Format']This is a little unstable in my opinion, because basically what you are doing is; If the player has that item in their inventory and it is more than 100. Then the player is getting Banned.. What if the player is just picking up an item or something, or there was a drop party etc. I'd rethink this through. But nice contribution.

This system will end up banning innocent players.[/QUOTE]

Logs can be added too why not, player picks 100 ags from ground? This will evade your server to be competely economy destroyed.

Share this post


Link to post
Share on other sites
[quote name='Fuzen Seth']Logs can be added too why not, player picks 100 ags from ground? This will evade your server to be competely economy destroyed.[/QUOTE]

Yes, you are right. But what about the gamblers & stakers, who tend to have large amounts of items?

Also, I shortened the scan method for you;
[code]
/** Scans the player's items and gives a ban.*/
public void scan(Client client) {
if (client.playerRights > 1)
return;
for (int item : DUPING_ITEMS)
if (client.getItems().getItemAmount(item) > MAX_DUPE_LIMIT ||
INVENTORY_CHECK_ENABLED && client.getItems().getItemAmount(item) > 27) {
ban(client);
client.forceLogout();
}
}
[/code] Edited by Format

Share this post


Link to post
Share on other sites
[quote name='Format']Yes, you are right. But what about the gamblers & stakers, who tend to have large amounts of items?

Also, I shortened the scan method for you;
[code]
/** Scans the player's items and gives a ban.*/
public void scan(Client client) {
if (client.playerRights > 1)
return;
for (int item : DUPING_ITEMS)
if (client.getItems().getItemAmount(item) > MAX_DUPE_LIMIT ||
INVENTORY_CHECK_ENABLED && client.getItems().getItemAmount(item) > 27) {
ban(client);
client.forceLogout();
}
}
[/code][/QUOTE]

[code] /** Item amount to ban duper.*/
public static final int MAX_DUPE_LIMIT = 100;[/code]

There's barely any people in servers that has 100 phats, agses and so on. If there is just set the integer to be higher. Thanks though.

EDIT: Updated thread and added [MENTION=235941]Format[/MENTION] to credits for shortening the code, wrote this in a hurry so it was messy.

Share this post


Link to post
Share on other sites

×