Login to ZARP
Username: Password: Remember me

TOPIC: Java Coding CraftBukkit // Minecraft

Java Coding CraftBukkit // Minecraft 7 years 11 months ago #335133





Hello today i'm going to do a tutorial of how to make a Minecraft Bukkit Plugin with java coding a few easy Lines this tutorial is for people who are interesting to code java/Plugin for minecraft! and might play minecraft im going to show a few steps!

This tutorial is about a easy command with GameMode You turn on Gamemode and turn of it!


- - [Step 1] First of all you need a good program to code java in I recommend Eclipse

- Download LINK HERE Eclipse

- Download Eclipse JAVA Direkt Link Eclipse


- - [Step 2] After you installed Eclipse it's time to create a java Project! with Java Packet and a Java Class

Warning: Spoiler! [ Click to expand ]




- - [Step 3] Before we start to code we need to add Bukkit to our library so our code understand we talking about minecraft code !


Warning: Spoiler! [ Click to expand ]




- - [Step 4] Now it's time to code we going to code a few simple lines witch is easy to understand!

This is a start of how it we will build on!



We start on "public void onEnabled() " This code mean by if you start up the server all plugins on the server will load and this message will come/print out on the console!
	public void onEnabled() {	
		getLogger().info("This Plugin have been enabled!  v1.1 "); // This mean you get a message in the console this plugin have been enabled!
							  // if the Plugin work fine if the plugin not working nothing will show in the console!	
	}






If we look on this code "public void onDisabled()" if we do /stop in the console or ingame the server will stop and the plugin print out this message before the console close
	public void onDisabled() {
		getLogger().info("This plugin have been Disabled! v1.1"); // This mean the plugin have been disabled when you
																		// shuting down the server with command /stop		
	}






- - [Step 5] Now it's time to code the command /command

We start with this code Line!
	
	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {



Then the second line who is important for the code
This mean if a player type /gm it will turn on gamemode witch is Creative! "instanceof" means only a player can do it!
		
		if (cmd.getName().equalsIgnoreCase("gm") && sender instanceof Player) {
			
			Player player = (Player) sender;


Now we going to look how the function work when you typ this command ingame!
The function here is player.setGameMode(GameMode.CREATIVE); This mean only a person/player doing this function!
			player.setGameMode(GameMode.CREATIVE);
			player.sendMessage(ChatColor.GREEN + "This command is working fine!");
			
			return true;

Now we going to add a second command witch is we turn off this gamemode this turn off gameode and end of the code!

		} else if (cmd.getName().equalsIgnoreCase("gms") && sender instanceof Player) {
			
			
			Player player = (Player) sender;
			
			player.setGameMode(GameMode.SURVIVAL);
			player.sendMessage(ChatColor.RED + "Now have you turned of GameMode!");
			
			
			return true;
			
			
			
		}
		return false;
		
	}


- - [Step 6] Now should the code looks like this



Warning: Spoiler! [ Click to expand ]



- - [Step 7] Now it's time to create a plugin.yml


Warning: Spoiler! [ Click to expand ]




- - [Step 8] Now it's time to export this to a java plugin!


First of all we need to refresh first
Warning: Spoiler! [ Click to expand ]


then you put the plugin in your plugin folder in the server folder!

then you try out the command!


- - [Step 9] Time to try these command ingame!

If you type /gm this message will come out and you will get GameMode



If you type /gms this message will come out and you turn off GameMode




Don't forget to give it a thank you i hope you like my tutorial!
  • vitx
  • vitx's Avatar
  • Offline
  • Expert Boarder
  • ZARP VIP Golden Blue Badge
  • Posts: 1015
  • Thanks received: 308
  • Karma: -36
Last Edit: 7 years 11 months ago by vitx.
Login or register to post a reply.
The following user(s) said Thank You: ImTooFastForYou

Java Coding CraftBukkit // Minecraft 7 years 11 months ago #335135

can i have op pls
  • spodermon
  • spodermon's Avatar
  • Offline
  • Diamond Boarder
  • ZARP VIP
  • heyyyy
  • Posts: 4531
  • Thanks received: 1394
  • Karma: 18
bestest ex ssrp super admin


e
Login or register to post a reply.

Java Coding CraftBukkit // Minecraft 7 years 11 months ago #335137

Sorry of the spelling HEHE OFF*
  • vitx
  • vitx's Avatar
  • Offline
  • Expert Boarder
  • ZARP VIP Golden Blue Badge
  • Posts: 1015
  • Thanks received: 308
  • Karma: -36
Login or register to post a reply.

Java Coding CraftBukkit // Minecraft 7 years 11 months ago #335154

Nice guide !
  • ImTooFastForYou
  • ImTooFastForYou's Avatar
  • Offline
  • Legendary Member
  • ZARP VIP
  • Be #Kyber4PHSO
  • Posts: 2325
  • Thanks received: 627
  • Karma: 5

Ex Deathrun Head Administrator
Ex Prop Hunt Super Administrator
Ex Forum Report Abuse Section Moderator
Ex TeamSpeak Staff
Ex Discord Admin
Ex TTT Administrator
My Steam !
Login or register to post a reply.
The following user(s) said Thank You: vitx, Reuben45

Java Coding CraftBukkit // Minecraft 7 years 11 months ago #335159

@guerrier33


Thank you i'm going to make more tutorial about java coding in minecraft!
  • vitx
  • vitx's Avatar
  • Offline
  • Expert Boarder
  • ZARP VIP Golden Blue Badge
  • Posts: 1015
  • Thanks received: 308
  • Karma: -36
Login or register to post a reply.
The following user(s) said Thank You: ImTooFastForYou

Java Coding CraftBukkit // Minecraft 7 years 11 months ago #335195

