blob: 6c925e2073e33c846a0929a8051948b5af487e03 (
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.commands;
import org.bukkit.command.CommandSender;
import net.tylermurphy.hideAndSeek.ICommand;
import net.tylermurphy.hideAndSeek.manager.WorldborderManager;
import static net.tylermurphy.hideAndSeek.Store.*;
public class EnableBorder implements ICommand {
public void execute(CommandSender sender, String[] args) {
if(!status.equals("Standby") && !status.equals("Setup")) {
sender.sendMessage(errorPrefix + "Game is currently in session");
return;
}
if(worldborderPosition == null) {
sender.sendMessage(errorPrefix + "Please setup worldborder info before enabling");
return;
}
boolean bool;
try { bool = Boolean.parseBoolean(args[0]); } catch (Exception e) {
sender.sendMessage(errorPrefix + "Please enter true or false");
return;
}
if(spawnPosition != null && worldborderPosition != null && spawnPosition.distance(worldborderPosition) > 100) {
sender.sendMessage(errorPrefix + "Cannot enable worldborder, spawn position is outside 100 blocks from worldborder");
return;
}
sender.sendMessage(messagePrefix + "Set worldborder to "+args[0]);
getConfig().set("borderEnabled", bool);
worldborderEnabled = bool;
saveConfig();
WorldborderManager.reset();
}
public String getLabel() {
return "enableBorder";
}
public String getUsage() {
return "<true/false>";
}
public String getDescription() {
return "Enables or disables worldborder";
}
}
|