T
TobsA13
Gast
Hallo liebe Java-Freunde und Entwickler,
ich versuche mich gerade an meinen ersten Bukkit-plugin(jetzt bitte nicht gleich wieder nerven, ich soll das in ein MC-Forum schreiben, ich denk das das Problem ehr ein Java Problem von mir ist). Mein Problem ist folgendesgesamter Quellcode ist am Ende des Threades) Das in [JAVA=44]boolean redfind = false;[/code] die boolean redfind als nicht genutzt angezeigt wird, obwohl sie in Zeile 45 und 50 benutzt wird. Wisst ihr vielleicht an was das liegen kann oder hab ihr ne Lösung. Ich bin für jede Hilfe dankbar.
Mit freundlichen Grüßen,
Tobias Albert
ich versuche mich gerade an meinen ersten Bukkit-plugin(jetzt bitte nicht gleich wieder nerven, ich soll das in ein MC-Forum schreiben, ich denk das das Problem ehr ein Java Problem von mir ist). Mein Problem ist folgendesgesamter Quellcode ist am Ende des Threades) Das in [JAVA=44]boolean redfind = false;[/code] die boolean redfind als nicht genutzt angezeigt wird, obwohl sie in Zeile 45 und 50 benutzt wird. Wisst ihr vielleicht an was das liegen kann oder hab ihr ne Lösung. Ich bin für jede Hilfe dankbar.
Mit freundlichen Grüßen,
Tobias Albert
Java:
package me.TobsA13.RedstoneSG;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
//import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
public class RedstoneSG extends JavaPlugin {
@Override
public void onDisable() {
System.out.println("[RedstoneSG] Plugin deaktiviert!");
}
@Override
public void onEnable() {
loadConfig();
PluginDescriptionFile descFile = this.getDescription();
System.out.println("[RedstoneSG] Plugin by " + descFile.getAuthors() + " !");
System.out.println("[RedstoneSG] Version:" + descFile.getVersion());
System.out.println("[RedstoneSG] Plugin aktiviert!");
}
public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) {
org.bukkit.World welt = getServer().getWorld(args[0]);
boolean erfolg = false;
int cordX = this.getConfig().getInt("config.memory.koordinaten.red.x");
int cordZ = this.getConfig().getInt("config.memory.koordinaten.red.z");
int cordXa = this.getConfig().getInt("config.memory.koordinaten.air.x");
int cordZa = this.getConfig().getInt("config.memory.koordinaten.air.z");
int cordYf = 0;
if(cmd.getName().equalsIgnoreCase("redstonesg")){
// if((sender instanceof Player)) {
if(args.length == 1) {
boolean redfind = false;
while(redfind = false) {
Location locf = new Location(welt, cordX, cordYf, cordZ);
cordYf = 1 + cordYf;
Block blockf = locf.getBlock();
if(blockf.getType() == Material.REDSTONE_WIRE);
redfind = true;
}
}
Location loc = new Location(welt, cordX, cordYf, cordZ);
Block block = loc.getBlock();
block.setType(Material.REDSTONE_TORCH_ON);
Location loca = new Location(welt, cordXa, cordYf + 2, cordZa);
Block blocka = loca.getBlock();
blocka.setType(Material.AIR);
System.out.println("[RedstoneSG] SG Welt berarbeitet!");
erfolg = true;
}
else {
System.out.println("[RedstoneSG] Argumente!");
erfolg = false;
}
return erfolg;
}
// }
// }
// else {
// if(args.length <= 3) {
// p.sendMessage(ChatColor.RED + "[Grundlage]" + ChatColor.LIGHT_PURPLE + "Zu wenig Argumente");
// erfolg = false;
// }
// if(args.length >= 5) {
// p.sendMessage(ChatColor.RED + "[Grundlage]" + ChatColor.LIGHT_PURPLE + "Zu viel Argumente");
// erfolg = false;
// }
// if(args.length == 4) {
//
// Location loc = new Location(welt, cordX, cordY, cordZ);
// Block block = loc.getBlock();
// block.setType(Material.REDSTONE_TORCH_ON);
// erfolg = true;
// }
private void loadConfig(){
String redx ="config.memory.koordinaten.red.x";
this.getConfig().addDefault(redx, 0);
String redy ="config.memory.koordinaten.red.y";
this.getConfig().addDefault(redy, 0);
String redz ="config.memory.koordinaten.red.z";
this.getConfig().addDefault(redz, 0);
String airx ="config.memory.koordinaten.air.x";
this.getConfig().addDefault(airx, 0);
String airy ="config.memory.koordinaten.air.y";
this.getConfig().addDefault(airy, 0);
String airz ="config.memory.koordinaten.air.z";
this.getConfig().addDefault(airz, 0);
this.getConfig().options().copyDefaults(true);
this.saveConfig();
}
}