diff --git a/varo/src/main/java/de/cliffbreak/varo/database/Database.java b/varo/src/main/java/de/cliffbreak/varo/database/Database.java index f4d1221..82affec 100644 --- a/varo/src/main/java/de/cliffbreak/varo/database/Database.java +++ b/varo/src/main/java/de/cliffbreak/varo/database/Database.java @@ -20,7 +20,7 @@ public class Database { } private void init() throws SQLException { - final Statement s = conn.createStatement(); + final Statement s = this.conn.createStatement(); s.executeUpdate( "CREATE TABLE IF NOT EXISTS kills (`player` VARCHAR(32) NOT NULL, `victim` VARCHAR(32) NOT NULL);"); s.executeUpdate( @@ -38,7 +38,7 @@ public class Database { public void addKill(final String uuid, final String victimUuid) { try { - final Statement s = conn.createStatement(); + final Statement s = this.conn.createStatement(); s.executeUpdate("INSERT INTO kills (`player`, `victim`) VALUES ('" + uuid + "', '" + victimUuid + "');"); s.close(); } catch (final SQLException e) { @@ -48,7 +48,7 @@ public class Database { public int getKills(final String uuid) { try { - final Statement s = conn.createStatement(); + final Statement s = this.conn.createStatement(); final ResultSet rs = s.executeQuery("SELECT COUNT(`victim`) FROM kills WHERE `player` ='" + uuid + "';"); final int kills = rs.getInt("COUNT(`victim`)"); s.close(); @@ -61,7 +61,7 @@ public class Database { public void updatePlayerCache(final String uuid, final String type, final Object value) { try { - final Statement s = conn.createStatement(); + final Statement s = this.conn.createStatement(); if (s.executeUpdate( "UPDATE playercache SET `" + type + "`='" + value + "' WHERE `player`='" + uuid + "';") == 0) { s.executeUpdate( @@ -75,7 +75,7 @@ public class Database { public Object getPlayerCache(final String uuid, final String type) { try { - final Statement s = conn.createStatement(); + final Statement s = this.conn.createStatement(); final ResultSet rs = s.executeQuery("SELECT " + type + " FROM playercache WHERE `player` ='" + uuid + "';"); final Object obj = rs.getObject(type); s.close(); diff --git a/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerJoinQuitListener.java b/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerJoinQuitListener.java index d506140..98e4838 100644 --- a/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerJoinQuitListener.java +++ b/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerJoinQuitListener.java @@ -68,12 +68,12 @@ public class PlayerJoinQuitListener implements Listener { e.getPlayer().setResourcePack("http://cdn.cliffbreak.de/varo.zip", "73046237cc843964dbe32fb9c76c0144cdbf90af"); } - }.runTaskLater(plugin, 5); // wait 5 ticks + }.runTaskLater(this.plugin, 5); // wait 5 ticks // Login cooldown + Animation final Player p = e.getPlayer(); World w = null; - for (World world : Bukkit.getWorlds()) { + for (final World world : Bukkit.getWorlds()) { if (world.getEnvironment().equals(Environment.THE_END)) { w = world; } @@ -89,7 +89,7 @@ public class PlayerJoinQuitListener implements Listener { final BukkitTask hidePlayersTask = new BukkitRunnable() { @Override public void run() { - for (Player player : Bukkit.getOnlinePlayers()) + for (final Player player : Bukkit.getOnlinePlayers()) p.hidePlayer(plugin, player); } }.runTaskTimer(this.plugin, 0l, 1l); @@ -103,7 +103,7 @@ public class PlayerJoinQuitListener implements Listener { p.setFlying(false); p.teleport(plugin.getPlayerCache().getPlayerLocationCache(p.getUniqueId().toString().replace("-", ""))); hidePlayersTask.cancel(); - for (Player player : Bukkit.getOnlinePlayers()) + for (final Player player : Bukkit.getOnlinePlayers()) p.showPlayer(plugin, player); } }.runTaskLater(this.plugin, 10 * 20); @@ -122,13 +122,13 @@ public class PlayerJoinQuitListener implements Listener { e.setHidePlayers(true); try { - Instant instant = Instant.ofEpochMilli(this.plugin.getConfig().getLong("Varo.Start")); - LocalDateTime start = instant.atZone(ZoneId.systemDefault()).toLocalDateTime(); + final Instant instant = Instant.ofEpochMilli(this.plugin.getConfig().getLong("Varo.Start")); + final LocalDateTime start = instant.atZone(ZoneId.systemDefault()).toLocalDateTime(); final LocalDateTime current = LocalDateTime.now(); e.setMotd("§9§l" + "VARO" + "§b§l " + "Tag: " + (Duration.between(start, current).toDays() + 1) + "\n§r§7" + "powered by " + "§4" + "Cliffbreak.de"); - } catch (Exception ex) { + } catch (final Exception ex) { ex.printStackTrace(); e.setMotd("§9§l" + "VARO" + "§b§l " + "Tag: -1" + "\n§r§7" + "powered by " + "§4" + "Cliffbreak.de"); } diff --git a/varo/src/main/java/de/cliffbreak/varo/uitls/PlayerCache.java b/varo/src/main/java/de/cliffbreak/varo/uitls/PlayerCache.java index f0fe1b9..bec116b 100644 --- a/varo/src/main/java/de/cliffbreak/varo/uitls/PlayerCache.java +++ b/varo/src/main/java/de/cliffbreak/varo/uitls/PlayerCache.java @@ -32,7 +32,7 @@ public class PlayerCache { public Location getPlayerLocationCache(final String uuid) { if ((String) this.plugin.getDatabase().getPlayerCache(uuid, PlayerCacheType.WORLD.toString().toLowerCase()) == null) { - for (World world : Bukkit.getWorlds()) { + for (final World world : Bukkit.getWorlds()) { if (world.getEnvironment().equals(Environment.NORMAL)) return world.getSpawnLocation(); }