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