format code
This commit is contained in:
@@ -7,23 +7,29 @@ import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class PrisonAPI extends JavaPlugin {
|
||||
public static Connection CONN;
|
||||
|
||||
public enum Factions {
|
||||
NONE, ASIANS, LATINOS, NIGGAZ, POLICE
|
||||
}
|
||||
|
||||
public static Connection CONN;
|
||||
|
||||
public void onEnable() {
|
||||
try {
|
||||
CONN = DriverManager.getConnection(
|
||||
"jdbc:mysql://localhost:3306/prison4life",
|
||||
"root", "root");
|
||||
} catch (SQLException e) { e.printStackTrace(); }
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
try {
|
||||
if (!CONN.isClosed())
|
||||
CONN.close();
|
||||
} catch (SQLException e) { e.printStackTrace(); }
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,9 +12,11 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class Faction {
|
||||
|
||||
private PreparedStatement state;
|
||||
private ResultSet r_set;
|
||||
private Prisoner me;
|
||||
|
||||
Faction(Prisoner prisoner) {
|
||||
me = prisoner;
|
||||
}
|
||||
|
||||
@@ -7,11 +7,16 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Level {
|
||||
|
||||
private PreparedStatement state;
|
||||
private ResultSet r_set;
|
||||
private Prisoner me;
|
||||
private Score score;
|
||||
Level(Prisoner prisoner) { me = prisoner; score = new Score(me); }
|
||||
|
||||
Level(Prisoner prisoner) {
|
||||
me = prisoner;
|
||||
score = new Score(me);
|
||||
}
|
||||
|
||||
public Score getScore() throws SQLException {
|
||||
con_t();
|
||||
|
||||
@@ -12,10 +12,10 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Manager {
|
||||
|
||||
private File fi;
|
||||
private FileConfiguration cf;
|
||||
|
||||
|
||||
public Manager(String id) {
|
||||
fi = new File("plugins/PrisonManager/", id);
|
||||
cf = YamlConfiguration.loadConfiguration(fi);
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Prisoner {
|
||||
|
||||
private static final String PLUGIN_PATH = "plugins/PrisonManager";
|
||||
private Player me;
|
||||
private Level level;
|
||||
@@ -32,9 +33,13 @@ public class Prisoner {
|
||||
stats = new Stats(this);
|
||||
}
|
||||
|
||||
public Player getPlayer() { return me; }
|
||||
public Player getPlayer() {
|
||||
return me;
|
||||
}
|
||||
|
||||
public Level getPrisonLevel() throws SQLException { return this.level; }
|
||||
public Level getPrisonLevel() throws SQLException {
|
||||
return this.level;
|
||||
}
|
||||
|
||||
public String getPrison() {
|
||||
Location loc = me.getLocation();
|
||||
@@ -91,16 +96,23 @@ public class Prisoner {
|
||||
(type.equals("owner") ? c_ti.getString("TERRITORIES." + terr + ".OWNER") : null);
|
||||
}
|
||||
}
|
||||
} catch(NullPointerException z) {}
|
||||
} catch (NullPointerException z) {
|
||||
}
|
||||
}
|
||||
return "Not Territory";
|
||||
}
|
||||
|
||||
public Faction getFaction() { return faction; }
|
||||
public Faction getFaction() {
|
||||
return faction;
|
||||
}
|
||||
|
||||
public Wallet getWallet() { return wallet; }
|
||||
public Wallet getWallet() {
|
||||
return wallet;
|
||||
}
|
||||
|
||||
public Stats getStats() { return stats; }
|
||||
public Stats getStats() {
|
||||
return stats;
|
||||
}
|
||||
|
||||
public void register() throws SQLException {
|
||||
state = PrisonAPI.CONN.prepareStatement("SELECT * UUID FROM player_stats WHERE UUID = ?;");
|
||||
|
||||
@@ -7,10 +7,14 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Score {
|
||||
|
||||
private PreparedStatement state;
|
||||
private ResultSet r_set;
|
||||
private Prisoner me;
|
||||
Score(Prisoner prisoner) { me = prisoner; }
|
||||
|
||||
Score(Prisoner prisoner) {
|
||||
me = prisoner;
|
||||
}
|
||||
|
||||
public double getPoints() throws SQLException {
|
||||
con_t();
|
||||
|
||||
@@ -7,10 +7,14 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Stats {
|
||||
|
||||
private PreparedStatement state;
|
||||
private ResultSet r_set;
|
||||
private Prisoner me;
|
||||
Stats(Prisoner prisoner) { me = prisoner;}
|
||||
|
||||
Stats(Prisoner prisoner) {
|
||||
me = prisoner;
|
||||
}
|
||||
|
||||
public void setServerTime(int value) throws SQLException {
|
||||
con_t();
|
||||
|
||||
@@ -7,10 +7,14 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Wallet {
|
||||
|
||||
private PreparedStatement state;
|
||||
private ResultSet r_set;
|
||||
private Prisoner me;
|
||||
Wallet(Prisoner prisoner) { me = prisoner; }
|
||||
|
||||
Wallet(Prisoner prisoner) {
|
||||
me = prisoner;
|
||||
}
|
||||
|
||||
public int getBalance() throws SQLException {
|
||||
con_t();
|
||||
|
||||
Reference in New Issue
Block a user