You ahould make a tutorial of how to port forward like this
  • Jugger
  • Jugger's Avatar
  • Offline
  • Gold Boarder
  • ZARP VIP Gold Badge
  • Posts: 1882
  • Thanks received: 289
  • Karma: -67
Login or register to post a reply.

Java Coding CraftBukkit // Minecraft 7 years 11 months ago #335199

Jugger wrote:
You ahould make a tutorial of how to port forward like this

open your router interface (in your browser) which is most likely on http://192.168.1.1 and just find the Port Forwarding tab (Not all routers can port forward). Then add a new port 25565. Now edit your minecraft server configurations and set the ip to your IPV4 adress. In my case its 192.168.1.2. You can find yours by opening CMD.



Now simply write ipconfig and press enter



Now you should have a big list of IP addreses. Look for your ipv4 addres that starts with 192.168!
Right click > Mark > Select the ip addres > Press enter and it should be copied to your clipboard.
Put this IP into your server configurations.

Now your friends should be able to join through another ip which you can find at a variety of websites such as www.ipchicken.com

Keep in mind that this will not work if you are using a LAN connection as far as i know!

If you want to check if the port is open go to www.yougetsignal.com/tools/open-ports/
Replace port 80 with 25565 and it will display a message telling you if the port is forwarded.
  • Codeah
  • Codeah's Avatar
  • Offline
  • Senior Boarder
  • ZARP VIP
  • Oblivion
  • Posts: 486
  • Thanks received: 169
  • Karma: 3
Last Edit: 7 years 11 months ago by Codeah.
Login or register to post a reply.
The following user(s) said Thank You: Jugger

Java Coding CraftBukkit // Minecraft 7 years 11 months ago #335271

To open ports in minecraft is pretty basic and really easy in a few step you have a minecraft server it take like 2-5 min!


Step 1

Get up your CMD/Command Console!



Then you TYP ipconfig in your CMD console!





Then you going to use the ip i MARKED with RED line
Defualt Gateway!




Minecraft port : 25565-25566


I could make longer tutorial but i need to play king of the hill on zarp XD
  • vitx
  • vitx's Avatar
  • Offline
  • Expert Boarder
  • ZARP VIP Golden Blue Badge
  • Posts: 1015
  • Thanks received: 308
  • Karma: -36
Login or register to post a reply.

Java Coding CraftBukkit // Minecraft 7 years 11 months ago #335272

Well just saying, there's a easier way for this,

Find your essentials.
And make a messages.properties file.

Therefore looks like this:


Inside that file just edit the following:

Warning: Spoiler! [ Click to expand ]


Then just CTRL+F Find Gamemode and edit it;

minecraft.tools/en/color-code.php - Here are all the Minecraft colour codes.

And you can do this for any other command! :D
  • Jackelele
  • Jackelele's Avatar
  • Offline
  • Expert Boarder
  • ZARP VIP
  • I'm a green ting.
  • Posts: 1212
  • Thanks received: 174
  • Karma: -5
Login or register to post a reply.

Java Coding CraftBukkit // Minecraft 7 years 11 months ago #335320

Good guy vitx for making this good guide thank him bitches
  • FluffyOP
  • FluffyOP's Avatar
  • Offline
  • Senior Boarder
  • ZARP VIP
  • Nade,Vitx,Aspect Simon&Hermoine,Plankton
  • Posts: 574
  • Thanks received: 148
  • Karma: -6
Ex-MC Owner and developer
Old, old Ex-SSRP staff
Ex-TS staff
Hermoine <3
Login or register to post a reply.

Java Coding CraftBukkit // Minecraft 7 years 11 months ago #335321

YOUR REALLY REALLY GOOD MAN

CAN I JOIN YOUR GANG?
XOXO
DO U HAVE A TS ? I WANT TO TALK WITH YOU MAN
  • Reuben45
  • Reuben45's Avatar
  • Offline
  • User is blocked
  • ZARP VIP
  • Posts: 17
  • Thanks received: 3
  • Karma: 0
Login or register to post a reply.

Java Coding CraftBukkit // Minecraft 7 years 11 months ago #335322

Reuben45 wrote:
YOUR REALLY REALLY GOOD MAN

CAN I JOIN YOUR GANG?
XOXO
DO U HAVE A TS ? I WANT TO TALK WITH YOU MAN


I'm on zarp teamspeak server now ts.zarpgaming.com
  • vitx
  • vitx's Avatar
  • Offline
  • Expert Boarder
  • ZARP VIP Golden Blue Badge
  • Posts: 1015
  • Thanks received: 308
  • Karma: -36
Login or register to post a reply.

Java Coding CraftBukkit // Minecraft 7 years 11 months ago #335366

For future tutorials you should include more information about what you're changing and adding. Simply having people follow directions wont teach them much unless they already know how to code and they understand what the current code is doing.
  • Legendary Soldier
  • Legendary Soldier's Avatar
  • Offline
  • Former Community Manager
  • ZARP VIP Gold Badge
  • Still alive bois
  • Posts: 2602
  • Thanks received: 1431
  • Karma: 61
Former Community Manager - Current Bartender
Login or register to post a reply.
The following user(s) said Thank You: Jackelele, ParaMontana
Time to create page: 0.159 seconds

131 PLAYERS ONLINE

Connect to server View Gametracker DarkRP 1
5/127
online
Connect to server View Gametracker Deathrun
0/40
online
Connect to server View Gametracker TTT
0/47
online
Connect to server View Gametracker Bhop
0/32
online
Connect to server View Gametracker Surf
3/32
online
Connect to server View Gametracker Prop Hunt
0/42
online
Connect to server View Gametracker Sandbox
0/42
online
Connect to server Discord
123/787
online
Top