Jump to content

Get info from server?


Crazeh

Recommended Posts

Hey everyone, long time user, first time poster. I am trying to make a mod that requires it get info from the server side, specifically, mcMMO, I want it to get the current levels of the current player, how can I achieve this?

 

And once I do have that info, I can just use 'println' where I want it, correct?

 

Thanks in advanced for any help provided. :)

Link to comment
Share on other sites

Okay, so here is what I have so far, this is the class that gets the info from the server via mysql, it only gets basic info at the moment to test -

package Zombie_Mod;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class ZScon 
{

public static void ZScon(String[] args) throws Exception
{
	Class.forName("com.mysql.jdbc.Driver");

	Connection con = DriverManager.getConnection("jdbc:mysql://localhost/mcmmo","root","root");

	PreparedStatement statement = con.prepareStatement("select * from mcmmo_users");

	ResultSet result = statement.executeQuery();

	while(result.next())
	{
		System.out.println(result.getString(1) + " " + result.getString(2));
	}
}
}

 

Few questions, in the MySQL database.

There is mcmmo_users which contains id,user,lastlogin

mcmmo_skills which contains id,taming,mining,woodcutting,ect (The current level)

mcmmo_experience which contains id,taming,mining,woodcutting,ect (The current XP)

 

How do I - look at mcmmo_users, match a user name to an ID, use that ID in skills to get the skill level, then experience to get experience?

 

I then want to print it like so - Mining(20) 120/1060

So that is - SkillName(SkillLevel) CurrentXP/TotalXP

 

Could someone help me with this? Im pretty new to actually making mods with Forge, not sure where to start really.

Link to comment
Share on other sites

Do you want to transfer the data to a connected Minecraft-Client? You can use the Custom Packet system for that.

 

Someone on IRC suggested I make a Bukkit plugin that handles the API and prints the info how I need it. Then said to use packets but didn't explain how or anything, where do I start with that?

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.