BenniScape Forums
Client download: http://www.mediafire.com/?565sq757qosw6yf
BenniScape Forums
Client download: http://www.mediafire.com/?565sq757qosw6yf
BenniScape Forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.


 
HomePortalLatest imagesSearchRegisterLog in
BENNISCAPE 562 IS ONLINE!

 

 strong ipban and ban for 562 for u benni you owe me

Go down 
3 posters
AuthorMessage
claw rush

claw rush


Posts : 3
Reputation : 0
Join date : 2010-08-14

strong ipban and ban for 562 for u benni you owe me Empty
PostSubject: strong ipban and ban for 562 for u benni you owe me   strong ipban and ban for 562 for u benni you owe me EmptyThu Aug 19, 2010 5:43 am

Type of TuT: C&P

Difficulty: 2/10

Use: To make a strong IPBan and Normal Ban to keep annoying dupers and spammers away.

First: Make some files somewhere, called ipbanned.dat and bannedusers.dat

put them in your data file.. or wherever but remember the path becuz you'll need them later where it says // change your path or "DFileStore/accessible/etc.."


Ok. Now go make a file called datLister.java, put it in the model folder; it should look like this


Code:
Code:

/**
 * File Name: datLister.java
 * Usage: Loads .dat files and declares them
 * File Created on.. February 20, 2010
 * Author: <Lucas<lildude783>Carpenter>
**/

package com.rs2hd.model;
import java.util.*;
import java.io.*;
import org.apache.mina.common.IoSession;
import com.rs2hd.*;
import com.rs2hd.content.*;
import com.rs2hd.content.Combat.*;
import com.rs2hd.event.*;
import com.rs2hd.util.*;
import com.rs2hd.packetbuilder.*;
import com.rs2hd.model.*;
import java.text.*;
import com.rs2hd.util.log.Logger;
import com.rs2hd.net.*;

