Jump to content

Recommended Posts

Posted

I'm working on a scheduled shutdown mod in forge-1.10.2-12.18.3.2281.

 

I want a command that allows for operators to /setdelay <minutes> on the schedule, however, I can't seem to figure out how to check if the ICommandSender is an operator on the server.

 

Since most answers I can find are aimed towards earlier versions of minecraft/forge, these answers are deprecated, and the methods no longer exist.

 

public boolean checkPermission(MinecraftServer server, ICommandSender sender) {
    
}

 

This is the method I'm talking about

Posted

Check out some of the vanilla commands, I'm looking at 1.11.2 source, but I see

   /**
     * Return the required permission level for this command.
     */
    public int getRequiredPermissionLevel()
    {
        return 2;
    }

in CommandGameMode in net.Minecraft.command, looks like it might be what you're looking for

Posted
6 minutes ago, Ugdhar said:

Check out some of the vanilla commands, I'm looking at 1.11.2 source, but I see


   /**
     * Return the required permission level for this command.
     */
    public int getRequiredPermissionLevel()
    {
        return 2;
    }

in CommandGameMode in net.Minecraft.command, looks like it might be what you're looking for

Hello there! Thank your for the quick response!

So, what methods would I have to invoke on the ICommandSender to get the actual playerentity? 

 

I'm sorry if I'm coming off as a moron, I'm just quite new to Forge/Minecraft modding.

Posted

Well, I've not really done anything with commands myself, but looking at CommandBase, I see both getCommandSenderAsPlayer and getPlayer methods, so I'd hazard a guess at one of those being the solution. Try some things, and come post your code if it's not working, along with logs and/or what it's (not) doing as expected.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.