now add your bed spawn to the list
This commit is contained in:
parent
b6ab82c8e1
commit
f4a3c334ae
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>ovh.mxg</groupId>
|
||||
<artifactId>CubeTP</artifactId>
|
||||
<version>SNAPSHOT</version>
|
||||
<version>1.3.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>CubeTP</name>
|
||||
|
|
|
@ -294,11 +294,17 @@ public final class CubeTP extends JavaPlugin implements Listener {
|
|||
}
|
||||
|
||||
public void AddAllCubes(Player player) throws SQLException {
|
||||
int slot = 9;
|
||||
String uuid = player.getUniqueId().toString();
|
||||
if(player.getBedSpawnLocation() != null){
|
||||
slot = 10;
|
||||
Location spawnLoc = player.getBedSpawnLocation();
|
||||
String loreSp = MessageFormat.format("x{0} y{1} z{2}", spawnLoc.getBlockX(), spawnLoc.getBlockY(), spawnLoc.getBlockZ());
|
||||
inv.setItem(9,createGuiItem(Material.WHITE_WOOL, "Spawn", loreSp));
|
||||
}
|
||||
SQL.connect();
|
||||
PreparedStatement ps = SQL.getConnection().prepareStatement("SELECT * FROM cubetp WHERE uuid IS NULL");
|
||||
ResultSet rs = ps.executeQuery();
|
||||
int slot = 9;
|
||||
while(rs != null && rs.next()) {
|
||||
String lore01 = MessageFormat.format("x{0} y{1} z{2}", rs.getDouble("x"), rs.getDouble("y"), rs.getDouble("z"));
|
||||
inv.setItem(slot,createGuiItem(Material.GREEN_WOOL, rs.getString("name"), lore01));
|
||||
|
@ -315,14 +321,19 @@ public final class CubeTP extends JavaPlugin implements Listener {
|
|||
}
|
||||
|
||||
public void CubeTP(Player player, String name) throws SQLException {
|
||||
SQL.connect();
|
||||
PreparedStatement ps = SQL.getConnection().prepareStatement("SELECT * FROM cubetp WHERE name = ?");
|
||||
ps.setString(1, name);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
int slot = 9;
|
||||
if(rs.next()) {
|
||||
Location loc = new Location(player.getWorld(), rs.getDouble("x"),rs.getDouble("y"),rs.getDouble("z"), 0, 0);
|
||||
player.teleport(loc);
|
||||
if(name.equals("Spawn")){
|
||||
Location pSpawn = player.getBedSpawnLocation();
|
||||
player.teleport(pSpawn);
|
||||
} else {
|
||||
SQL.connect();
|
||||
PreparedStatement ps = SQL.getConnection().prepareStatement("SELECT * FROM cubetp WHERE name = ?");
|
||||
ps.setString(1, name);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
int slot = 9;
|
||||
if(rs.next()) {
|
||||
Location loc = new Location(player.getWorld(), rs.getDouble("x"),rs.getDouble("y"),rs.getDouble("z"), 0, 0);
|
||||
player.teleport(loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
name: CubeTP
|
||||
version: '1.2.2'
|
||||
version: '1.3.0'
|
||||
main: ovh.mxg.cubetp.CubeTP
|
||||
api-version: '1.20'
|
||||
|
|
Loading…
Reference in New Issue