Delete Score.java
This commit is contained in:
@@ -1,51 +0,0 @@
|
|||||||
package ru.prisonlife.PrisonAPI.template;
|
|
||||||
|
|
||||||
import ru.prisonlife.PrisonAPI.connect.DataBasePrison4Life;
|
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public class Score extends DataBasePrison4Life {
|
|
||||||
private PreparedStatement state;
|
|
||||||
private ResultSet r_set;
|
|
||||||
private Prisoner me;
|
|
||||||
Score(Prisoner prisoner) { me = prisoner; }
|
|
||||||
|
|
||||||
public double getPoints() throws SQLException {
|
|
||||||
setInResUUID();
|
|
||||||
if(r_set.first()) {
|
|
||||||
r_set = state.executeQuery("SELECT POINTS FROM PLAYERS_LEVEL WHERE UUID = '" + me.getPlayer().getUniqueId() + "'");
|
|
||||||
if(r_set.first()) {
|
|
||||||
return r_set.getDouble(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
disconnect();
|
|
||||||
return NullPointerException.class.hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPoints(double value) throws SQLException {
|
|
||||||
setInResUUID();
|
|
||||||
if(r_set.first())
|
|
||||||
state.execute("UPDATE PLAYERS_LEVEL SET POINTS = " + value + " WHERE UUID = '" + me.getPlayer().getUniqueId() + "'");
|
|
||||||
disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addPoints(double value) throws SQLException {
|
|
||||||
setInResUUID();
|
|
||||||
if(r_set.first())
|
|
||||||
state.execute("UPDATE PLAYERS_LEVEL SET POINTS = " + (getPoints() + value) + " WHERE UUID = '" + me.getPlayer().getUniqueId() + "'");
|
|
||||||
disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setInResUUID() throws SQLException {
|
|
||||||
state = connection.prepareStatement("SELECT * UUID FROM ECONOMY WHERE UUID = ?;");
|
|
||||||
state.setString(1, me.getPlayer().getUniqueId().toString());
|
|
||||||
r_set = state.executeQuery("SELECT UUID FROM ECONOMY WHERE UUID = '" + me.getPlayer().getUniqueId() + "'");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void disconnect() throws SQLException {
|
|
||||||
r_set.close();
|
|
||||||
state.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user