So I have someone who was fucking w/ me on my 718 and booting players, so I made this to keep him away, and it seems to be working! (I am not that great at coding, and I just learned Arrays so... Please don't flame.)
CLIENT SIDED
----------------------------------------------------------
Class460.java under
Code:
Class10.method322(stream, (byte) 1);
---------------------
Code:
//MAC adress
InetAddress inet;
inet = InetAddress.getLocalHost();
NetworkInterface network = NetworkInterface
.getByInetAddress(inet);
int mac = ByteBuffer.wrap(network.getHardwareAddress())
.getInt();
stream.writeString(String.valueOf(mac), -1);
---------------------------------------------------------
SERVER SIDED
--------------------------------------------------------
In LoginPacketsDecoder.java
search for
Code:
public void decodeWorldLogin(InputStream stream) {
and then and below it add
Code:
MACAdress = stream.readString();
------------------------
In LoginPacketsDecoder.java
search for "banned" and below that if statement add
Code:
if(MacBanL.isMACBanned()) {
return;
}
and then search for "player.init"
and above it add
Code:
player.setMacAdress(MACAdress);
----------------------
Make a new Class called MacBanL.java
Code:
package com.rs.utils;
import java.io.File;
import java.util.concurrent.CopyOnWriteArrayList;
import com.rs.game.player.Player;
public final class MacBanL {
public static CopyOnWriteArrayList<String> macList;
private static final String PATH = "data/bannedMACIPS.ser";
private static boolean edited;
@SuppressWarnings("unchecked")
public static void init() {
File file = new File(PATH);
if (file.exists())
try {
macList = (CopyOnWriteArrayList<String>) SerializableFilesManager.loadSerializedFile(file);
return;
} catch (Throwable e) {
Logger.handle(e);
}
macList = new CopyOnWriteArrayList<String>();
}
public static final void save() {
if (!edited)
return;
try {
SerializableFilesManager.storeSerializableClass(macList, new File(PATH));
edited = false;
} catch (Throwable e) {
Logger.handle(e);
}
}
public static boolean isMacBanned(Player player) {
return macList.contains(player.getMACAdress());
}
public static void ban(Player player, boolean loggedIn) {
player.setPermBanned(true);
if (loggedIn) {
macList.add(player.getMACAdress());
player.getSession().getChannel().disconnect();
} else {
macList.add(player.getMACAdress());
SerializableFilesManager.savePlayer(player);
}
edited = true;
}
public static void unban(Player player) {
macList.remove(player.getMACAdress());
edited = true;
save();
}
public static void checkCurrent() {
for (String list : macList) {
System.out.println(list);
}
}
public static CopyOnWriteArrayList<String> getList() {
return macList;
}
}
----------------------
Where your main starting method is add
----------------------
In Player.java
Code:
public String MACAdress;
public String getMACAdress() {
return MACAdress;
}
public void setMacAdress(String macAdress) {
if(macAdress != null) {
this.MACAdress = macAdress;
}
}
-----------------------
in where-ever your commands are
Code:
if (cmd[0].equals("macban")) {
name = "";
for (int i = 1; i < cmd.length; i++)
name += cmd[i] + ((i == cmd.length - 1) ? "" : " ");
target = World.findPlayer(name);
if (target.isOwner()) {
return true;
}
loggedIn = World.isOnline(name);
MacBanL.ban(target, loggedIn);
player.getPackets().sendGameMessage("You've permanently mac banned " + (loggedIn ? target.getDisplayName() : name) + ".");
return true;
}
Feel free to give constructive criticism, Leave a Thanks if I helped you or you used this
Credits to Hellman2741 for the process of receiving the address...................
Creds to Taylor Moon for releasing the class460 to rip out the MACAdress shit
EDIT: REDID THE HANDLING