EvilSadness Posted May 3, 2015 Share Posted May 3, 2015 Hallo miteinander ich habe jetzt angefangen ein kleines Plugin zu programmieren nur habe ich leider immer wieder 7 Fehler die ich nicht wegbekomme. package main;import java.util.ArrayList;import org.bukkit.Bukkit;import org.bukkit.Material;import org.bukkit.scheduler.*;import org.bukkit.command.Command;import org.bukkit.command.CommandSender;import org.bukkit.enchantments.Enchantment;import org.bukkit.entity.EntityType;import org.bukkit.entity.Player;import org.bukkit.event.EventHandler;import org.bukkit.event.Listener;import org.bukkit.event.entity.EntityDamageByEntityEvent;import org.bukkit.inventory.ItemStack;import org.bukkit.inventory.meta.ItemMeta;import org.bukkit.plugin.java.JavaPlugin;public class t extends JavaPlugin implements Listener{ @Override public void onEnable() { Bukkit.getPluginManager().registerEvents(this, this); System.out.println("?3 Taser geladen"); } @Override public void onDisable() { System.out.println("?c Taser gestoppt"); } public boolean onCommand(CommandSender sender, Command cmd, String cmdlabel, String[] args) { Player p = (Player) sender; if(cmd.getName().equalsIgnoreCase("taser")){ if(p.hasPermission("taser.l")){ ItemStack item = new ItemStack(Material.LEASH); ItemMeta meta = item.getItemMeta(); meta.setDisplayName("?6Taser"); ArrayList<String> lore = new ArrayList<>(); lore.add("?6 Taste It !"); meta.setLore(lore); item.setItemMeta(meta); p.getInventory().setItem(5 , item); } } return true;} } @EventHandler public void onDamage(EntityDamageByEntityEvent e) { if(e.getDamager().getType() == EntityType.PLAYER && e.getItem().getType() == Material.LEASH) { ItemStack item = e.getItem(); ItemMeta item_meta = item.getItemMeta(); if(e.getItemMeta().getName().equals("?6Taser")) { final Player player = e.getPlayer(); final float oldWalkSpeed = player.getWalkSpeed(); player.setWalkSpeed(0F); Bukkit.getScheduler().runTaskLater(this, new Runnable() { @Override public void run() { player.setWalkSpeed(oldWalkSpeed ,5*20L); } ; ] } } Und hier die Fehler: Description Resource Path Location Type Syntax error on token "}", delete this token t.java /Taser/src/main line 67 Java Problem Syntax error, insert ";" to complete Statement t.java /Taser/src/main line 85 Java Problem Syntax error, insert ")" to complete MethodInvocation t.java /Taser/src/main line 85 Java Problem Syntax error, insert "}" to complete ClassBody t.java /Taser/src/main line 65 Java Problem Syntax error, insert "}" to complete ClassBody t.java /Taser/src/main line 85 Java Problem The method getItem() is undefined for the type EntityDamageByEntityEvent t.java /Taser/src/main line 73 Java Problem The method getPlayer() is undefined for the type EntityDamageByEntityEvent t.java /Taser/src/main line 77 Java Problem Könnte mir jemand helfen diese zu beheben ? Mfg EvilSadness Link to comment Share on other sites More sharing options...
Headshooter Posted May 3, 2015 Share Posted May 3, 2015 (edited) Hast wahrscheinlich irgendwo ein '}(und ; )' vergesen, welches dann eine "Kettenreaktion" auslöst.Bei den letzten 2 Fehler, weiß ich nicht was man da machen könnte... EDIT: Von unten, die 3 Zeile: wieso steht da ein ']' ? Edited May 3, 2015 by Headshooter Link to comment Share on other sites More sharing options...
Arcalio Posted May 4, 2015 Share Posted May 4, 2015 1. Überprüfe deine Klammern! Da ist/sind ein/mehrere Fehler... 2. EntityDamageByEntityEvent besitzt keine Methoden getItem() oder getPlayer(). Du musst dort allgemeinere Methoden nehmen und die dann casten. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now