Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Kieaer committed Sep 11, 2019
1 parent 4b432fa commit ec2619e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/java/essentials/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,14 @@ public void run() {

// Count unit destory
Events.on(EventType.UnitDestroyEvent.class, event -> {
if(playerGroup.size() > 0){
for(Player p : playerGroup.all()){
JSONObject db = getData(p.uuid);
if(playerGroup != null && playerGroup.size() > 0){
for(int i=0;i<playerGroup.size();i++){
Player player = playerGroup.all().get(i);
JSONObject db = getData(player.uuid);
int data = db.getInt("killcount");
data++;
db.put("killcount", data);
Core.settings.getDataDirectory().child("plugins/Essentials/players/"+p.uuid+".json").writeString(String.valueOf(db));
Core.settings.getDataDirectory().child("plugins/Essentials/players/"+player.uuid+".json").writeString(String.valueOf(db));
}
}
});
Expand Down

0 comments on commit ec2619e

Please sign in to comment.