Skip to content

Commit

Permalink
Fixed plugin disable Null error
Browse files Browse the repository at this point in the history
  • Loading branch information
Devlrxxh committed Feb 26, 2024
1 parent 1287ccc commit dac3db6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 40 deletions.
35 changes: 2 additions & 33 deletions src/main/java/me/lrxh/practice/essentials/Essentials.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;

import java.io.IOException;
Expand All @@ -33,8 +32,7 @@ public void setSpawn(Location location) {

try {
practice.getMainConfig().getConfiguration().save(practice.getMainConfig().getFile());
} catch (IOException e) {
e.printStackTrace();
} catch (IOException ignored) {
}
}

Expand All @@ -51,40 +49,11 @@ public void teleportToSpawn(Player player) {

public void clearEntities(World world) {
for (Entity entity : world.getEntities()) {
if (!(entity.getType() == EntityType.PLAYER)) {
if (entity.getType() == EntityType.PLAYER) {
continue;
}

entity.remove();
}
}

public int clearEntities(World world, EntityType... excluded) {
int removed = 0;

entityLoop:
for (Entity entity : world.getEntities()) {
if (entity instanceof Item) {
removed++;
entity.remove();
continue entityLoop;
}

for (EntityType type : excluded) {
if (entity.getType() == EntityType.PLAYER) {
continue entityLoop;
}

if (entity.getType() == type) {
continue entityLoop;
}
}

removed++;
entity.remove();
}

return removed;
}

}
8 changes: 1 addition & 7 deletions src/main/java/me/lrxh/practice/match/Match.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,7 @@ public static void cleanup() {
}
for (Player player : Bukkit.getOnlinePlayers()) {
Profile profile = Profile.getByUuid(player.getUniqueId());
new BukkitRunnable() {
@Override
public void run() {
profile.save();
System.out.println("Saved Profile: " + profile);
}
}.runTaskAsynchronously(Practice.getInstance());
profile.save();
}
}

Expand Down

0 comments on commit dac3db6

Please sign in to comment.