Minecraft / Bukkit Plugin Tutorials
Minecraft / Bukkit Plugin Tutorials
Content deleted.
Last edited by Samuel98 on Sun Mar 22, 2015 9:31 pm, edited 3 times in total.
Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
Re: Minecraft / Bukkit Plugin Tutorials
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.
[syntax=java]plugin.getServer().broardcastMessage("What you want to say.");[/syntax]
[syntax=java]plugin.getServer().broardcastMessage("What you want to say.");[/syntax]
Re: Minecraft / Bukkit Plugin Tutorials
Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:32 pm, edited 1 time in total.
Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
Re: Minecraft / Bukkit Plugin Tutorials
Well you can get the IP if you have the player which you do from the event
[syntax=java]Player player = event.getPlayer();[/syntax]
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
[syntax=java]Player[] players = plugin.getServer().getOnlinePlayers()[/syntax]
so to loop over all players and output the list as a list
[syntax=java]for (Player player : plugin.getServer().getOnlinePlayers()){
plugin.getServer().broadcastMessage(player.getName());
}[/syntax]
[syntax=java]Player player = event.getPlayer();[/syntax]
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
[syntax=java]Player[] players = plugin.getServer().getOnlinePlayers()[/syntax]
so to loop over all players and output the list as a list
[syntax=java]for (Player player : plugin.getServer().getOnlinePlayers()){
plugin.getServer().broadcastMessage(player.getName());
}[/syntax]
Re: Minecraft / Bukkit Plugin Tutorials
Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:32 pm, edited 1 time in total.
Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
Re: Minecraft / Bukkit Plugin Tutorials
Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:32 pm, edited 1 time in total.
Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
Re: Minecraft / Bukkit Plugin Tutorials
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.
Re: Minecraft / Bukkit Plugin Tutorials
Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:32 pm, edited 1 time in total.
Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
Re: Minecraft / Bukkit Plugin Tutorials
Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:33 pm, edited 1 time in total.
Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
Re: Minecraft / Bukkit Plugin Tutorials
Content Deleted
Last edited by Samuel98 on Sun Mar 22, 2015 9:33 pm, edited 1 time in total.
Samuel Carr
Server Developer
W: http://epiccrafts.co.uk
E: [url]mailto://samuel.carr@epiccrafts.co.uk[/url]
Re: Minecraft / Bukkit Plugin Tutorials
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.