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:
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.