Auf Thema antworten

Hallo! Ich habe ein Problem mit meinem Plugin. Ich habe ein Plugin gemacht, mit dem man einen Warp machen/löschen/tpn kann mit folgenden Befehlen:


/tevent (Event)

/tsetevent (Event)

/tdelevent (Event)

(Event = Warp)



Nun hab ich aber das Problem, dass mir nur /tdelevent in Minecraft angezeigt wird.[ATTACH=full]13202[/ATTACH]


Laut Console scheint es etwas in Main zu sein:

[ATTACH=full]13203[/ATTACH]


Aber ich verstehe nicht was ich in Main bei /tdelevent anders gemacht habe als bei den anderen..


Hier sind meine Quellcodes für alle Dateien die im Plugin sind:


EventFunction:

[CODE=java]package EventFunc;


import java.io.File;

import java.io.IOException;


import org.bukkit.Bukkit;

import org.bukkit.Location;

import org.bukkit.configuration.file.FileConfiguration;

import org.bukkit.configuration.file.YamlConfiguration;

import org.bukkit.entity.Player;


public class EventFunction{

    public static String speicherort = "plugins/TaMoBiDa's Events/Events";

   

    public static void CheckOrdner() {

        File file = new File("speicherort");

        if(file.isDirectory()==false)file.mkdirs();

    }


    public static void SetTEvent (Player p, String EventName) throws IOException{

        File file = new File("plugins/TaMoBiDa's Events/Events", EventName.toLowerCase()+".yml");

        EventFunction.CheckOrdner();

        if(!file.exists()) {

           

            file.createNewFile();

            FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);

            cfg.set("Location.X", p.getLocation().getX());

            cfg.set("Location.Y", p.getLocation().getY());

            cfg.set("Location.Z", p.getLocation().getZ());

            cfg.set("Location.Yaw", p.getLocation().getYaw());

            cfg.set("Location.Pitch", p.getLocation().getPitch());

            cfg.set("Location.World", p.getWorld().getName());

            cfg.save(file);

           

        }else {

            p.sendMessage("§4Fehler: §cDieses Event existiert bereits!");

            return;

        }


    }

   

    public static void DelTEvent (Player p, String EventName){

        File file = new File("plugins/TaMoBiDa's Events/Events", EventName.toLowerCase()+".yml");

        if(!file.exists()) {

            file.delete();

        }

        p.sendMessage("§4Fehler: §cDieses Event existiert nicht!");

    }

   

    public static void TEvent (Player p, String EventName){

        File file = new File("plugins/TaMoBiDa's Events/Events", EventName.toLowerCase()+".yml");

        if(!file.exists()) {

            p.sendMessage("§4Fehler: §cDieses Event existiert nicht!");

           

        }

        FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);  

        double x = cfg.getDouble("Location.X");

        double y = cfg.getDouble("Location.Y");

        double z = cfg.getDouble("Location.Z");

        float yaw = (float) cfg.getDouble("Location.Yaw");

        float pitch = (float) cfg.getDouble("Location.Ptch");

        String worldname = cfg.getString("Location.World");

       

        Location loc = p.getLocation();

        loc.setX(x);

        loc.setX(y);

        loc.setX(z);

        loc.setX(yaw);

        loc.setX(pitch);

        loc.setWorld(Bukkit.getWorld(worldname));

       

        p.teleport(loc);

        p.sendMessage("$6Du hast dich zu dem Event §c"+ EventName + "$6teleportiert!");

       

    }

   

}



[/CODE]


EventCommands

[CODE=java]package EventCom;


import java.io.IOException;


import org.bukkit.command.Command;

import org.bukkit.command.CommandExecutor;

import org.bukkit.command.CommandSender;

import org.bukkit.command.ConsoleCommandSender;

import org.bukkit.entity.Player;


import EventFunc.EventFunction;


public class EventCommands implements CommandExecutor{


    @Override

    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

       

       

        if(sender instanceof ConsoleCommandSender){

            System.out.println("Dieser Befehl kann über die Console nicht ausgeführt werden!");

            return true;

        }

        Player p = (Player) sender;

       

       

        if(cmd.getName().equalsIgnoreCase("tevent")) {

            if(!p.hasPermission("TaMo.TEvent"));

                p.sendMessage("§4Fehler: $cKeine Berechtigung!");

                return true;

               

        }

            if(args.length == 0) {

                p.sendMessage("$cZu wenig Argumente!");

                return true;

            }

            if(args.length == 1) {

                EventFunction.TEvent(p, args[0]);

                return true;

               

            }

           

       

        if(cmd.getName().equalsIgnoreCase("settevent")) {

            if(!p.hasPermission("TaMo.setTEvent"));

            p.sendMessage("§4Fehler: $cKeine Berechtigung!");

            return true;

           

    }

        if(args.length == 0) {

            p.sendMessage("$cZu wenig Argumente!");

            return true;

        }

        if(args.length == 1) {

            try {

                EventFunction.SetTEvent(p, args[0]);

            } catch (IOException e) {

                e.printStackTrace();

            }

            return true;

           

        }

           

       

        if(cmd.getName().equalsIgnoreCase("deltevent")) {

            if(!p.hasPermission("TaMo.delTEvent"));

            p.sendMessage("§4Fehler: $cKeine Berechtigung!");

            return true;

           

    }

        if(args.length == 0) {

            p.sendMessage("$cZu wenig Argumente!");

            return true;

        }

        if(args.length == 1) {

            EventFunction.DelTEvent(p, args[0]);

            return true;

           

        }

   

       

       

        return false;

    }


}

[/CODE]



Main


[CODE=java]package me.TaMoBiDa.TaMoBiDaEvents;


import org.bukkit.plugin.java.JavaPlugin;


import EventCom.EventCommands;


public class Main extends JavaPlugin{

   

   

    public void onEnable() {

        System.out.println("Plugin wurde erfolgreich aktiviert!");

        this.getCommand("tevent").setExecutor(new EventCommands());

        this.getCommand("settevent").setExecutor(new EventCommands());

        this.getCommand("deltevent").setExecutor(new EventCommands());

       

       

       

    }

   

   

    public void onDisable() {

       

       

       

       

    }

   

   


}

[/CODE]


Plugin.yml


[CODE=java]name: TaMoBiDaEvents

author: TaMoBiDa

version: 1.0

main: me.TaMoBiDa.TaMoBiDaEvents.Main


commands:

     tevent:

        description: Teleportiere dich zu einem Event-Punkt

        usage: /<command> (Event)


commands:

    settevent:

        description: Setze einen Event-Punkt

        usage: /<command> (Event)


commands:

     deltevent:

        description: Entferne einen Event-Punkt

        usage: /<command> (Event)[/CODE]






Bitte um Hilfe!!


Danke!

~Dominik



Oben