Posted April 25, 201510 yr 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?
April 25, 201510 yr 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.
April 25, 201510 yr 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
April 25, 201510 yr Author 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?
April 25, 201510 yr Author 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
April 26, 201510 yr Update your mappings then, in your build.gradle put mappings = "stable_12" in the minecraft { // Stuff } section. Then re-setupDecompWorkspace
April 26, 201510 yr Author 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.)
April 26, 201510 yr Author Use the one I gave you, if canSendCommands still isn't there, try func_152596_g This works like a charm thanks
April 26, 201510 yr Author 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!
April 26, 201510 yr 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.
April 26, 201510 yr Author 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.