/* */ @EventHandler(priority = EventPriority.HIGHEST) /* */ public void onBlockPlace(BlockPlaceEvent event) { /* 27 */ Player p = event.getPlayer(); /* 28 */ int id = GameManager.getInstance().getPlayerGameId(p); /* */ /* 30 */ if (id == -1) { /* 31 */ int gameblockid = GameManager.getInstance().getBlockGameId(event.getBlock().getLocation()); /* 32 */ if ((gameblockid != -1) && /* 33 */ (GameManager.getInstance().getGame(gameblockid).getGameMode() != Game.GameMode.DISABLED)) { /* 34 */ event.setCancelled(true); /* */ } /* */ /* 37 */ return; /* */ } /* */ /* 41 */ Game g = GameManager.getInstance().getGame(id); /* 42 */ if (g.isPlayerinactive(p)) { /* 43 */ return; /* */ } /* 45 */ if (g.getMode() == Game.GameMode.DISABLED) { /* 46 */ return; /* */ } /* 48 */ if (g.getMode() != Game.GameMode.INGAME) { /* 49 */ event.setCancelled(true); /* 50 */ return; /* */ } /* */ /* 54 */ if (!this.allowedPlace.contains(Integer.valueOf(event.getBlock().getTypeId()))) /* 55 */ event.setCancelled(true); /* */ }
/* */ public void saveGame(int arenaid, Player winner, int players, long time) /* */ { /* 134 */ if (!this.enabled) return; /* 135 */ int gameno = 0; /* 136 */ Game g = GameManager.getInstance().getGame(arenaid); /* */ try /* */ { /* 139 */ g.setRBStatus("Geting no"); /* 140 */ long time1 = new Date().getTime(); /* 141 */ PreparedStatement s2 = this.dbman.createStatement( "SELECT * FROM " + SettingsManager.getSqlPrefix() + /* 142 */ "gamestats ORDER BY gameno DESC LIMIT 1"); /* 143 */ ResultSet rs = s2.executeQuery(); /* 144 */ rs.next(); /* 145 */ gameno = rs.getInt(1) + 1; /* 146 */ g.setRBStatus("Got no"); /* */ /* 148 */ if (time1 + 5000L < new Date().getTime()) System.out.println( "Your database took a long time to respond. Check the connection between the server and database"); /* */ } /* */ catch (SQLException e) /* */ { /* 151 */ e.printStackTrace(); /* 152 */ g.setRBStatus("Error: getno"); /* */ } /* 154 */ g.setRBStatus("save GS"); /* */ /* 156 */ addSQL( "INSERT INTO " + SettingsManager.getSqlPrefix() + "gamestats VALUES(NULL," + arenaid + "," + players + ",'" + winner.getName() + "'," + time + ")"); /* */ /* 158 */ g.setRBStatus("save PS"); /* */ /* 160 */ for (PlayerStatsSession s : ((HashMap) this.arenas.get(Integer.valueOf(arenaid))).values()) { /* 161 */ s.setGameID(gameno); /* 162 */ addSQL(s.createQuery()); /* */ } /* 164 */ ((HashMap) this.arenas.get(Integer.valueOf(arenaid))).clear(); /* */ }