mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-10-01 06:13:13 +00:00
Add command logging for CommandBlocks and other console types.
This commit is contained in:
parent
188a214de9
commit
522c3e85b2
|
@ -20,6 +20,7 @@ package com.earth2me.essentials;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.api.Economy;
|
import com.earth2me.essentials.api.Economy;
|
||||||
import com.earth2me.essentials.api.IJails;
|
import com.earth2me.essentials.api.IJails;
|
||||||
|
import com.earth2me.essentials.commands.EssentialsCommand;
|
||||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||||
import com.earth2me.essentials.commands.NoChargeException;
|
import com.earth2me.essentials.commands.NoChargeException;
|
||||||
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
||||||
|
@ -48,6 +49,8 @@ import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.command.BlockCommandSender;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
|
@ -245,7 +248,8 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveConfig() {
|
public void saveConfig()
|
||||||
|
{
|
||||||
// We don't use any of the bukkit config writing, as this breaks our config file formatting.
|
// We don't use any of the bukkit config writing, as this breaks our config file formatting.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,10 +360,32 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
User user = null;
|
User user = null;
|
||||||
|
Block bSenderBlock = null;
|
||||||
if (sender instanceof Player)
|
if (sender instanceof Player)
|
||||||
{
|
{
|
||||||
user = getUser(sender);
|
user = getUser(sender);
|
||||||
}
|
}
|
||||||
|
else if (sender instanceof BlockCommandSender)
|
||||||
|
{
|
||||||
|
BlockCommandSender bsender = (BlockCommandSender)sender;
|
||||||
|
bSenderBlock = bsender.getBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bSenderBlock != null)
|
||||||
|
{
|
||||||
|
Bukkit.getLogger().log(Level.INFO, "CommandBlock at {0},{1},{2} issued server command: /{3} {4}", new Object[]
|
||||||
|
{
|
||||||
|
bSenderBlock.getX(), bSenderBlock.getY(), bSenderBlock.getZ(), commandLabel, EssentialsCommand.getFinalArg(args, 0)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (user == null)
|
||||||
|
{
|
||||||
|
Bukkit.getLogger().log(Level.INFO, "{0} issued server command: /{1} {2}", new Object[]
|
||||||
|
{
|
||||||
|
sender.getName(), commandLabel, EssentialsCommand.getFinalArg(args, 0)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// New mail notification
|
// New mail notification
|
||||||
if (user != null && !getSettings().isCommandDisabled("mail") && !command.getName().equals("mail") && user.isAuthorized("essentials.mail"))
|
if (user != null && !getSettings().isCommandDisabled("mail") && !command.getName().equals("mail") && user.isAuthorized("essentials.mail"))
|
||||||
|
|
Loading…
Reference in a new issue