Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

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

  • Author
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.

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.

  • Author

Thanks a lot for your replies, guys. 

I think I've got it working, I'll get back to you when I've tested it! 

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.