-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.java
More file actions
75 lines (52 loc) · 1.81 KB
/
Copy pathmain.java
File metadata and controls
75 lines (52 loc) · 1.81 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package mod;
import java.util.ArrayList;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import mod.addrequsted;
public class main extends JavaPlugin implements Listener, CommandExecutor {
@Override
public void onEnable() {
getLogger().info("IT WORRKS!");
getCommand("add").setExecutor(new addrequsted());
getCommand("remove").setExecutor(new addrequsted());
getCommand("mod").setExecutor(this);
}
@Override
public void onDisable() {
getLogger().info("IT WORRKS!");
}
ArrayList<String> requester = new ArrayList<String>();
// ArrayList<String> requested = new ArrayList<String>();
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = (Player) sender;
if (command.getName().equalsIgnoreCase("mod")) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "You cannot execute command in console dummy!");
return false;
}
// if(player.hasPermission("mod.main.default")){
if (!(requester.contains(player.getName()))) {
sender.sendMessage(ChatColor.DARK_BLUE + "You have requested assistance from mod");
return true;
}
if (requester.contains(player.getName())) {
sender.sendMessage(ChatColor.RED + "You have already requested a Mod");
return false;
}
}
requester.add(player.getName());
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
requester.remove(player.getName());
}
}, 3600);
// }
return true;
}
}