Jump to content

[1.7.10] Permission to use command


KakesRevenge

Recommended Posts

Hello,

im trying to make command which will work in survival mode too

 

command Class

 

 

package fewmorethings.other.commands;import java.util.Iterator;import java.util.List;import fewmorethings.help.ChatHelper;import net.minecraft.command.CommandBase;import net.minecraft.command.ICommandSender;import net.minecraft.entity.passive.EntityPig;import net.minecraft.entity.player.EntityPlayer;import net.minecraft.init.Blocks;import net.minecraft.init.Items;import net.minecraft.item.Item;import net.minecraft.item.ItemStack;import net.minecraft.item.ItemSword;import net.minecraft.item.crafting.CraftingManager;import net.minecraft.item.crafting.IRecipe;import net.minecraft.potion.Potion;import net.minecraft.potion.PotionEffect;import net.minecraft.stats.AchievementList;import net.minecraft.util.ChatComponentTranslation;public class Achievements extends CommandBase {public String getCommandName() {        return "achievements";    }    public String getCommandUsage(ICommandSender CommandSender) {        return "/achievements";    }        public int getRequiredPermissionLevel() {    	return 0;}        public void processCommand(ICommandSender CommandSender, String[] par2ArrayOfStr) {    	    	EntityPlayer player = getCommandSenderAsPlayer(CommandSender);    	    	player.triggerAchievement(AchievementList.diamonds);    	    }   }

 

 

this isnt working :/

thx for any help :)

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

Link to comment
Share on other sites

thank you very much i  did solve it like so :

 

  @Override
    public boolean canCommandSenderUseCommand(ICommandSender sender) {
    	boolean op = MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile());
        return !op || op;
    }
    

   

 

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

Link to comment
Share on other sites

Cough.

 

  @Override
    public boolean canCommandSenderUseCommand(ICommandSender sender) {
    	return true;
    } 

 

A || !A

will always be true

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Because the code in EntityPlayerMP that checks for commands is broken for anything but vanilla commands.

 

Mojang has done a lot of things to make modder's lives easier, with some benefit to themselves, but from a "just Mojang" perspective the cost:benefit analysis comes out in favor of not-doing them.  For instance, removing block IDs and making things referenced by string.  A lot of work on their part with a pretty small benefit for their continued development, but which makes leaps and bounds improvements for modders.

 

Then on other things they go "can't reproduce it with just vanilla, not a bug, closed."  Say...maps only working in dimension IDs less than 128 (because the dimension ID is an integer, but maps use unsigned shorts!).  Actually, it is a bug, you're using an int in one place and a short in the other, that will be a problem eventually and with access to the source code I can prove it.  It just doesn't have any visible effect until a mod is introduced.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Thank you guys and one more question because i dont want to create another  thread for it ... how to check in which dimension is player?

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

Link to comment
Share on other sites

Thank you guys and one more question because i dont want to create another  thread for it ... how to check in which dimension is player?

player.worldObj.provider.dimensionId

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

and 1 more :  vazkii somehow did that when you will right-click empty glass bottle in the end you will get ender air in the bottle ... how to do that ? is here somewhere event for it or something ? i was looking  in botania src code for like 2 hours now and cant find it :/

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

Link to comment
Share on other sites

do you think vazkii made new water bottle ? and removed the old one ?

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

Link to comment
Share on other sites

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.