mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-02 16:49:03 +00:00
Fixup, Add new command (#226)
* refactor saving * add command to change password * cleanup
This commit is contained in:
@@ -65,11 +65,8 @@ public class PlayerSave {
|
||||
if (!doRealLogin)
|
||||
break;
|
||||
if (token.equals("character-password")) {
|
||||
if (playerPass.equalsIgnoreCase(token2)) {
|
||||
// Hash their password and store it!
|
||||
playerPass = passwordHash(token2);
|
||||
} else if (passwordHash(playerPass).equalsIgnoreCase(token2)) {
|
||||
playerPass = token2; //Valid password
|
||||
if (playerPass.equalsIgnoreCase(token2) || passwordHash(playerPass).equalsIgnoreCase(token2)) {
|
||||
player.playerPass = token2; //Valid password
|
||||
} else {
|
||||
System.out.println("hash doesn't match: " + passwordHash(playerPass).toLowerCase());
|
||||
System.out.println("currently is: " + passwordHash(token2).toLowerCase());
|
||||
@@ -487,7 +484,7 @@ public class PlayerSave {
|
||||
return 14;
|
||||
}
|
||||
|
||||
private static String passwordHash(String token2) {
|
||||
public static String passwordHash(String token2) {
|
||||
String hashed = "HAS HAS FAILED!";
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance("MD5");
|
||||
@@ -535,13 +532,11 @@ public class PlayerSave {
|
||||
characterfile.newLine();
|
||||
characterfile.write("character-username = " + player.playerName);
|
||||
characterfile.newLine();
|
||||
if (player.playerRights == 0) {
|
||||
if (player.playerPass.length() < 40) {
|
||||
player.playerPass = passwordHash(player.playerPass);
|
||||
}
|
||||
characterfile.write("character-password = " + player.playerPass);
|
||||
characterfile.newLine();
|
||||
if (player.playerPass.length() < 40) {
|
||||
player.playerPass = passwordHash(player.playerPass);
|
||||
}
|
||||
characterfile.write("character-password = " + player.playerPass);
|
||||
characterfile.newLine();
|
||||
characterfile.newLine();
|
||||
|
||||
/* CHARACTER */
|
||||
|
||||
@@ -10,13 +10,11 @@ import com.rebotted.game.players.Player;
|
||||
public class AntiSpam {
|
||||
|
||||
private final static String[] BLOCKED_WORDS = {
|
||||
"(dot)", ".com", "tk", ".org", ".net", ".info", ".cam", ".c0m", ". net", "(,)com",
|
||||
".inf0", ".0rg", "(.)", ".biz", ".co.uk", ". com", ". info", ". c0m", ",com",
|
||||
". biz", ". tk", ". 0rg", ". cam", ". inf0", "c'om", "c'0m", ". org", "dupe",
|
||||
"http", "no-ip", "tradereq", "duelreq", "www", "vww", "c' om", "c' 0m", "w-w-w",
|
||||
"w'ww", "w'w'w", "w 'ww", "w' w' w", "ww' w", "wvv", "ww", "wwv", "vvv", "vwv",
|
||||
"w)w)w", "?com", "/com", "'com", "(com)", "(w)(w)(w)", "bot", "sythe", "abusewith.us",
|
||||
"osrs", "2007rs", "runerebels", "06prime", "2006prime", "arios498", "ariosrsps", "coom"
|
||||
"(dot)", ".com", "tk", ".org", ".net", ".info", ".cam", ".c0m", ". net", "(,)com", ".inf0", ".0rg", "(.)",
|
||||
".biz", ".co.uk", ". com", ". info", ". c0m", ",com", ". biz", ". tk", ". 0rg", ". cam", ". inf0", "c'om",
|
||||
"c'0m", ". org", "http", "no-ip", "tradereq", "duelreq", "www", "vww", "c' om", "c' 0m", "w-w-w", "w'ww",
|
||||
"w'w'w", "w 'ww", "w' w' w", "ww' w", "wvv", "wwv", "vvv", "vwv", "w)w)w", "?com", "/com", "'com", "(com)",
|
||||
"(w)(w)(w)", "sythe", "abusewith.us", "runerebels", "06prime", "2006prime", "arios498", "ariosrsps", "coom"
|
||||
};
|
||||
|
||||
public static boolean blockedWords(Player player, String word, boolean chat) {
|
||||
|
||||
@@ -77,7 +77,22 @@ public class Commands implements PacketType {
|
||||
case "coords":
|
||||
case "coord":
|
||||
case "pos":
|
||||
player.getPacketSender().sendMessage("Your coords are [" + player.absX + "," + player.absY + "]");
|
||||
player.getPacketSender().sendMessage("Your coords are [" + player.absX + ", " + player.absY + ", " + player.heightLevel + "]");
|
||||
break;
|
||||
case "password":
|
||||
case "pwd":
|
||||
if (arguments.length < 2) {
|
||||
player.getPacketSender().sendMessage("Must have 2 arguments: ::password oldpassword newpassword");
|
||||
return;
|
||||
} else if (!PlayerSave.passwordHash(arguments[0]).equalsIgnoreCase(player.playerPass) || arguments[0].equalsIgnoreCase(player.playerPass)) {
|
||||
player.getPacketSender().sendMessage("Your old password is incorrect");
|
||||
return;
|
||||
} else {
|
||||
player.getPacketSender().sendMessage("Password updated!");
|
||||
player.playerPass = arguments[1];
|
||||
player.disconnected = true;
|
||||
player.logout(true);
|
||||
}
|
||||
break;
|
||||
case "null":
|
||||
break;
|
||||
|
||||
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user