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>
|
<groupId>ovh.mxg</groupId>
|
||||||
<artifactId>CubeTP</artifactId>
|
<artifactId>CubeTP</artifactId>
|
||||||
<version>SNAPSHOT</version>
|
<version>1.3.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>CubeTP</name>
|
<name>CubeTP</name>
|
||||||
|
|
|
@ -294,11 +294,17 @@ public final class CubeTP extends JavaPlugin implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddAllCubes(Player player) throws SQLException {
|
public void AddAllCubes(Player player) throws SQLException {
|
||||||
|
int slot = 9;
|
||||||
String uuid = player.getUniqueId().toString();
|
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();
|
SQL.connect();
|
||||||
PreparedStatement ps = SQL.getConnection().prepareStatement("SELECT * FROM cubetp WHERE uuid IS NULL");
|
PreparedStatement ps = SQL.getConnection().prepareStatement("SELECT * FROM cubetp WHERE uuid IS NULL");
|
||||||
ResultSet rs = ps.executeQuery();
|
ResultSet rs = ps.executeQuery();
|
||||||
int slot = 9;
|
|
||||||
while(rs != null && rs.next()) {
|
while(rs != null && rs.next()) {
|
||||||
String lore01 = MessageFormat.format("x{0} y{1} z{2}", rs.getDouble("x"), rs.getDouble("y"), rs.getDouble("z"));
|
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));
|
inv.setItem(slot,createGuiItem(Material.GREEN_WOOL, rs.getString("name"), lore01));
|
||||||
|
@ -315,6 +321,10 @@ public final class CubeTP extends JavaPlugin implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CubeTP(Player player, String name) throws SQLException {
|
public void CubeTP(Player player, String name) throws SQLException {
|
||||||
|
if(name.equals("Spawn")){
|
||||||
|
Location pSpawn = player.getBedSpawnLocation();
|
||||||
|
player.teleport(pSpawn);
|
||||||
|
} else {
|
||||||
SQL.connect();
|
SQL.connect();
|
||||||
PreparedStatement ps = SQL.getConnection().prepareStatement("SELECT * FROM cubetp WHERE name = ?");
|
PreparedStatement ps = SQL.getConnection().prepareStatement("SELECT * FROM cubetp WHERE name = ?");
|
||||||
ps.setString(1, name);
|
ps.setString(1, name);
|
||||||
|
@ -325,6 +335,7 @@ public final class CubeTP extends JavaPlugin implements Listener {
|
||||||
player.teleport(loc);
|
player.teleport(loc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected ItemStack createGuiItem(final Material material, final String name, final String... lore) {
|
protected ItemStack createGuiItem(final Material material, final String name, final String... lore) {
|
||||||
final ItemStack item = new ItemStack(material, 1);
|
final ItemStack item = new ItemStack(material, 1);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
name: CubeTP
|
name: CubeTP
|
||||||
version: '1.2.2'
|
version: '1.3.0'
|
||||||
main: ovh.mxg.cubetp.CubeTP
|
main: ovh.mxg.cubetp.CubeTP
|
||||||
api-version: '1.20'
|
api-version: '1.20'
|
||||||
|
|
Loading…
Reference in New Issue