-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathStopSubCommand.java
More file actions
40 lines (37 loc) · 1.56 KB
/
StopSubCommand.java
File metadata and controls
40 lines (37 loc) · 1.56 KB
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
package de.themoep.entitydetection.commands;
import de.themoep.entitydetection.EntityDetection;
import de.themoep.entitydetection.searcher.EntitySearch;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
/**
* Copyright 2016 Max Lee (https://github.com/Phoenix616/)
* <p/>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Mozilla Public License as published by
* the Mozilla Foundation, version 2.
* <p/>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Mozilla Public License v2.0 for more details.
* <p/>
* You should have received a copy of the Mozilla Public License v2.0
* along with this program. If not, see <http://mozilla.org/MPL/2.0/>.
*/
public class StopSubCommand extends SubCommand {
public StopSubCommand(EntityDetection plugin) {
super(plugin, plugin.getName().toLowerCase(), "stop",
""
);
}
@Override
public boolean execute(CommandSender sender, String[] args) {
if (getPlugin().stopSearch(sender.getName())) {
EntitySearch search = getPlugin().getCurrentSearch();
sender.sendMessage(ChatColor.YELLOW + "Stopped " + search.getType().toString() + " search by " + search.getOwner() + " after " + search.getDuration() + "s!" );
} else {
sender.sendMessage(ChatColor.RED + "There is no search running currently.");
}
return true;
}
}