Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

Create custom server commands (bukkit srv)


  • Please log in to reply
9 replies to this topic

#1

Kagelol2
    Kagelol2

    Out of the Water

  • Members
  • 4 posts

Posted 06 January 2012 - 11:23 PM

Hi,

im sure this is a question that has been asked frequently, but i was unable to find a answer.
is it possible to make custom commands in a minecraft server ?

so that people ingame say a command and the server will use this as a command.
example: i got users that want to be able to change their gamemode while ingame

if so please explain to me how, im not expert at coding but the simple things i should be able to handle.

Regards,
Kage

Register or log in to remove.

#2

Patolord
    Patolord

    Redstone Miner

  • Curse Premium
  • Curse Premium
  • 656 posts
  • Minecraft: Patolord

Posted 07 January 2012 - 06:46 AM

if you want some users to change gamemode,just give them permission to it..
Need help with Plugins/Permissions/MinecraftServers? Just Message me :D
-Director at Age of Craft Community
.

#3

iZeD_IV
    iZeD_IV

    Stone Miner

  • Members
  • 71 posts
  • Location: Germany
  • Minecraft: iZeD_IV

Posted 07 January 2012 - 07:49 AM

You can use LuaServer, it's an easy to write servermod, just download it, run it and then you can write plugins, looking like this:

Example: (works)
function Commands( player, command, argument )
   if command == "gm" then
	  if ply:Gamemode() == "creative" then
	  ply:Gamemode(0)
	  print(ply.Username .. " made himself Survival!")
	  else
	  ply:Gamemode(1)		
		  print(ply.Username .. " made himself Creative!")
	  end
   end
end
hooks.Add("player.command", "Command Handler", Commands)

Thread:
http://www.minecraft...-luaapi-100101/

EDIT:
Just check out the beginner tutorial on the wiki, it helps very much.
http://wiki.luaserve...tarted_Tutorial

#4

TribalInstincts

Posted 07 January 2012 - 12:48 PM

I don't think what I put below could get any simpler. You can download the whole plugin with source from http://www.tribalins...pleCommands.jar

Also reference this if you need additional help http://wiki.bukkit.o...torial#Commands

From your post I'm assuming your server is mainly you and some friends so i set the permissions default to allow everyone to have access. Change this in the plugin.yml file

While your at it check out another plugin i made :D

Dodge Ball Spleef

http://dev.bukkit.or...odgeballspleef/

SimpleCommands.java
package me.TribalInstincts.SimpleCommands;

import java.util.logging.Logger;

import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;

public class SimpleCommands extends JavaPlugin{
	
	public final Logger log = Logger.getLogger("Minecraft");

	
	@Override 
	public void onEnable() {
		PluginDescriptionFile pluginDescriptionFile = this.getDescription();
		this.log.info("[" + pluginDescriptionFile.getName() + "]" + " version " + pluginDescriptionFile.getVersion() + " is enabled.");
	}
	
	@Override
	public void onDisable() {
		PluginDescriptionFile pluginDescriptionFile = this.getDescription();
		this.log.info("[" + pluginDescriptionFile.getName() + "]" + " is now Disabled.");
	}
	
	@Override 
	public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
		if(sender.hasPermission("SimpleCommands.GM")){ //checks if player has permission to use command. default is true. can change to false or op in plugin.yml
			Player player = (Player)sender;
			if(cmd.getName().equalsIgnoreCase("scgm")){
				if(player.getGameMode() == GameMode.SURVIVAL) {
					player.setGameMode(GameMode.CREATIVE);
					this.log.info("[SimpleCommands] Player: " + player.getDisplayName() + " has entered into Creative Mode");
					return true;
				} else {
					player.setGameMode(GameMode.SURVIVAL);
					this.log.info("[SimpleCommands] Player: " + player.getDisplayName() + " has entered into Survival Mode");
					return true;
				}
			}
		}
		return false;
	}
}

plugin.yml
name: SimpleCommands
main: me.TribalInstincts.SimpleCommands.SimpleCommands
version: 1.0
description: >
			 A stupidly simple tool for gamemode changes!
commands:
   scgm:
	  description: This command toggles your gamemode.
	  permission: SimpleCommands.GM
	  usage: /scgm
permissions:
	SimpleCommands.GM:
		description: This command toggles your gamemode.
		default: true

Savage Realms Survival Games
Website: http://www.sr-sg.net || Servers: 1.sr-sg.net through 20.sr-sg.net


#5

Kagelol2
    Kagelol2

    Out of the Water

  • Members
  • 4 posts

Posted 07 January 2012 - 06:43 PM

cool, thanks for all the replies guys.
i will try it out :)

i will let you know if im able to do so or not ^^

#6

evilmadness56

Posted 02 October 2012 - 04:57 PM

you can use rcon vis clanforge

#7

StealthBravo
    StealthBravo

    The Grim Reaperator

  • Sectional Moderator
  • 3465 posts
  • Location: Michigan
  • Minecraft: StealthBravo

Posted 02 October 2012 - 07:49 PM

If you can't figure out any of the other ones, MyCommand works well. It's very user friendly, so try it if you get a chance.

#8

NorthAntrim
  • Location: United Kingdom

Posted 02 October 2012 - 08:13 PM

CommandHelper is good for creating aliases, macros and your own commands using its scripting language.

PLEASE "Posted Image" WHEN REPLYING TO ME • USEFUL LINKS AND INFO:

Rules | Support | Minecraft Servers Status | MCF Help | Mojang Support Center

Posted Image


#9

Nentify
    Nentify

    Retired Staff

  • Retired Staff
  • Curse Premium
  • 1322 posts
  • Location: England
  • Minecraft: Nentify

Posted 02 October 2012 - 08:31 PM

View PostNorthAntrim, on 02 October 2012 - 08:13 PM, said:

CommandHelper is good for creating aliases, macros and your own commands using its scripting language.

I agree with this, also created by sk89q (probably mis-spelt that), so you can rely on it being updated etc. Allows you to do anything from simple aliases to complex commands.

Posted Image
#1 Tekkit Server:  MCF thread, Website


#10

NorthAntrim
  • Location: United Kingdom

Posted 02 October 2012 - 09:14 PM

View PostNentify, on 02 October 2012 - 08:31 PM, said:

I agree with this, also created by sk89q (probably mis-spelt that), so you can rely on it being updated etc. Allows you to do anything from simple aliases to complex commands.

Yeah, the aliases are super easy too. I've seen some people use it so they can move a new player to a member group, heal them, give them food and then TP them away from spawn, all from one command. I've used it for similar things myself.

The scripts are also pretty cool. I've made one before that set everyone survival when they joined after an admin made a few people creative but forgot who they were..

PLEASE "Posted Image" WHEN REPLYING TO ME • USEFUL LINKS AND INFO:

Rules | Support | Minecraft Servers Status | MCF Help | Mojang Support Center

Posted Image