1 |
package dk.thoerup.bukkit.hoeruputils; |
2 |
|
3 |
import org.bukkit.command.Command; |
4 |
import org.bukkit.command.CommandExecutor; |
5 |
import org.bukkit.command.CommandSender; |
6 |
import org.bukkit.entity.Player; |
7 |
|
8 |
public class GcCommand implements CommandExecutor { |
9 |
|
10 |
@Override |
11 |
public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) { |
12 |
|
13 |
if ( sender instanceof Player) { |
14 |
if ( ! sender.isOp() ) { |
15 |
sender.sendMessage("gc can only be called from console - or by a server operator"); |
16 |
return false; |
17 |
} |
18 |
} |
19 |
|
20 |
System.gc(); |
21 |
sender.sendMessage("ok"); |
22 |
return true; |
23 |
} |
24 |
} |