Jump to content

Hast du schon das Minecraftforum.de-Gütesiegel gesehen? Hier kommst du dorthin!

Fabi1309

User
  • Gesamte Inhalte

    1
  • Benutzer seit

  • Letzter Besuch

Reputation in der Community

0 Noch unbekannt

Über Fabi1309

  • Rang
    Neuling
  1. Fabi1309

    Blöcke von 2 positionen speichern

    Hey, ein bisschen spät, aber habe das gesehen und dachte ich antworte noch. package io.github.fabi1309.first.commands; import java.util.HashMap; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.util.Vector; import io.github.fabi1309.first.Main; public class Test implements CommandExecutor{ private final Main plugin; public Test(Main plugin) { this.plugin = plugin; } public static HashMap<Integer, Location> locations = new HashMap<Integer, Location>(); public boolean onCommand(CommandSender sender, Command cmd, String cmdLable, String[] args) { if(cmd.getName().equalsIgnoreCase("test")) { Location loc1 = new Location(sender.getServer().getWorld("world"), 0, 0, 0); Location loc2 = new Location(sender.getServer().getWorld("world"), 0, 0, 0); if(args.length == 0) { Player p = (Player) sender; p.sendMessage("Test"); return true; } if(args.length == 1 && args[0].equalsIgnoreCase("1")) { Player p = (Player) sender; loc1 = p.getLocation(); loc1.add(new Vector(0, -1, 0)); p.sendMessage(loc1.toString()); locations.put(1, loc1); return true; } if(args.length == 1 && args[0].equalsIgnoreCase("2")) { Player p = (Player) sender; loc2 = p.getLocation(); loc2.add(new Vector(0, -1, 0)); p.sendMessage(""); locations.put(2, loc2); return true; } if(args.length == 1 && args[0].equalsIgnoreCase("3")) { Vector vec = new Vector(locations.get(2).getBlockX() - locations.get(1).getBlockX(),locations.get(2).getBlockY() - locations.get(1).getBlockY(),locations.get(2).getBlockZ() - locations.get(1).getBlockZ()); double vecl = vec.length(); Vector vecU = vec.multiply(0.5/vecl); for(double i=0; i <= vecl;i=i+0.5) { Location USE = locations.get(1).add(vecU); USE.getBlock().setType(Material.DIAMOND_BLOCK); locations.put(1, USE); //Add to array but check if loc already in there } return true; } return false; } return false; } } Bei Fragen kannst du mir gerne n PN schreiben oder einfach hier antworten. Fabi1309
×