Minecraft / Bukkit Plugin Tutorials

Any help topics that don't fit in the current categories can go here.
Post Reply
User avatar
Samuel98
Posts: 46
Joined: Wed Oct 05, 2011 1:20 am
Location: United Kingdom
Contact:

Minecraft / Bukkit Plugin Tutorials

Post by Samuel98 »

Content deleted.
Last edited by Samuel98 on Sun Mar 22, 2015 9:31 pm, edited 3 times in total.
Image

Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Minecraft / Bukkit Plugin Tutorials

Post by jacek »

Getting the location would be possible from the IP, but it would not be that easy. The other things are pretty easy :) You can use the PLAYER_JOIN event for when people join the server and the PLAYER_QUIT event for when the leave. Then all you need to know how to do is send a message to everyone on the server.
plugin.getServer().broardcastMessage("What you want to say.");
Image
User avatar
Samuel98
Posts: 46
Joined: Wed Oct 05, 2011 1:20 am
Location: United Kingdom
Contact:

Re: Minecraft / Bukkit Plugin Tutorials

Post by Samuel98 »

Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:32 pm, edited 1 time in total.
Image

Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Minecraft / Bukkit Plugin Tutorials

Post by jacek »

Well you can get the IP if you have the player which you do from the event
Player player = event.getPlayer();
and then you can use getAddress() which will give you the IP, and the port I think.

Yo get the location you will then need some kind of geolocation database, I have used this one before which seems to work nicely.

For the command

[syntax]/i ITEM-ID AMOUNT[/syntax]
The command is /i and the other bits are arguments, they are stored in the args[] parameter from the onCommand() method.

Oh, to get the list of online players you can do
Player[] players = plugin.getServer().getOnlinePlayers()
so to loop over all players and output the list as a list
for (Player player : plugin.getServer().getOnlinePlayers()){
	plugin.getServer().broadcastMessage(player.getName());
}
Image
User avatar
Samuel98
Posts: 46
Joined: Wed Oct 05, 2011 1:20 am
Location: United Kingdom
Contact:

Re: Minecraft / Bukkit Plugin Tutorials

Post by Samuel98 »

Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:32 pm, edited 1 time in total.
Image

Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
User avatar
Samuel98
Posts: 46
Joined: Wed Oct 05, 2011 1:20 am
Location: United Kingdom
Contact:

Re: Minecraft / Bukkit Plugin Tutorials

Post by Samuel98 »

Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:32 pm, edited 1 time in total.
Image

Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Minecraft / Bukkit Plugin Tutorials

Post by jacek »

You can disable that somehow, the plugin Essentials does it somehow. Basically, I don't know. But look at the source of a plugin that does it already.
Image
User avatar
Samuel98
Posts: 46
Joined: Wed Oct 05, 2011 1:20 am
Location: United Kingdom
Contact:

Re: Minecraft / Bukkit Plugin Tutorials

Post by Samuel98 »

Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:32 pm, edited 1 time in total.
Image

Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
User avatar
Samuel98
Posts: 46
Joined: Wed Oct 05, 2011 1:20 am
Location: United Kingdom
Contact:

Re: Minecraft / Bukkit Plugin Tutorials

Post by Samuel98 »

Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:33 pm, edited 1 time in total.
Image

Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
User avatar
Samuel98
Posts: 46
Joined: Wed Oct 05, 2011 1:20 am
Location: United Kingdom
Contact:

Re: Minecraft / Bukkit Plugin Tutorials

Post by Samuel98 »

Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:33 pm, edited 1 time in total.
Image

Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Minecraft / Bukkit Plugin Tutorials

Post by jacek »

I don't know really, this page can do IP to country http://www.ip2nation.com/ip2nation but I don't really know how best to do it in Java as a plugin.
Image
Post Reply