mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Fixed /tpback, it also still saves to file. Should we really remove this? Also need to add saving the pitch/rotation to it too.
This commit is contained in:
parent
99a5f13b5e
commit
c12f0a0936
@ -180,9 +180,11 @@ public class vMinecraftCommands{
|
|||||||
}
|
}
|
||||||
public static int tpback(Player player, String[] args){
|
public static int tpback(Player player, String[] args){
|
||||||
if(player.canUseCommand("/tpback")){
|
if(player.canUseCommand("/tpback")){
|
||||||
double x = vMinecraftUsers.getProfile(player).getTpx();
|
String tpxyz = vMinecraftUsers.getProfile(player).getTpxyz();
|
||||||
double y = vMinecraftUsers.getProfile(player).getTpy();
|
String tpxyz2[] = tpxyz.split(",");
|
||||||
double z = vMinecraftUsers.getProfile(player).getTpz();
|
double x = Double.parseDouble(tpxyz2[0]);
|
||||||
|
double y = Double.parseDouble(tpxyz2[1]);
|
||||||
|
double z = Double.parseDouble(tpxyz2[2]);
|
||||||
player.teleportTo(x, y, z, 0, 0);
|
player.teleportTo(x, y, z, 0, 0);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
@ -1029,7 +1031,11 @@ public class vMinecraftCommands{
|
|||||||
double x = player.getLocation().x;
|
double x = player.getLocation().x;
|
||||||
double y = player.getLocation().y;
|
double y = player.getLocation().y;
|
||||||
double z = player.getLocation().z;
|
double z = player.getLocation().z;
|
||||||
vMinecraftUsers.getProfile(player).setTpback(x, y, z);
|
String x2 = Double.toString(x);
|
||||||
|
String y2 = Double.toString(y);
|
||||||
|
String z2 = Double.toString(z);
|
||||||
|
String xyz = x2+","+y2+","+z2;
|
||||||
|
vMinecraftUsers.getProfile(player).setTpback(xyz);
|
||||||
if(player.canUseCommand("/tpback")){
|
if(player.canUseCommand("/tpback")){
|
||||||
player.sendMessage(Colors.DarkPurple + "Your previous location has been stored, use /tpback to return.");
|
player.sendMessage(Colors.DarkPurple + "Your previous location has been stored, use /tpback to return.");
|
||||||
}
|
}
|
||||||
@ -1117,7 +1123,11 @@ public class vMinecraftCommands{
|
|||||||
double x = player.getLocation().x;
|
double x = player.getLocation().x;
|
||||||
double y = player.getLocation().y;
|
double y = player.getLocation().y;
|
||||||
double z = player.getLocation().z;
|
double z = player.getLocation().z;
|
||||||
vMinecraftUsers.getProfile(playerTarget).setTpback(x, y, z);
|
String x2 = Double.toString(x);
|
||||||
|
String y2 = Double.toString(y);
|
||||||
|
String z2 = Double.toString(z);
|
||||||
|
String xyz = x2+","+y2+","+z2;
|
||||||
|
vMinecraftUsers.getProfile(playerTarget).setTpback(xyz);
|
||||||
if(playerTarget.canUseCommand("/tpback"))
|
if(playerTarget.canUseCommand("/tpback"))
|
||||||
{
|
{
|
||||||
playerTarget.sendMessage(Colors.DarkPurple + "Your previous location has been stored, use /tpback to return.");
|
playerTarget.sendMessage(Colors.DarkPurple + "Your previous location has been stored, use /tpback to return.");
|
||||||
|
@ -152,10 +152,8 @@ class PlayerList
|
|||||||
lastMessage,
|
lastMessage,
|
||||||
nickName,
|
nickName,
|
||||||
tag,
|
tag,
|
||||||
suffix;
|
suffix,
|
||||||
private double tpx,
|
tpxyz;
|
||||||
tpy,
|
|
||||||
tpz;
|
|
||||||
|
|
||||||
private boolean dead;
|
private boolean dead;
|
||||||
|
|
||||||
@ -184,6 +182,7 @@ class PlayerList
|
|||||||
tag = new String();
|
tag = new String();
|
||||||
nickName = new String();
|
nickName = new String();
|
||||||
suffix = new String();
|
suffix = new String();
|
||||||
|
tpxyz = new String();
|
||||||
defaultColor = 'f';
|
defaultColor = 'f';
|
||||||
ignoreList = new ArrayList<String>();
|
ignoreList = new ArrayList<String>();
|
||||||
aliasList = new commandList();
|
aliasList = new commandList();
|
||||||
@ -249,15 +248,7 @@ class PlayerList
|
|||||||
//Not sure if declaring a double this way will work or not
|
//Not sure if declaring a double this way will work or not
|
||||||
if(character.length > 7)
|
if(character.length > 7)
|
||||||
{
|
{
|
||||||
double tpx = new Double(character[7]).doubleValue();
|
tpxyz = character[7];
|
||||||
}
|
|
||||||
if(character.length > 8)
|
|
||||||
{
|
|
||||||
double tpy = new Double(character[8]).doubleValue();
|
|
||||||
}
|
|
||||||
if(character.length > 9)
|
|
||||||
{
|
|
||||||
double tpz = new Double(character[9]).doubleValue();
|
|
||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
return true;
|
return true;
|
||||||
@ -312,9 +303,7 @@ class PlayerList
|
|||||||
}
|
}
|
||||||
writer.append(":");
|
writer.append(":");
|
||||||
writer.append(aliasList.toString());
|
writer.append(aliasList.toString());
|
||||||
writer.append(tpx + ":");
|
writer.append(tpxyz.toString());
|
||||||
writer.append(tpy + ":");
|
|
||||||
writer.append(tpz + ":");
|
|
||||||
writer.append("\r\n");
|
writer.append("\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -354,9 +343,7 @@ class PlayerList
|
|||||||
out.append(",");
|
out.append(",");
|
||||||
}
|
}
|
||||||
out.append(":");
|
out.append(":");
|
||||||
out.append(tpx + ":");
|
out.append(tpxyz + ":");
|
||||||
out.append(tpy + ":");
|
|
||||||
out.append(tpz + ":");
|
|
||||||
|
|
||||||
out.append(aliasList.toString());
|
out.append(aliasList.toString());
|
||||||
out.newLine();
|
out.newLine();
|
||||||
@ -485,36 +472,20 @@ class PlayerList
|
|||||||
//Output: None
|
//Output: None
|
||||||
//Use: Sets a player's tpback xyz coordinates
|
//Use: Sets a player's tpback xyz coordinates
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public void setTpback(double x, double y, double z)
|
public void setTpback(String newtpback)
|
||||||
{
|
{
|
||||||
//Coordinates
|
tpxyz = newtpback;
|
||||||
x = tpx;
|
|
||||||
y = tpy;
|
|
||||||
z = tpz;
|
|
||||||
}
|
}
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: getTpbx
|
//Function: getTpxyz
|
||||||
//Input: None
|
//Input: None
|
||||||
//Output: Double: The player's tpback x coords
|
//Output: Double: The player's tpback x coords
|
||||||
//Use: Gets the x value of tpback
|
//Use: Gets the x value of tpback
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public double getTpx() { return tpx; }
|
public String getTpxyz()
|
||||||
//=====================================================================
|
{
|
||||||
//Function: getTpy
|
return tpxyz;
|
||||||
//Input: None
|
}
|
||||||
//Output: Double: The player's tpback x coords
|
|
||||||
//Use: Gets the x value of tpback
|
|
||||||
//=====================================================================
|
|
||||||
public double getTpy() { return tpy; }
|
|
||||||
//=====================================================================
|
|
||||||
//Function: getTpz
|
|
||||||
//Input: None
|
|
||||||
//Output: Double: The player's tpback x coords
|
|
||||||
//Use: Gets the x value of tpback
|
|
||||||
//=====================================================================
|
|
||||||
public double getTpz() { return tpz; }
|
|
||||||
|
|
||||||
//=====================================================================
|
|
||||||
//Function: getTag
|
//Function: getTag
|
||||||
//Input: None
|
//Input: None
|
||||||
//Output: String: The player tag
|
//Output: String: The player tag
|
||||||
|
Loading…
Reference in New Issue
Block a user