Files
Opis/mcp/mobius/opis/commands/CommandFrequency.java
T
ProfMobius d70133caa8 Commands are now usable in SP
Updated to match new API from MobiusCore
2013-11-21 13:29:38 +01:00

47 lines
1.3 KiB
Java

package mcp.mobius.opis.commands;
import mcp.mobius.opis.modOpis;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.MemoryConnection;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.dedicated.DedicatedServer;
public class CommandFrequency extends CommandBase {
@Override
public String getCommandName() {
return "opis_delay";
}
@Override
public String getCommandUsage(ICommandSender icommandsender) {
return "";
}
@Override
public void processCommand(ICommandSender icommandsender, String[] astring) {
if (astring.length < 1) return;
try{
modOpis.profilerDelay = Integer.valueOf(astring[0]);
notifyAdmins(icommandsender, "Opis delay set to %s ticks.", new Object[] {astring[0]});
} catch (Exception e){}
}
@Override
public int getRequiredPermissionLevel()
{
return 3;
}
@Override
public boolean canCommandSenderUseCommand(ICommandSender sender)
{
if (sender instanceof DedicatedServer) return true;
if (((EntityPlayerMP)sender).playerNetServerHandler.netManager instanceof MemoryConnection) return true;
return MinecraftServer.getServer().getConfigurationManager().isPlayerOpped(((EntityPlayerMP)sender).username);
}
}