9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2025-12-27 18:59:10 +00:00

Code cleanup

This commit is contained in:
SamB440
2021-03-31 12:47:20 +01:00
parent 5a81311476
commit 5118fdd5af
5 changed files with 11 additions and 13 deletions

View File

@@ -318,11 +318,11 @@ public class ConfiguredRegion {
try {
File file = this.findFile(plugin);
if (file == null) file = new File(plugin.getDataFolder() + "/regions/" + this.id + ".json");
Writer writer = new FileWriter(file);
Gson gson = plugin.getGson();
gson.toJson(this, writer);
writer.flush();
writer.close();
try (Writer writer = new FileWriter(file)) {
Gson gson = plugin.getGson();
gson.toJson(this, writer);
writer.flush();
}
} catch (IOException e) {
e.printStackTrace();
}

View File

@@ -10,6 +10,7 @@ public enum PreventType {
PUSH;
public void prevent(PlayerMoveEvent event) {
if (event.getTo() == null) return;
Player player = event.getPlayer();
switch (this) {
case TELEPORT: