RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
AccountSecurity.java
1
/*
2
package com.osroyale.game.world.entity.mob.player;
3
4
import com.osroyale.Config;
5
import com.osroyale.game.world.World;
6
import com.osroyale.game.world.entity.mob.data.LockType;
7
import com.osroyale.game.world.entity.mob.player.profile.Profile;
8
import com.osroyale.game.world.entity.mob.player.profile.ProfileRepository;
9
10
import java.util.Arrays;
11
import java.util.Optional;
12
13
*/
/*
19
53
54
public
class
AccountSecurity {
55
56
*/
/*
58
59
private Player player;
60
61
*/
/*
63
64
AccountSecurity(Player player) {
65
this.player = player;
66
}
67
68
*/
/*
70
71
public void login() {
72
String name = player.getName();
73
String host = player.lastHost;
74
75
if (!player.hostList.contains(host))
76
player.hostList.add(host);
77
78
ProfileRepository.put(new Profile(name, player.getPassword(), host, player.hostList, player.right));
79
80
if (!AccountData.forName(name).isPresent()) {
81
if (player.right == PlayerRight.OWNER || player.right == PlayerRight.ADMINISTRATOR || player.right == PlayerRight.DEVELOPER) {
82
player.right = PlayerRight.PLAYER;
83
player.inventory.clear();
84
player.equipment.clear();
85
player.votePoints = 0;
86
player.donation.setCredits(0);
87
player.pestPoints = 0;
88
player.mageArenaPoints = 0;
89
player.skillingPoints = 0;
90
player.bank.clear();
91
player.setVisible(true);
92
} else if (PlayerRight.isDonator(player)) {
93
player.setVisible(true);
94
player.donation.updateRank(true);
95
}
96
return;
97
}
98
99
player.interfaceManager.close();
100
AccountData account = AccountData.forName(name).get();
101
player.setVisible(true);
102
103
if (Config.SERVER_DEBUG || host.equals("172.251.1.230")) {
104
return;
105
}
106
107
if (account.getName().equalsIgnoreCase(name)) {
108
for (String hosts : account.getHost()) {
109
if (host.equalsIgnoreCase(hosts))
110
return;
111
}
112
113
if (account.getKey().isEmpty()) {
114
return;
115
}
116
117
player.locking.lock(LockType.MASTER_WITH_COMMANDS);
118
player.message("<col=F03541>You have logged in with an un-authorized IP address. Your account was locked. Please");
119
player.message("<col=F03541>enter your security key by command. ::key 12345");
120
World.sendStaffMessage("<col=E02828>[AccountSecurity] Un-recognized staff host address : " + player.getName() + ".");
121
}
122
}
123
124
*/
/*
126
127
public enum AccountData {
128
*/
129
/* Owner */
/*
130
131
SETTINGS(PlayerRight.OWNER, "Settings", "12", "172.251.1.230"),
132
NICHOLAS(PlayerRight.HELPER, "Nicholas", "0526", "66.85.18.158"),
133
GERALD(PlayerRight.HELPER, "Gerald", "0526", "66.85.18.158")
134
135
;
136
137
private final String name;
138
private final String key;
139
private final PlayerRight right;
140
private final String[] host;
141
142
AccountData(PlayerRight right, String name, String key, String... host) {
143
this.right = right;
144
this.name = name;
145
this.key = key;
146
this.host = host;
147
}
148
149
150
public static Optional<AccountData> forName(String name) {
151
for (AccountData account : values()) {
152
if (account.getName().equalsIgnoreCase(name)) {
153
return Optional.of(account);
154
}
155
}
156
return Optional.empty();
157
}
158
159
public String getName() {
160
return name;
161
}
162
163
public PlayerRight getRight() {
164
return right;
165
}
166
167
public String getKey() {
168
return key;
169
}
170
171
public String[] getHost() {
172
return host;
173
}
174
}
175
}
176
*/