summaryrefslogtreewikicommitdiff
path: root/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java
blob: 2808948995c45675af4795f29d770f38227239ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package net.tylermurphy.hideAndSeek.command;

import static net.tylermurphy.hideAndSeek.Config.*;

import java.util.HashMap;
import java.util.Map;

import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;

import net.tylermurphy.hideAndSeek.Main;

public class SetExitLocation implements ICommand {

	public void execute(CommandSender sender, String[] args) {
		Vector newExitPosition = new Vector();
		Player player = (Player) sender;
		newExitPosition.setX(player.getLocation().getBlockX());
		newExitPosition.setY(player.getLocation().getBlockY());
		newExitPosition.setZ(player.getLocation().getBlockZ());
		if(!Main.plugin.status.equals("Standby")) {
			sender.sendMessage(errorPrefix + "Game is currently in session");
			return;
		}
		exitPosition = newExitPosition;
		sender.sendMessage(messagePrefix + "Set exit position to current location");
		Map<String, Object> temp = new HashMap<String,Object>();
		temp.put("x", exitPosition.getX());
		temp.put("y", exitPosition.getY());
		temp.put("z", exitPosition.getZ());
		temp.put("world", player.getLocation().getWorld().getName());
		addToSection("spawns.exit",temp);
		saveConfig();
	}

	public String getLabel() {
		return "setexit";
	}
	
	public String getUsage() {
		return "";
	}

	public String getDescription() {
		return "Sets hide and seeks exit location to current position and world";
	}

}