-
Notifications
You must be signed in to change notification settings - Fork 17
/
ExpireJobHandler.java
38 lines (28 loc) · 986 Bytes
/
ExpireJobHandler.java
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
package com.griefcraft.jobs.impl;
import com.griefcraft.jobs.IJobHandler;
import com.griefcraft.lwc.LWC;
import com.griefcraft.model.Job;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
public class ExpireJobHandler implements IJobHandler {
public String getName() {
return "expire";
}
public String[] getRequiredKeys() {
return new String[0];
}
public int getType() {
return 2;
}
public void run(LWC lwc, Job job) {
// create a console sender
ConsoleCommandSender sender = new ConsoleCommandSender(Bukkit.getServer());
String arguments = "";
// check for arguments
if (job.getData().containsKey("arguments")) {
arguments = (String) job.getData().get("arguments");
}
// call the cleanup command
lwc.getPlugin().onCommand(sender, lwc.getPlugin().getCommand("lwc"), "lwc", ("admin expire " + arguments).split(" "));
}
}