LegendaryTeleport - Kanyak Kodları

>>TheLegend<<

Легенды никогда не умирают
En iyi cevaplar
4
Kaynak Kodları;
Kod:
package me.thelegend.legendaryteleport;

import java.util.logging.Level;
import java.util.logging.Logger;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class LegendaryTeleport extends JavaPlugin {
   
    public static final Logger logcuamca = Logger.getLogger("Minecraft");
   
    public void onDisable()
    {
        logcuamca.log(Level.INFO, "[" + getDescription().getName() + "]" +
    " ===============================");
        logcuamca.log(Level.INFO, "[" + getDescription().getName() + "]" +
    " =====[ Sonra Gorusuruz! ]======");
        logcuamca.log(Level.INFO, "[" + getDescription().getName() + "]" +
    " ===============================");
    }
   
    public void onEnable()
    {
        logcuamca.log(Level.INFO, "[" + getDescription().getName() + "]" +
    " ==========================================");
        logcuamca.log(Level.INFO, "[" + getDescription().getName() + "]" +
    " =======[ Seni Gordugume Sevindim! ]=======");
        logcuamca.log(Level.INFO, "[" + getDescription().getName() + "]" +
    " ==========================================");
    }
   
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
    {
        if (!(sender instanceof Player))
        {
            sender.sendMessage(ChatColor.DARK_RED + "Plugin sadece oyun icerisinde kullanilabilir!");
            return true;
        }
       
        Player oyuncu = (Player)sender;
        if ((cmd.getName().equalsIgnoreCase("isinlan")) &&
                (sender.hasPermission("legendaryteleport.isinlan")))
        {
            if (args.length == 0)
            {
                oyuncu.sendMessage(ChatColor.RED + "Lutfen bir oyuncu isimi girin!");
                return true;
            }
           
            Player target = Bukkit.getServer().getPlayer(args[0]);
            if (target == null)
            {
                oyuncu.sendMessage(ChatColor.RED + "Oyuncu " + args[0] + " Bulunamadi!");
                return true;
            }
            oyuncu.teleport(target.getLocation());
            return true;
            }
            if ((cmd.getName().equalsIgnoreCase("spawnbelrle")) &&
                    (sender.hasPermission("legendaryteleport.spawnbelirle")))
            {
                getConfig().set("spawn.world", oyuncu.getLocation().getWorld().getName());
                getConfig().set("spawn.x", Double.valueOf(oyuncu.getLocation().getX()));
                getConfig().set("spawn.y", Double.valueOf(oyuncu.getLocation().getY()));
                getConfig().set("spawn.z", Double.valueOf(oyuncu.getLocation().getZ()));
                saveConfig();
                oyuncu.sendMessage(ChatColor.GREEN + "Spawn Belirlendi!");
                return true;
            }
            if ((cmd.getName().equalsIgnoreCase("spawn")) &&
            (sender.hasPermission("legendaryteleport.spawn")));
            {
                if (getConfig().getConfigurationSection("spawn") == null)
                {
                    oyuncu.sendMessage(ChatColor.GREEN + "Spawn Belirlenmemis!");
                    return true;
                }
                World w = Bukkit.getServer().getWorld(getConfig().getString("spawn.world"));
                double x = getConfig().getDouble("spawn.x");
                double y = getConfig().getDouble("spawn.y");
                double z = getConfig().getDouble("spawn.z");
                oyuncu.teleport(new Location(w, x, y, z)); }
            return true;
        }
    }
plugin.yml;
Kod:
name: LegendaryTeleport
author: TheLegend
main: me.thelegend.legendaryteleport.LegendaryTeleport
version: 1.0

commands:
    isinlan:
        description: Bir oyuncuyu bir baska oyuncuya isinlanmasina olanak tanir.
        usage: /isinlan
        aliases: [tp, teleport]
    spawnbelirle:
        description: Sunucunuzun baslangic noktasini belirler.
        usage: /spawnbelirle
        aliases: [setspawn]
    spawn:
        description: Belirlenmis baslangic noktasina isinlanmanizi saglar.
        usage: /spawn
permissions:
    legendaryteleport.*:
        description: Tum LegendaryTeleport Komutlarini Kullanmaniza Olanak Tanir.
        children:
            legendaryteleport.isinlan: true
            legendaryteleport.spawnbelirle: true
            legendaryteleport.spawn: true
        default: op
    legendaryteleport.isinlan:
        description: /isinlan komutunu kullanmanizi saglar.
        default: op
    legendaryteleport.spawnbelirle:
        description: /spawnbelirle komutunu kullanmanizi saglar.
        default: op
    legendaryteleport.spawn:
        description: /spawn komutunu kullanmanizi saglar.
        default: true
Plugin Hakkında Bilgi, Pluginin ve Plugin Yapım Videoları Konusu;
https://forum.gamer.com.tr/konu/thelegend-plugin-yapımları-videolu-legendaryteleport.172112/
 
Üst