Jump to content

No permission to use command.


DrPiggy

Recommended Posts

5 minutes ago, Awesome_Spider said:

If you're talking about making a bukket plugin this isn't the forum for it. This is the forge modder support forum.

 

If you are using forge, show your code.

of course its forge, its just a kcauldron server so i wanted you guys to know its also partily bukkit. the code is:

package com.drpiggy.eventsystem.commands;

import java.util.ArrayList;
import java.util.List;

import com.drpiggy.eventsystem.data.DataManager;

import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;

public class CommandJoinTeam implements ICommand {

	private final List<String> aliases;

	public CommandJoinTeam() {
		aliases = new ArrayList<String>();
		aliases.add("jointeam");
		aliases.add("joint");
	}

	@Override
	public int compareTo(Object paramT) {
		return 0;
	}

	@Override
	public String getCommandName() {
		return "jointeam";
	}

	@Override
	public String getCommandUsage(ICommandSender sender) {
		return "jointeam <team name>";
	}

	@Override
	public List<String> getCommandAliases() {
		return this.aliases;
	}

	@Override
	public void processCommand(ICommandSender sender, String[] arguments) {

		if (arguments.length == 0) {

			sender.addChatMessage(new ChatComponentText("[EventSystem] Please enter the name of the team!"));
			return;

		}

		if (!DataManager.AddTeamPlayer(arguments[0],
				sender.getEntityWorld().getPlayerEntityByName(sender.getCommandSenderName()))) {

			sender.addChatMessage(new ChatComponentText("[EventSystem] That team does not exist!"));
			return;

		}

		sender.addChatMessage(new ChatComponentText("[EventSystem] Team changed!"));

		DataManager.get(sender.getEntityWorld()).markDirty();

	}

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

	@Override
	public List<String> addTabCompletionOptions(ICommandSender sender, String[] arguments) {
		return null;
	}

	@Override
	public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) {
		return false;
	}

}

but non op players cant use it

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.