Jump to content
Existing user? Sign In

Sign In



Sign Up

[RUSE] Autoban by points.


Sanity

Recommended Posts

Pretty simple if you have a player and cant keep track of appeals/warnings.

Let's start off in PointsHandler:


/*
 * Warning Points
 */
private int warningPoints;

	public void setwarningPoints(int points, boolean add) {
		if(add)
			this.warningPoints += points;
		else
			this.warningPoints = points;
	}
	public int getWarningPoints() {
		return this.warningPoints;
	}
	public void incrementWarningPoints() {
		this.warningPoints++;
	}
	public void incrementWarningPoints(int amt) {
		this.warningPoints += amt;
	}
	public void setWarningPoints(int warningPoints) {
		this.warningPoints = warningPoints;
	}

Now we if they have more than 0 warning points they will get a notification on login.

PlayerHandler: (Under get minutes bonus XP method)

        if(player.getPointsHandler().getWarningPoints() == 10) {
        	World.deregister(player);
        	String p = player.getUsername().toLowerCase();
        	PlayerPunishment.autoban(p);
        }
        if (player.getPointsHandler().getWarningPoints() != 0) {
        player.getPA().sendMessage("@red@[AUTO-BAN] If you reach 10 Warning Points you will be Auto Banned.");
        player.getPA().sendMessage("@red@[AUTO-BAN] You currently have "+player.getPointsHandler().getWarningPoints()+" Warning Points.");
        }

Next we head to playerpunishment.

	public static void autoban(String player) {
		player = Misc.formatPlayerName(player.toLowerCase());
		if(!AccountsBanned.contains(player)) {
			addToFile(""+BAN_DIRECTORY+"Bans.txt", player);
			AccountsBanned.add(player);
		}
	}

Finally the command: (CommandPacketListener)

	if(command[0].contains("warn")) {
		String plr = wholeCommand.substring(5);
		Player playr2 = World.getPlayerByName(plr);
		if(playr2 != null) {
			playr2.getPointsHandler().setwarningPoints(1, true);
			playr2.getPA().sendMessage("@red@You have received 1 warning point!");
			playr2.getPointsHandler().refreshPanel();
			} else
			player.getPacketSender().sendMessage("Could not find player: "+plr);
	}

I left a bracket out, if you can't figure it out you probably shouldn't be reading this.

Link to comment
Share on other sites

  • 1 year later...
  • 2 weeks later...
  • 4 months later...
  • 5 months later...
  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Contact

[email protected]

astra.security

What is a RSPS?

A RSPS, also known as RuneScape private server, is an online game based on RuneScape, and controlled by independent individuals.

Popular RSPS Servers

Runewild Ikov RedemptionRSPS

Disclaimer

Runesuite is not affiliated with runescape, jagex in any way & exists solely for educational purposes.

×
×
  • Create New...