mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 18:47:20 +01:00
Cleaned up MVINFO Closes #47
This commit is contained in:
parent
de9209b270
commit
9acc46f9d1
@ -4,10 +4,12 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.utils.LocationManipulation;
|
||||
|
||||
@ -22,6 +24,7 @@ public class CoordCommand extends MultiverseCommand {
|
||||
this.setArgRange(0, 0);
|
||||
this.addKey("mv coord");
|
||||
this.addKey("mvcoord");
|
||||
this.addKey("mvco");
|
||||
this.setPermission("multiverse.core.coord", "Returns detailed information on the Players where abouts.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@ -30,15 +33,21 @@ public class CoordCommand extends MultiverseCommand {
|
||||
// Check if the command was sent from a Player.
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
if(!this.plugin.isMVWorld(p.getWorld().getName())) {
|
||||
this.plugin.showNotMVWorldMessage(sender, p.getWorld().getName());
|
||||
World world = p.getWorld();
|
||||
|
||||
if(!this.plugin.isMVWorld(world.getName())) {
|
||||
this.plugin.showNotMVWorldMessage(sender, world.getName());
|
||||
return;
|
||||
}
|
||||
p.sendMessage(ChatColor.RED + "World: " + ChatColor.WHITE + p.getWorld().getName());
|
||||
p.sendMessage(ChatColor.RED + "World Scale: " + ChatColor.WHITE + this.plugin.getMVWorld(p.getWorld().getName()).getScaling());
|
||||
p.sendMessage(ChatColor.RED + "Coordinates: " + ChatColor.WHITE + this.locMan.strCoords(p.getLocation()));
|
||||
p.sendMessage(ChatColor.RED + "Direction: " + ChatColor.WHITE + this.locMan.getDirection(p.getLocation()));
|
||||
p.sendMessage(ChatColor.RED + "Block: " + ChatColor.WHITE + Material.getMaterial(p.getWorld().getBlockTypeIdAt(p.getLocation())));
|
||||
|
||||
MVWorld mvworld = this.plugin.getMVWorld(world.getName());
|
||||
p.sendMessage(ChatColor.AQUA + "--- World Information ---");
|
||||
p.sendMessage(ChatColor.AQUA + "World: " + ChatColor.WHITE + world.getName());
|
||||
p.sendMessage(ChatColor.AQUA + "Alias: " + mvworld.getColoredWorldString());
|
||||
p.sendMessage(ChatColor.AQUA + "World Scale: " + ChatColor.WHITE + mvworld.getScaling());
|
||||
p.sendMessage(ChatColor.AQUA + "Coordinates: " + ChatColor.WHITE + this.locMan.strCoords(p.getLocation()));
|
||||
p.sendMessage(ChatColor.AQUA + "Direction: " + ChatColor.WHITE + this.locMan.getDirection(p.getLocation()));
|
||||
p.sendMessage(ChatColor.AQUA + "Block: " + ChatColor.WHITE + Material.getMaterial(world.getBlockTypeIdAt(p.getLocation())));
|
||||
} else {
|
||||
sender.sendMessage("This command needs to be used from a Player.");
|
||||
}
|
||||
|
@ -40,7 +40,18 @@ public class InfoCommand extends MultiverseCommand {
|
||||
for (String s : buildEntireCommand(this.plugin.getMVWorld(worldName))) {
|
||||
sender.sendMessage(s);
|
||||
}
|
||||
} else if (this.plugin.getServer().getWorld(worldName) != null) {
|
||||
sender.sendMessage("That world exists, but multiverse does not know about it!");
|
||||
sender.sendMessage("You can import it with" + ChatColor.AQUA + "/mv import " + ChatColor.GREEN + worldName + ChatColor.LIGHT_PURPLE + "{ENV}");
|
||||
sender.sendMessage("For available environments type " + ChatColor.GREEN + "/mv env");
|
||||
}
|
||||
// Leaving this in so we can have a laugh about it.
|
||||
|
||||
// else {
|
||||
// sender.sendMessage("That world does not exist!");
|
||||
// sender.sendMessage("You can create it with" + ChatColor.AQUA + "/mv create " + ChatColor.GREEN + worldName + ChatColor.LIGHT_PURPLE + "{ENV}");
|
||||
// sender.sendMessage("For available environments type " + ChatColor.GREEN + "/mv env");
|
||||
// }
|
||||
}
|
||||
|
||||
private List<String> buildEntireCommand(MVWorld world) {
|
||||
|
@ -63,9 +63,9 @@ public class ModifySetCommand extends MultiverseCommand {
|
||||
if ((property.equalsIgnoreCase("aliascolor") || property.equalsIgnoreCase("color")) && !world.isValidAliasColor(value)) {
|
||||
sender.sendMessage(value + " is not a valid color. Please see our Github Wiki for the complete color list.");
|
||||
} else if (world.setVariable(property, value)) {
|
||||
sender.sendMessage("Property " + property + " was set to " + value);
|
||||
sender.sendMessage(ChatColor.GREEN + "Success!" + ChatColor.WHITE + "Property " + ChatColor.AQUA + property + ChatColor.WHITE + " was set to " + ChatColor.GREEN + value);
|
||||
} else {
|
||||
sender.sendMessage("There was an error setting " + property);
|
||||
sender.sendMessage(ChatColor.RED + "There was an error setting " + ChatColor.GRAY + property);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,23 +80,24 @@ public class LocationManipulation {
|
||||
* @return
|
||||
*/
|
||||
public String getDirection(Location location) {
|
||||
int r = (int) Math.abs((location.getYaw() - 90) % 360);
|
||||
double r = (location.getYaw() % 360) + 180;
|
||||
// Remember, these numbers are every 45 degrees with a 22.5 offset, to detect boundaries.
|
||||
String dir;
|
||||
if (r < 23)
|
||||
if (r < 22.5)
|
||||
dir = "N";
|
||||
else if (r < 68)
|
||||
else if (r < 67.5)
|
||||
dir = "NE";
|
||||
else if (r < 113)
|
||||
else if (r < 112.5)
|
||||
dir = "E";
|
||||
else if (r < 158)
|
||||
else if (r < 157.5)
|
||||
dir = "SE";
|
||||
else if (r < 203)
|
||||
else if (r < 202.5)
|
||||
dir = "S";
|
||||
else if (r < 248)
|
||||
else if (r < 247.5)
|
||||
dir = "SW";
|
||||
else if (r < 293)
|
||||
else if (r < 292.5)
|
||||
dir = "W";
|
||||
else if (r < 338)
|
||||
else if (r < 337.5)
|
||||
dir = "NW";
|
||||
else
|
||||
dir = "N";
|
||||
|
@ -160,6 +160,10 @@ commands:
|
||||
usage: |
|
||||
/<command>
|
||||
mvversion:
|
||||
description: Prints out version invo.
|
||||
usage: |
|
||||
/<command>
|
||||
mvco:
|
||||
description: Prints out version invo.
|
||||
usage: |
|
||||
/<command>
|
Loading…
Reference in New Issue
Block a user