Made Writer.hardWrite
This commit is contained in:
parent
237af2d973
commit
26c6b83c30
6 changed files with 78 additions and 16 deletions
|
@ -2,3 +2,6 @@ main: buttondevteam.minecraft.Main
|
||||||
name: PlaceMinecraft
|
name: PlaceMinecraft
|
||||||
version: 0.0.1
|
version: 0.0.1
|
||||||
|
|
||||||
|
commands:
|
||||||
|
place:
|
||||||
|
description: Testing Methods for the Place Plugin
|
|
@ -4,6 +4,8 @@ import java.util.logging.Logger;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import buttondevteam.minecraft.place.Place;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class Main extends JavaPlugin{
|
public class Main extends JavaPlugin{
|
||||||
|
@ -13,7 +15,7 @@ public class Main extends JavaPlugin{
|
||||||
Logger logger = getLogger();
|
Logger logger = getLogger();
|
||||||
logger.info(pdfFile.getName() + " has been started (V." + pdfFile.getVersion()+ ").");
|
logger.info(pdfFile.getName() + " has been started (V." + pdfFile.getVersion()+ ").");
|
||||||
|
|
||||||
|
new Place().register(this);
|
||||||
|
|
||||||
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");
|
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
package buttondevteam.minecraft.place;
|
package buttondevteam.minecraft.place;
|
||||||
|
|
||||||
public class 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());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,5 +1,29 @@
|
||||||
package buttondevteam.minecraft.place;
|
package buttondevteam.minecraft.place;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
public class Writer {
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue