Results 1 to 3 of 3
  1. #1
    Musaddict's Avatar
    Musaddict is offline Member
    Join Date
    Aug 2011
    Posts
    6
    Rep Power
    0

    Question Im new, please help (adding data points to a text document, to be retreived later)

    Ok, so to start, I'll say that I'm programming for Bukkit (Minecraft Server Mod) so if any of you know more specifically how to help me there, then awesome!

    So, there are 3 things that I need to store in a text document:
    • Location of a certain block
    • what color the block is
    • a user defined location

    I would be storing these things by using a command. Right now I have my error/success messages set up:
    Java Code:
    public void onBlockPlace(BlockPlaceEvent event) {
    		Player player = event.getPlayer();
    		Block block = event.getBlock();
    		Block [COLOR="blue"]belowBlock = event.getBlock().getLocation().subtract(0.0, 1.0, 0.0)[/COLOR].getBlock();
    		if (block.getType().equals(Material.WOODEN_DOOR) && belowBlock.getType().equals(Material.WOOL)) {
    			player.sendMessage("You have placed a door on a " + [COLOR="red"]DyeColor.getByData(belowBlock.getData()).toString().toLowerCase()[/COLOR] + " colored cloth block");
    			} else {
    				if (block.getType().equals(Material.WOODEN_DOOR) && !(belowBlock.getType().equals(Material.WOOL))) {
    					player.sendMessage("That is not a valid place for a ColorKey door");
    			} else {
    				if (!(block.getType().equals(Material.WOODEN_DOOR))) {}
    			}
    			}
    			
    	}
    to help know what I want, I would enter the command "/ck create [location]", and it would store the DyeColor and the location of belowBlock under a section with the [location] as the heading, so the format of the text file should be:

    [Location1]
    [DyeColor1]: [Location1]
    [DyeColor2]: [Location2]
    [Location2]
    [DyeColor1]: [Location1]
    [DyeColor2]: [Location2]

    So if I used the command with a red block, and a green block, both with the location "Spawn", then the text file should read:

    Spawn
    Red: x, y, z
    Green: x, y, z

    If at all possible, the file will be saved in a folder with the same name as the .jar file, in the same folder as the .jar file :P so if the jar is c:\server\plugins\myplugin.jar, then the text file would be c:\server\plugins\myplugin\text.txt

    Any help for pointing me in the right direction? (or providing a sample code that I could mess with)

    Big question, lol. Can any of you help? Ive been stuck on this for a week now even after watching like 75 java videos on youtue and reading many forums.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    the file will be saved in a folder with the same name as the .jar file,
    Have you tried writing a file from a class in a jar file? Did it go where you wanted?

    Do you have any code that formats and writes your file? And also the code for reading the file.
    Please post it.

  3. #3
    Musaddict's Avatar
    Musaddict is offline Member
    Join Date
    Aug 2011
    Posts
    6
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    Have you tried writing a file from a class in a jar file? Did it go where you wanted?

    Do you have any code that formats and writes your file? And also the code for reading the file.
    Please post it.
    sorry for not replying, i got it figured out. Thanks anyway!

Similar Threads

  1. Replies: 1
    Last Post: 08-11-2011, 10:46 AM
  2. Anyone know .wav data points endian format?
    By Krooger in forum New To Java
    Replies: 1
    Last Post: 12-24-2010, 09:40 AM
  3. Importing text into a word document
    By Frys82 in forum AWT / Swing
    Replies: 5
    Last Post: 08-24-2009, 08:41 PM
  4. Replies: 0
    Last Post: 11-07-2008, 01:11 PM
  5. Replies: 2
    Last Post: 08-24-2008, 12:30 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •