Co zwroci ta funkcja?

0
    public boolean canJoin(Player p)
    {
        return (sql.getReserveMethod(p) != null);
    }

Co zwroci ta funkcja, jeśli sql.getReserveMethod(p) == null, a co jeśli sql.getReserveMethod(p) == CosInnego? Funkcja getReserveMethod wygląda tak:

public String getReserveMethod(Player player) {
		Connection conn = getSQLConnection();
		PreparedStatement ps = null;
		ResultSet rs = null;
		String mysqlTable = plugin.getConfig().getString("mysql-table");
		try {
			ps = conn.prepareStatement("SELECT * FROM " + mysqlTable + " WHERE name = ? ORDER BY id DESC LIMIT 1");
			String p = player.toString();
			ps.setString(1, p);
			rs = ps.executeQuery();
			while (rs.next()){
				String type = rs.getString("type");
				return type;
			}
		} catch (SQLException ex) {
			SimpleReserve.log.log(Level.SEVERE, "[SimpleReserve] Couldn't execute MySQL statement: ", ex);
		} finally {
			try {
				if (ps != null)
					ps.close();
				if (conn != null)
					conn.close();
			} catch (SQLException ex) {
				SimpleReserve.log.log(Level.SEVERE, "[SimpleReserve] Failed to close MySQL connection: ", ex);
			}
		}
		return null;
	} 

Dodam, ze jest to plugin do gry Minecraft.

0

Obstawiam, że coś dużego :D

0

W każdym przypadku, bez znaczenia wyniku sql.getReserveMethod(p), ta funkcja zwróci sql.getReserveMethod(p) != null

0

Mówiąc prosto, funkcja zwróci true jeśli wynik getReserveMethod będzie różny od null i false, gdy będzie równy null.

0

Dzięki wielkie panu wyżej :)

1 użytkowników online, w tym zalogowanych: 0, gości: 1