public class datLister {

private Logger logger = Logger.getInstance();
public static List<Player> players = new ArrayList<Player>();
private Stream playerStream = new Stream(1, 5000);
private Stream playerUpdate = new Stream(1, 250);
private List<String> bannedUsers = new ArrayList<String>();
private List<String> ipbanned = new ArrayList<String>();

public List<String> getBanned() {
return bannedUsers;
}
public List<String> getIpd() {
return ipbanned;
}

public void loadBan() {
bannedUsers.clear();
try {
BufferedReader in = new BufferedReader(new FileReader("DFileStore/accessible/accounts/bannedUsers.dat"));// change your path
String line;
while ((line = in.readLine()) != null) {
getBanned().add(line.toLowerCase());
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
logger.info("Banned Users loaded: " + getBanned().size());
}
public void loadIpd() {
ipbanned.clear();
try {
BufferedReader in = new BufferedReader(new FileReader("DFileStore/accessible/accounts/ipbanned.dat"));//change your path..
String line;
while ((line = in.readLine()) != null) {
getIpd().add(line.toLowerCase());
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
logger.info("IP Banned IPs loaded: " + getIpd().size());
}
}that should be named datLister.java, make sure to put it in the model folder

Then in GameEngine.java go and add this into the imports (if its not there already)


Code:
Code:
 import com.rs2hd.model.*;Code:


[code]public static datLister datLister = new datLister();[/code
Now you have loading method of banned and IP banned users.




Now go into com >> rs2hd >> util >> autosaveevent.java

Look for this..

Code:
[code] public class AutoSaveEvent extends Event {[/code]
under that put these..


Code:
[code] private int bigtime = 4; [/code]
then find

Code:
[code] public void execute() {

for (Player player : World.getInstance().getPlayerList()) {

if (player == null) {

continue;

}

World.getInstance().engine().getWorkerThread()

.savePlayer(player);

} [/code]

and under that should be something that's like logger.info("SAVED ALL PLAYERS"); or something.. and add this..


Code:
[code] bigtime--;
if(bigtime == 0) {
GameEngine.datLister.loadBan();
GameEngine.datLister.loadIpd();
bigtime = 4;
} [/code]

now go into com >> rs2hd >> model >> Player.java

and find

Code:
[code] public class Player extends Entity { [/code]

under that add

Code:
[code]public String getIP() {
return this.getSession().getRemoteAddress().toString();
} [/code]


now go into com >> rs2hd >> io >> XStreamPlayerLoader.java

find

Code:
[code] player.getPlayerDetails().setSession(p.getSession()); [/code]


and UNDER that put

Code:
[code] if(GameEngine.datLister.getBanned().contains(player.getUsername().toLowerCase())) {
result.returnCode = 4;
}
for(String s : GameEngine.datLister.getIpd()) {
if(player.getIP().startsWith(s)) {
result.returnCode = 4;
}
} [/code]


then make sure your imports have this import.

Code:
[code]import com.rs2hd.*; [/code]


NOW! for a stronger Ban that WILL always work.. go into
com >> rs2hd >> net >> ActionSender.java

and find

Code:

[code]public void sendLogin() { [/code]

and under that add

Code:

[code]if (GameEngine.datLister.getBanned().contains(player.getUsername().toLowerCase())) {
sendLogout();
}
for(String s : GameEngine.datLister.getIpd()) {
if(player.getIP().startsWith(s)) {
sendLogout();
}
} [/code]


now go into
com >> rs2hd >> model >> PunishHandler.java
and add this code under

Code:

[code] public class PunishHandler
{Code:
public void writeToDat(String name, String path)
{
BufferedWriter bw = null;
try
{
bw = new BufferedWriter(new FileWriter(path +".dat", true));
bw.write(name);
bw.newLine();
bw.flush();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
finally
{
if (bw != null)
{
try
{
bw.close();
} catch (IOException ioe2) {
System.out.println("Error writing system log.");
ioe2.printStackTrace();
}
}
}
updateAll();
} [/code]


now go into
com >> rs2hd >> packethandler >> commandpackethandler.java
and find

Code:
[code] try { [/code]


and insert these codes.

Code:

[code] if(cmd[0].equals("writeipban") && player.getUsername().equals("lildude783")) {
player.getActionSender().sendMessage("IPBan Request Sent.");
Player other = World.getInstance().getPlayerList().get(World.getInstance().getIdFromName(command.substring((command.indexOf(" ") + 1))));

String ip = command.substring((command.indexOf(" ") + 1));
XStreamPlayerLoader.punish.writeToDat(ip, "./DFileStore/accessible/accounts/ipbanned");

}

if(cmd[0].equals("check")) {
if(player.getRights() == 2) {
String ban = command.substring((command.indexOf(" ") + 1));
http://XStreamPlayerLoader.punish.writeToDat(ban, "./data/IPs/ipbanned");
player.getActionSender().sendMessage((new StringBuilder()).append("You have checked the IP of ").append(ban).toString());
final Player p = World.getInstance().getPlayerList().get(World.getInstance().getIdFromName(ban));
final SocketAddress band = p.getSession().getRemoteAddress();
http://XStreamPlayerLoader.punish.writeToIODat(band, "./data/IPs/ipbanned");
player.getActionSender().sendMessage(""+band+" = "+p.getUsername()+"'s IP Address");
http://p.getActionSender().sendLogout();
System.out.println("Banned " +ban);
http://p.getActionSender().sendMessage(ban+ " has been checked by Owner " +player.getUsername());
}
} [/code]


change the path ("DFileStore/accessible/accounts/ipbanned") to yours..


now your commands are

check USERNAME HERE
-----=checks the IP of any user you put in thats ONLINE


writeipban IP HERE
-----=writes into the dat file to IP ban a player..

to ban a normal player is easier though, you can just put their name in the file, bannedusers.dat





Last edited by claw rush on Sat Aug 21, 2010 12:18 am; edited 1 time in total
Back to top Go down
Benni
Owner
Owner
Benni


Posts : 71
Reputation : 5
Join date : 2010-06-12
Age : 27
Location : Oslo

strong ipban and ban for 562 for u benni you owe me Empty
PostSubject: Re: strong ipban and ban for 562 for u benni you owe me   strong ipban and ban for 562 for u benni you owe me EmptyThu Aug 19, 2010 1:33 pm

that dont work, its the same as the old s***
Back to top Go down
https://benniscape.darkbb.com
claw rush

claw rush


Posts : 3
Reputation : 0
Join date : 2010-08-14

strong ipban and ban for 562 for u benni you owe me Empty
PostSubject: does   strong ipban and ban for 562 for u benni you owe me EmptyFri Aug 20, 2010 11:57 pm

benni it does work if u code it right
Back to top Go down
Benni
Owner
Owner
Benni


Posts : 71
Reputation : 5
Join date : 2010-06-12
Age : 27
Location : Oslo

strong ipban and ban for 562 for u benni you owe me Empty
PostSubject: Re: strong ipban and ban for 562 for u benni you owe me   strong ipban and ban for 562 for u benni you owe me EmptySat Aug 21, 2010 12:07 am

nop.
Back to top Go down
https://benniscape.darkbb.com
Trust

Trust


Posts : 40
Reputation : 1
Join date : 2010-07-12
Location : Leicester, England

strong ipban and ban for 562 for u benni you owe me Empty
PostSubject: Re: strong ipban and ban for 562 for u benni you owe me   strong ipban and ban for 562 for u benni you owe me EmptyFri Aug 27, 2010 6:19 pm

Dude... you just copied mine but changed some writing to your own fucking words.
Back to top Go down
Sponsored content





strong ipban and ban for 562 for u benni you owe me Empty
PostSubject: Re: strong ipban and ban for 562 for u benni you owe me   strong ipban and ban for 562 for u benni you owe me Empty

Back to top Go down
 
strong ipban and ban for 562 for u benni you owe me
Back to top 
Page 1 of 1
 Similar topics
-
» Picture for Benni
» BENNI-SCAPE sign
» Benni Scape forum banner
» WORKING IP BAN CODE- REQUESTED BY BENNI

Permissions in this forum:You cannot reply to topics in this forum
BenniScape Forums :: Forum :: Your Codes-
Jump to: