Jump to content

Recommended Posts

Posted

I have a few commands on my mod that i don't want regular players using. Until i work out how to set permissions (or build a permission manager if i have to) i want to restrict these commands to OP, while letting players use other commands.

 

it's worth noting that i have one command with several functions based on the first argument (/wallet set..... /wallet pay... etc)

 

so at the start of each command that i want to restrict. i need to check if the player is OP. Can someone tell me how to do this please?

 

 

don't you just hate being a Nooby modder? At the stage where tutorials aren't spoon feeding you through to releasing a mod, leaving you to ask many, many questions that seem to have simple answers?

Posted

MinecraftServer.getServer().getConfigurationManager().getOppedPlayers().getGameProfileFromName(player.getName()) != null

 

Alos this:

MinecraftServer.getServer().isSinglePlayer()

 

For SP you will want to give full perm, ay?

1.7.10 is no longer supported by forge, you are on your own.

Posted

FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().canSendCommands((<ENTITYPLAYERMP>).getGameProfile())

 

That should work on servers and in the case of single player, respect if cheats are enabled.

This is the same on 1.7.10 and 1.8

Posted

MinecraftServer.getServer().getConfigurationManager().getOppedPlayers().getGameProfileFromName(player.getName()) != null

 

Alos this:

MinecraftServer.getServer().isSinglePlayer()

 

For SP you will want to give full perm, ay?

 

"getOppedPlayers()" apparently isn't a method 0.o thoughts?

Posted

FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().canSendCommands((<ENTITYPLAYERMP>).getGameProfile())

 

That should work on servers and in the case of single player, respect if cheats are enabled.

This is the same on 1.7.10 and 1.8

 

"canSendCommands()" apaprently doesn't exist either :/

Posted

Update your mappings then, in your build.gradle put

mappings = "stable_12"

in the

minecraft {
  // Stuff
}

section.

 

Then re-setupDecompWorkspace

 

okay, i'll do this now. could you explain what this does? (so i know when it might be necessary for future ref.)

Posted

Use the one I gave you, if canSendCommands still isn't there, try func_152596_g

 

this resolved that issue, but func_152596_g is causing gradlew build to fail :/ thoughts?

 

I'm so damn close to releasing my mod!

Posted

Try re-running gradle eclipse (Assuming you use eclipse, idea if not)

Refresh your workspace so the referenced libraries are up to date.

If func_152596_g turns into an error, replace it with canSendCommands

Try building your mod.

Posted

Try re-running gradle eclipse (Assuming you use eclipse, idea if not)

Refresh your workspace so the referenced libraries are up to date.

If func_152596_g turns into an error, replace it with canSendCommands

Try building your mod.

 

thank you, this fixed 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...

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