Alright. I glanced over your PeaceKeeper, GPlayer, OfflineGPlayer, and PlayerHandler classes.
They were hard to read, but that's okay. It was very good code, other than some minor issues that I'm going to address below:
- The == compares the address of the objects, which means if they are not the same object, it would be false. To compare strings, which might have the same value but still be different objects, use the .equals() method on the string, like for this line:
_attackedGuild == PlayerHandler.getPlayer(e.getDamager().getName()).getGuild())_
- Efficiency. On some lines, you're reading the file twice for the same value.
_guildMembers = Main.guilds.getList(nick) == null ? new ArrayList() : (List) Main.guilds.getList(nick);_
Put _Main.guilds.getList(nick)_ into a variable, so you only have to read the file once for it.
- Save the file, after you make changes to it.
_try {
guilds.save(guildsFile);
} catch(IOException e) {
e.printStackTrace();
}_
Alright. I glanced over your PeaceKeeper, GPlayer, OfflineGPlayer, and PlayerHandler classes.
They were hard to read, but that's okay. It was very good code, other than some minor issues that I'm going to address below:
_attackedGuild == PlayerHandler.getPlayer(e.getDamager().getName()).getGuild())_
_guildMembers = Main.guilds.getList(nick) == null ? new ArrayList() : (List) Main.guilds.getList(nick);_
Put _Main.guilds.getList(nick)_ into a variable, so you only have to read the file once for it.
_try {
guilds.save(guildsFile);
} catch(IOException e) {
e.printStackTrace();
}_