Rename legacy PowerGrant to PowerGrantedTrains
Ends the name clash with the parser's engine.parsers.objects.PowerGrant. It no longer extends AbstractGameObject: it was never cached or sent as a game object, and the renamed class has no GameObjectType entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fae15889f7
commit
3c57a8bb0e
2 files changed
+14
-19
No files matched your search
@@ -334,7 +334,7 @@ public class CharacterPower extends AbstractGameObject {
|
||||
// return pc.getBonuses().getByte("gt." + this.power.getToken());
|
||||
// } else
|
||||
// return pc.getBonuses().getByte("gt." + this.power.getToken());
|
||||
return PowerGrant.getGrantedTrains(this.power.getToken(), pc);
|
||||
return PowerGrantedTrains.getGrantedTrains(this.power.getToken(), pc);
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -21,17 +21,16 @@ import java.util.ArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
public class PowerGrant extends AbstractGameObject {
|
||||
public class PowerGrantedTrains {
|
||||
|
||||
private static ConcurrentHashMap<Integer, PowerGrant> grantedPowers = null;
|
||||
private static ConcurrentHashMap<Integer, PowerGrantedTrains> grantedPowers = null;
|
||||
private int token;
|
||||
private ConcurrentHashMap<Integer, Short> runeGrants = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
public PowerGrant(ResultSet rs) throws SQLException {
|
||||
super();
|
||||
public PowerGrantedTrains(ResultSet rs) throws SQLException {
|
||||
this.token = rs.getInt("powerToken");
|
||||
runeGrants.put(rs.getInt("runeID"), rs.getShort("grantAmount"));
|
||||
}
|
||||
@@ -44,11 +43,11 @@ public class PowerGrant extends AbstractGameObject {
|
||||
if (pc == null)
|
||||
return (short) 0;
|
||||
|
||||
if (PowerGrant.grantedPowers == null)
|
||||
if (PowerGrantedTrains.grantedPowers == null)
|
||||
fillGrantedPowers();
|
||||
|
||||
if (PowerGrant.grantedPowers.containsKey(token)) {
|
||||
PowerGrant pg = PowerGrant.grantedPowers.get(token);
|
||||
if (PowerGrantedTrains.grantedPowers.containsKey(token)) {
|
||||
PowerGrantedTrains pg = PowerGrantedTrains.grantedPowers.get(token);
|
||||
ConcurrentHashMap<Integer, Short> runeGrants = pg.runeGrants;
|
||||
ArrayList<Integer> toks = new ArrayList<>();
|
||||
|
||||
@@ -90,7 +89,7 @@ public class PowerGrant extends AbstractGameObject {
|
||||
|
||||
public static void fillGrantedPowers() {
|
||||
|
||||
PowerGrant.grantedPowers = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
PowerGrantedTrains.grantedPowers = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_powergrant")) {
|
||||
@@ -98,7 +97,7 @@ public class PowerGrant extends AbstractGameObject {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
if (PowerGrant.grantedPowers.size() > 0) {
|
||||
if (PowerGrantedTrains.grantedPowers.size() > 0) {
|
||||
rs.close();
|
||||
return;
|
||||
}
|
||||
@@ -107,14 +106,14 @@ public class PowerGrant extends AbstractGameObject {
|
||||
|
||||
int token = rs.getInt("powerToken");
|
||||
|
||||
PowerGrant pg;
|
||||
PowerGrantedTrains pg;
|
||||
|
||||
if (PowerGrant.grantedPowers.containsKey(token)) {
|
||||
pg = PowerGrant.grantedPowers.get(token);
|
||||
if (PowerGrantedTrains.grantedPowers.containsKey(token)) {
|
||||
pg = PowerGrantedTrains.grantedPowers.get(token);
|
||||
pg.addRuneGrant(rs.getInt("runeID"), rs.getShort("grantAmount"));
|
||||
} else {
|
||||
pg = new PowerGrant(rs);
|
||||
PowerGrant.grantedPowers.put(token, pg);
|
||||
pg = new PowerGrantedTrains(rs);
|
||||
PowerGrantedTrains.grantedPowers.put(token, pg);
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
@@ -134,8 +133,4 @@ public class PowerGrant extends AbstractGameObject {
|
||||
private void addRuneGrant(int runeID, short amount) {
|
||||
this.runeGrants.put(runeID, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDatabase() {
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user