Made Writer.hardWrite

This commit is contained in:
alisolarflare 2017-04-01 08:12:01 -04:00
parent 237af2d973
commit 26c6b83c30
6 changed files with 78 additions and 16 deletions

View file

@ -2,3 +2,6 @@ main: buttondevteam.minecraft.Main
name: PlaceMinecraft
version: 0.0.1
commands:
place:
description: Testing Methods for the Place Plugin

View file

@ -4,6 +4,8 @@ import java.util.logging.Logger;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.minecraft.place.Place;
public class Main extends JavaPlugin{
@ -13,7 +15,7 @@ public class Main extends JavaPlugin{
Logger logger = getLogger();
logger.info(pdfFile.getName() + " has been started (V." + pdfFile.getVersion()+ ").");
new Place().register(this);
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");

View file

@ -1,5 +1,15 @@
package buttondevteam.minecraft.place;
public class Place {
}
package buttondevteam.minecraft.place;
import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.architecture.Component;
import buttondevteam.minecraft.place.commands.Cube;
public class Place extends Component{
@Override
public void register(JavaPlugin plugin) {
this.registerCommand(plugin, new Cube());
}
}

View file

@ -1,5 +1,5 @@
package buttondevteam.minecraft.place;
public class Reader {
}
package buttondevteam.minecraft.place;
public class Reader {
}

View file

@ -1,5 +1,29 @@
package buttondevteam.minecraft.place;
public class Writer {
}
package buttondevteam.minecraft.place;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
public class Writer {
public static int cubeSize = 4;
public static void hardWrite(Location location, Material material){
writeCube(
location.getBlockX() - location.getBlockX() % cubeSize,
location.getBlockY(),
location.getBlockZ() - location.getBlockZ() % cubeSize,
location.getWorld(),
material);
}
public static void writeCube(int x, int y, int z, World world, Material material){
for(int i = 0; i > cubeSize; i++){
for (int j = 0; j > cubeSize; j++){
for(int k = 0; k > cubeSize; k++){
world.getBlockAt(x + i, y + j, z + k).setType(material);
}
}
}
}
}

View file

@ -0,0 +1,23 @@
package buttondevteam.minecraft.place.commands;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import buttondevteam.architecture.commands.ModCommand;
import buttondevteam.minecraft.place.Writer;
//Tests the Writer's hardWrite method
public class Cube extends ModCommand{
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
Writer.hardWrite(player.getLocation(), Material.LEAVES);
return true;
}
@Override
public String GetCommandPath() {
return "place cube";
}
}