Skocz do zawartości
  • 0

Help, teleportowanie


PakerP

Pytanie

Otóz mam takie cos:

 

Spoiler

package pl.pakerp.listeners.inventory;

import java.util.List;

import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import pl.pakerp.enums.ArmorType;
import pl.pakerp.managers.DataManager;
import pl.pakerp.managers.SaveManager;
import pl.pakerp.menus.SettingsMenu;
import pl.pakerp.menus.ShopBuyMenu;
import pl.pakerp.menus.ShopMenu;
import pl.pakerp.objects.player.Save;
import pl.pakerp.utils.ArenaUtil;
import pl.pakerp.utils.API;
import pl.pakerp.utils.PacketEquipment;
import pl.pakerp.utils.SpecialColors;

public class InventoryClickListener implements Listener {
    
    @SuppressWarnings("deprecation")
    @EventHandler
    public void onInvClick(InventoryClickEvent e) {
        Player p = (Player)e.getWhoClicked();
        Save u = SaveManager.getUser(p.getName());
        if((u.isLobby()) && !u.isAdmin()) {
            e.setCancelled(true);
        }
        if (e.getInventory().getName().contains(API.fixColor("&9&lWybierz arene"))) {
            if(u.isLobby()) {
                if((!u.isKox()) && !u.isMutated() && !u.isHardCore() && !u.isKnock()) {
                    if(e.getSlot() == 0) {
                        p.closeInventory();
                        ArenaUtil.ClearInventory(p);
                        p.teleport(Bukkit.getWorld("arena_kox").getSpawnLocation());
                        u.setLobby(false);
                        u.setKox(true);
                        ArenaUtil.loadArenaKoxItems(p);
                        ArenaUtil.checkFlight(p);
                        ArenaUtil.joinTitle(p, "KOX");
                    }
                }
            }
        }
        else if(e.getInventory().getName().contains(API.fixColor("&8[&cPvP&f4&1U&f.PL&8] &2SPAWN/LOBBY"))) {
            e.setCancelled(true);
            if(!u.isLobby()) {
                if(e.getSlot() == 12) {
                    if(u.isKox()) {
                        u.setKox(false);
                        u.setKox(true);
                        ArenaUtil.checkFlight(p);
                        API.sendMessage(p, "&f>> &6Przeniesiono na spawna!");
                        return;

                    }
                }
                else if(e.getSlot() == 14) {
                    u.setKox(false);
                    u.setKnock(false);
                    u.setLobby(true);
                    p.teleport(Bukkit.getWorld("world").getSpawnLocation());
                    API.sendMessage(p, "&f>> &6Przeniesiono na lobby!");
                    ArenaUtil.ClearInventory(p);
                    ArenaUtil.loadLobbyItems(p);
                    ArenaUtil.checkFlight(p);
                    p.updateInventory();
                    API.sendTitleMessage(p, "&7LOBBY ", "&6Przeteleportowano cie na lobby!", 80, 20, 20);
                }
            }
        }

 

I chodzi mi oto ze jak wpisze /spawn to normalenie wszystko dziala ale gdy w gui klikne na to aby teleportowało na spawn to wyswietle sie tylko wiadomosc ze teleportowalo na spawn a mnie nie teleportowalo.

Edytowane przez Ewald
Odnośnik do komentarza
https://skript.pl/temat/27901-help-teleportowanie/
Udostępnij na innych stronach

8 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0
Cytat

                    p.teleport(Bukkit.getWorld("world").getSpawnLocation());
 

wyrzuca ci jakies bledy? zapewnie nie wyszukuje takiego swiata, uzywaj Bukkit.getWorlds().get(0), zamiast szukania po nazwie

Cytat

                    if(u.isKox()) {
                        u.setKox(false);
                        u.setKox(true);

;/

Cytat

&8[&cPvP&f4&1U&f.PL&8] 

szykuje sie kolejny najlepszy serwer pvp ;/

Edytowane przez Ewald
Odnośnik do komentarza
https://skript.pl/temat/27901-help-teleportowanie/#findComment-184811
Udostępnij na innych stronach

  • 0
2 godziny temu, yooniks napisał:

wyrzuca ci jakies bledy? zapewnie nie wyszukuje takiego swiata, uzywaj Bukkit.getWorlds().get(0), zamiast szukania po nazwie

;/

szykuje sie kolejny najlepszy serwer pvp ;/

ale mi nie chodzi to teleportacje na lobby tylko na spawna, na lobby dziala poprawnie. czy poprostu mam dodac

Bukkit.getWorlds().get(0) ;

 

do tego pogrubionego gdzies ?

Odnośnik do komentarza
https://skript.pl/temat/27901-help-teleportowanie/#findComment-184832
Udostępnij na innych stronach

  • 0
23 godziny temu, PakerP napisał:

ale mi nie chodzi to teleportacje na lobby tylko na spawna, na lobby dziala poprawnie. czy poprostu mam dodac

Bukkit.getWorlds().get(0) ;

 

do tego pogrubionego gdzies ?

Cytat

                        u.setKox(false);
                        u.setKox(true);
                        ArenaUtil.checkFlight(p);
                        API.sendMessage(p, "&f>> &6Przeniesiono na spawna!");
                        return;

ja tu nie widze zadnej teleportacji, pokaz co masz w arenautil

Edytowane przez Ewald
Odnośnik do komentarza
https://skript.pl/temat/27901-help-teleportowanie/#findComment-184833
Udostępnij na innych stronach

  • 0
23 godziny temu, yooniks napisał:

ja tu nie widze zadnej teleportacji, pokaz co masz w arenautil

Mam;

 

Spoiler

package pl.pakerp.utils;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.WorldBorder;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.scheduler.BukkitRunnable;

import pl.pakerp.Plugin;
import pl.pakerp.enums.GroupType;
import pl.pakerp.loaders.Config;
import pl.pakerp.managers.SaveManager;
import pl.pakerp.managers.UserManager;
import pl.pakerp.objects.player.Save;
import pl.pakerp.objects.player.User;

public class ArenaUtil {
    
    public static void ClearInventory(Player p) {
        p.getInventory().clear();
        p.getInventory().setHelmet(null);
        p.getInventory().setChestplate(null);
        p.getInventory().setLeggings(null);
        p.getInventory().setBoots(null);
        for (PotionEffect potioneffect : p.getActivePotionEffects()) {
            p.removePotionEffect(potioneffect.getType());
        }
        p.setFoodLevel(20);
        p.setHealth(20);
        p.setFireTicks(0);
    }
    public static void loadLobbyItems(Player p) {
        User u = UserManager.getUser(p);
        //Save s = UserManager.getUser(p.getName());
        for (PotionEffect potioneffect : p.getActivePotionEffects()) {
            p.removePotionEffect(potioneffect.getType());
        }
        p.getInventory().clear();
        p.getInventory().setHelmet(null);
        p.getInventory().setChestplate(null);
        p.getInventory().setLeggings(null);
        p.getInventory().setBoots(null);
        
        final ItemStack join = new ItemStack(new ItemBuilder(Material.WRITTEN_BOOK).setTitle(API.fixColor("&8[ &6WYBIERZ ARENE &8]")).addLore(API.fixColor("")).addEnchantment(Enchantment.DURABILITY, 10).build());                
        p.getInventory().setItem(0, join);
        
        final ItemStack arens = new ItemStack(new ItemBuilder(Material.POTION, (short)8259).setTitle(API.fixColor("&8[ &6ARENY 1vs1 &8]")).addLore(API.fixColor("")).addEnchantment(Enchantment.DURABILITY, 10).build());                
        p.getInventory().setItem(1, arens);
        
        final ItemStack fly = new ItemStack(new ItemBuilder(Material.PAPER).setTitle(API.fixColor("&8[ &6LATANIE &8]")).addLore(API.fixColor("&6Tylko VIP")).addEnchantment(Enchantment.DURABILITY, 10).build());
        final ItemStack infoVIP = new ItemStack(new ItemBuilder(Material.PAPER).setTitle(API.fixColor("&8[ &6LATANIE VIP &8]")).addLore(API.fixColor("&f>> &6Zakup range VIP")).addEnchantment(Enchantment.DURABILITY, 10).build());
        if(u.can(GroupType.VIP)) {
            p.getInventory().setItem(4, fly);
        }else {
            p.getInventory().setItem(4, infoVIP);
        }
        
        final ItemStack sett = new ItemStack(new ItemBuilder(Material.REDSTONE_COMPARATOR).setTitle(API.fixColor("&8[ &6USTAWIENIA &8]")).addLore(API.fixColor("")).addEnchantment(Enchantment.DURABILITY, 10).build());
        p.getInventory().setItem(7, sett);
        
        final ItemStack shop = new ItemStack(new ItemBuilder(Material.NETHER_STAR).setTitle(API.fixColor("&8[ &6SKLEP &8]")).addLore(API.fixColor("")).addEnchantment(Enchantment.DURABILITY, 10).build());
        p.getInventory().setItem(8, shop);
    }
    
    public static void checkFlight(Player p) {
        Save u = SaveManager.getUser(p.getName());
        if(u.isAdmin()) {
            return;
        }
        if(p.getAllowFlight()) {
            p.setAllowFlight(false);
        }
    }
    
    public static void loadArenaKoxItems(Player p) {
        final ItemBuilder helmet = new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).setTitle(API.fixColor("&8[&cPvP&f4&1U&f.PL&8]&b&l"+p.getName()));
        final ItemBuilder chestplate = new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).setTitle(API.fixColor("&8[&cPvP&f4&1U&f.PL&8] &b&l"+p.getName()));
        final ItemBuilder leggings = new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).setTitle(API.fixColor("&8[&cPvP&f4&1U&f.PL&8] &b&l"+p.getName()));
        final ItemBuilder boots = new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).setTitle(API.fixColor("&8[&cPvP&f4&1U&f.PL&8] &b&l"+p.getName()));
        new BukkitRunnable() {
            public void run() {
                p.getInventory().setHelmet(helmet.build());
                p.getInventory().setChestplate(chestplate.build());
                p.getInventory().setLeggings(leggings.build());
                p.getInventory().setBoots(boots.build());
                API.giveItems(p, new ItemStack[] {new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.FIRE_ASPECT, 2).setTitle(API.fixColor("&8[&cPvP&f4&1U&f.PL&8] &b&l5/2")).build(),
                        new ItemBuilder(Material.GOLDEN_APPLE, 2, (short)1).build(),
                        new ItemBuilder(Material.GOLDEN_APPLE, 8, (short)0).build(),
                        new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.KNOCKBACK, 1).setTitle(API.fixColor("&8[&cPvP&f4&1U&f.PL&8] &b&lKNOCK 2")).build(),
                        new ItemBuilder(Material.FISHING_ROD).setTitle(API.fixColor("&8[&cPvP&f4&1U&f.PL&8] &b&lWEDKA")).build(),
                        new ItemBuilder(Material.MOSSY_COBBLESTONE, 64).build(),
                });
            }
        }.runTaskLater(Plugin.getPlugin(), 7L);
    }
    public static void loadArenaKnockItems(Player p) {
        final ItemBuilder helmet = new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).setTitle(API.fixColor("&6&lEC&f&lPVP&6&l.PL &8>> &b&l"+p.getName()));
        final ItemBuilder chestplate = new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).setTitle(API.fixColor("&6&lEC&f&lPVP&6&l.PL &8>> &b&l"+p.getName()));
        final ItemBuilder leggings = new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).setTitle(API.fixColor("&6&lEC&f&lPVP&6&l.PL &8>> &b&l"+p.getName()));
        final ItemBuilder boots = new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).setTitle(API.fixColor("&6&lEC&f&lPVP&6&l.PL &8>> &b&l"+p.getName()));
        new BukkitRunnable() {
            public void run() {
                p.getInventory().setHelmet(helmet.build());
                p.getInventory().setChestplate(chestplate.build());
                p.getInventory().setLeggings(leggings.build());
                p.getInventory().setBoots(boots.build());
                API.giveItems(p, new ItemStack[] {new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.FIRE_ASPECT, 2).addEnchantment(Enchantment.DURABILITY, 10).setTitle(API.fixColor("&8&l"+p.getName())).build(),
                        new ItemBuilder(Material.GOLDEN_APPLE, 1, (short)1).build(),
                        new ItemBuilder(Material.GOLDEN_APPLE, 5, (short)0).build(),
                        new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DURABILITY, 10).addEnchantment(Enchantment.KNOCKBACK, 2).setTitle(API.fixColor("&8&l"+p.getName())).build(),
                        new ItemBuilder(Material.WATER_BUCKET).build(),
                        new ItemBuilder(Material.ENDER_PEARL, 1).build(),
                        new ItemBuilder(Material.DIAMOND_PICKAXE, 1).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 3).addEnchantment(Enchantment.DIG_SPEED, 5).setTitle(API.fixColor("&8&l"+p.getName())).build(),
                        new ItemBuilder(Material.SLIME_BLOCK, 1).build(),
                        new ItemBuilder(Material.MOSSY_COBBLESTONE, 64).build(),
                });
            }
        }.runTaskLater(Plugin.getPlugin(), 7L);
    }
    public static void loadArenaIronItems(Player p) {
        final ItemBuilder helmet = new ItemBuilder(Material.IRON_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setTitle(API.fixColor("&1Pak&6PvP &8>> &b&l"+p.getName()));
        final ItemBuilder chestplate = new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setTitle(API.fixColor("&1Pak&6PvP &8>> &b&l"+p.getName()));
        final ItemBuilder leggings = new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setTitle(API.fixColor("&1Pak&6PvP &8>> &b&l"+p.getName()));
        final ItemBuilder boots = new ItemBuilder(Material.IRON_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setTitle(API.fixColor("&1Pak&6PvP &8>> &b&l"+p.getName()));
        new BukkitRunnable() {
            public void run() {
                p.getInventory().setHelmet(helmet.build());
                p.getInventory().setChestplate(chestplate.build());
                p.getInventory().setLeggings(leggings.build());
                p.getInventory().setBoots(boots.build());
                API.giveItems(p, new ItemStack[] {new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.FIRE_ASPECT, 2).setTitle(API.fixColor("&9E&f&lC &8>> &b&l5/2")).build(),
                        new ItemBuilder(Material.GOLDEN_APPLE, 2, (short)1).build(),
                        new ItemBuilder(Material.GOLDEN_APPLE, 8, (short)0).build(),
                        new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.KNOCKBACK, 1).setTitle(API.fixColor("&1Pak&6PvP &8>> &b&lKNOCK 2")).build(),
                        new ItemBuilder(Material.FISHING_ROD).setTitle(API.fixColor("&1Pak&6PvP &8>> &b&lWEDKA")).build(),
                        new ItemBuilder(Material.MOSSY_COBBLESTONE, 64).build(),
                });
            }
        }.runTaskLater(Plugin.getPlugin(), 7L);
    }
    public static void loadPotions(Player p,  int ints) {
        for(int i = 0; i < ints; i++) {
            new BukkitRunnable() {
                @Override
                public void run() {
                    API.giveItems(p, new ItemStack[] {new ItemBuilder(Material.POTION, (short)16421).build()});
                }
            }.runTaskLater(Plugin.getPlugin(), 3L);
        }
    }
    public static void joinTitle(Player p, String arena) {
        new BukkitRunnable() {
            public void run() {
                API.sendTitleMessage(p, "&8* &7Arena &8*", "&8* &6Dolaczyles do areny &f"+arena+"&8*", 30, 60, 15);
            }
        }.runTaskLater(Plugin.getPlugin(), 5L);
    }
    public static void setLobbyBorder() {
        final World w = Bukkit.getWorld("world");
        final WorldBorder wb = w.getWorldBorder();
        final Location loc = w.getSpawnLocation();
        wb.setCenter(loc);
        wb.setSize((double)(Config.LOBBY_BORDER * 2));
    }
}

 

Edytowane przez Ewald
Odnośnik do komentarza
https://skript.pl/temat/27901-help-teleportowanie/#findComment-184834
Udostępnij na innych stronach

  • 0
23 godziny temu, PakerP napisał:

Mam;

 

Spoiler

package pl.pakerp.utils;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.WorldBorder;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.scheduler.BukkitRunnable;

import pl.pakerp.Plugin;
import pl.pakerp.enums.GroupType;
import pl.pakerp.loaders.Config;
import pl.pakerp.managers.SaveManager;
import pl.pakerp.managers.UserManager;
import pl.pakerp.objects.player.Save;
import pl.pakerp.objects.player.User;

public class ArenaUtil {
    
    public static void ClearInventory(Player p) {
        p.getInventory().clear();
        p.getInventory().setHelmet(null);
        p.getInventory().setChestplate(null);
        p.getInventory().setLeggings(null);
        p.getInventory().setBoots(null);
        for (PotionEffect potioneffect : p.getActivePotionEffects()) {
            p.removePotionEffect(potioneffect.getType());
        }
        p.setFoodLevel(20);
        p.setHealth(20);
        p.setFireTicks(0);
    }
    public static void loadLobbyItems(Player p) {
        User u = UserManager.getUser(p);
        //Save s = UserManager.getUser(p.getName());
        for (PotionEffect potioneffect : p.getActivePotionEffects()) {
            p.removePotionEffect(potioneffect.getType());
        }
        p.getInventory().clear();
        p.getInventory().setHelmet(null);
        p.getInventory().setChestplate(null);
        p.getInventory().setLeggings(null);
        p.getInventory().setBoots(null);
        
        final ItemStack join = new ItemStack(new ItemBuilder(Material.WRITTEN_BOOK).setTitle(API.fixColor("&8[ &6WYBIERZ ARENE &8]")).addLore(API.fixColor("")).addEnchantment(Enchantment.DURABILITY, 10).build());                
        p.getInventory().setItem(0, join);
        
        final ItemStack arens = new ItemStack(new ItemBuilder(Material.POTION, (short)8259).setTitle(API.fixColor("&8[ &6ARENY 1vs1 &8]")).addLore(API.fixColor("")).addEnchantment(Enchantment.DURABILITY, 10).build());                
        p.getInventory().setItem(1, arens);
        
        final ItemStack fly = new ItemStack(new ItemBuilder(Material.PAPER).setTitle(API.fixColor("&8[ &6LATANIE &8]")).addLore(API.fixColor("&6Tylko VIP")).addEnchantment(Enchantment.DURABILITY, 10).build());
        final ItemStack infoVIP = new ItemStack(new ItemBuilder(Material.PAPER).setTitle(API.fixColor("&8[ &6LATANIE VIP &8]")).addLore(API.fixColor("&f>> &6Zakup range VIP")).addEnchantment(Enchantment.DURABILITY, 10).build());
        if(u.can(GroupType.VIP)) {
            p.getInventory().setItem(4, fly);
        }else {
            p.getInventory().setItem(4, infoVIP);
        }
        
        final ItemStack sett = new ItemStack(new ItemBuilder(Material.REDSTONE_COMPARATOR).setTitle(API.fixColor("&8[ &6USTAWIENIA &8]")).addLore(API.fixColor("")).addEnchantment(Enchantment.DURABILITY, 10).build());
        p.getInventory().setItem(7, sett);
        
        final ItemStack shop = new ItemStack(new ItemBuilder(Material.NETHER_STAR).setTitle(API.fixColor("&8[ &6SKLEP &8]")).addLore(API.fixColor("")).addEnchantment(Enchantment.DURABILITY, 10).build());
        p.getInventory().setItem(8, shop);
    }
    
    public static void checkFlight(Player p) {
        Save u = SaveManager.getUser(p.getName());
        if(u.isAdmin()) {
            return;
        }
        if(p.getAllowFlight()) {
            p.setAllowFlight(false);
        }
    }
    
    public static void loadArenaKoxItems(Player p) {
        final ItemBuilder helmet = new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).setTitle(API.fixColor("&8[&cPvP&f4&1U&f.PL&8]&b&l"+p.getName()));
        final ItemBuilder chestplate = new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).setTitle(API.fixColor("&8[&cPvP&f4&1U&f.PL&8] &b&l"+p.getName()));
        final ItemBuilder leggings = new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).setTitle(API.fixColor("&8[&cPvP&f4&1U&f.PL&8] &b&l"+p.getName()));
        final ItemBuilder boots = new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).setTitle(API.fixColor("&8[&cPvP&f4&1U&f.PL&8] &b&l"+p.getName()));
        new BukkitRunnable() {
            public void run() {
                p.getInventory().setHelmet(helmet.build());
                p.getInventory().setChestplate(chestplate.build());
                p.getInventory().setLeggings(leggings.build());
                p.getInventory().setBoots(boots.build());
                API.giveItems(p, new ItemStack[] {new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.FIRE_ASPECT, 2).setTitle(API.fixColor("&8[&cPvP&f4&1U&f.PL&8] &b&l5/2")).build(),
                        new ItemBuilder(Material.GOLDEN_APPLE, 2, (short)1).build(),
                        new ItemBuilder(Material.GOLDEN_APPLE, 8, (short)0).build(),
                        new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.KNOCKBACK, 1).setTitle(API.fixColor("&8[&cPvP&f4&1U&f.PL&8] &b&lKNOCK 2")).build(),
                        new ItemBuilder(Material.FISHING_ROD).setTitle(API.fixColor("&8[&cPvP&f4&1U&f.PL&8] &b&lWEDKA")).build(),
                        new ItemBuilder(Material.MOSSY_COBBLESTONE, 64).build(),
                });
            }
        }.runTaskLater(Plugin.getPlugin(), 7L);
    }
    public static void loadArenaKnockItems(Player p) {
        final ItemBuilder helmet = new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).setTitle(API.fixColor("&6&lEC&f&lPVP&6&l.PL &8>> &b&l"+p.getName()));
        final ItemBuilder chestplate = new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).setTitle(API.fixColor("&6&lEC&f&lPVP&6&l.PL &8>> &b&l"+p.getName()));
        final ItemBuilder leggings = new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).setTitle(API.fixColor("&6&lEC&f&lPVP&6&l.PL &8>> &b&l"+p.getName()));
        final ItemBuilder boots = new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).setTitle(API.fixColor("&6&lEC&f&lPVP&6&l.PL &8>> &b&l"+p.getName()));
        new BukkitRunnable() {
            public void run() {
                p.getInventory().setHelmet(helmet.build());
                p.getInventory().setChestplate(chestplate.build());
                p.getInventory().setLeggings(leggings.build());
                p.getInventory().setBoots(boots.build());
                API.giveItems(p, new ItemStack[] {new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.FIRE_ASPECT, 2).addEnchantment(Enchantment.DURABILITY, 10).setTitle(API.fixColor("&8&l"+p.getName())).build(),
                        new ItemBuilder(Material.GOLDEN_APPLE, 1, (short)1).build(),
                        new ItemBuilder(Material.GOLDEN_APPLE, 5, (short)0).build(),
                        new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DURABILITY, 10).addEnchantment(Enchantment.KNOCKBACK, 2).setTitle(API.fixColor("&8&l"+p.getName())).build(),
                        new ItemBuilder(Material.WATER_BUCKET).build(),
                        new ItemBuilder(Material.ENDER_PEARL, 1).build(),
                        new ItemBuilder(Material.DIAMOND_PICKAXE, 1).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 3).addEnchantment(Enchantment.DIG_SPEED, 5).setTitle(API.fixColor("&8&l"+p.getName())).build(),
                        new ItemBuilder(Material.SLIME_BLOCK, 1).build(),
                        new ItemBuilder(Material.MOSSY_COBBLESTONE, 64).build(),
                });
            }
        }.runTaskLater(Plugin.getPlugin(), 7L);
    }
    public static void loadArenaIronItems(Player p) {
        final ItemBuilder helmet = new ItemBuilder(Material.IRON_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setTitle(API.fixColor("&1Pak&6PvP &8>> &b&l"+p.getName()));
        final ItemBuilder chestplate = new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setTitle(API.fixColor("&1Pak&6PvP &8>> &b&l"+p.getName()));
        final ItemBuilder leggings = new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setTitle(API.fixColor("&1Pak&6PvP &8>> &b&l"+p.getName()));
        final ItemBuilder boots = new ItemBuilder(Material.IRON_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).setTitle(API.fixColor("&1Pak&6PvP &8>> &b&l"+p.getName()));
        new BukkitRunnable() {
            public void run() {
                p.getInventory().setHelmet(helmet.build());
                p.getInventory().setChestplate(chestplate.build());
                p.getInventory().setLeggings(leggings.build());
                p.getInventory().setBoots(boots.build());
                API.giveItems(p, new ItemStack[] {new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.FIRE_ASPECT, 2).setTitle(API.fixColor("&9E&f&lC &8>> &b&l5/2")).build(),
                        new ItemBuilder(Material.GOLDEN_APPLE, 2, (short)1).build(),
                        new ItemBuilder(Material.GOLDEN_APPLE, 8, (short)0).build(),
                        new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.KNOCKBACK, 1).setTitle(API.fixColor("&1Pak&6PvP &8>> &b&lKNOCK 2")).build(),
                        new ItemBuilder(Material.FISHING_ROD).setTitle(API.fixColor("&1Pak&6PvP &8>> &b&lWEDKA")).build(),
                        new ItemBuilder(Material.MOSSY_COBBLESTONE, 64).build(),
                });
            }
        }.runTaskLater(Plugin.getPlugin(), 7L);
    }
    public static void loadPotions(Player p,  int ints) {
        for(int i = 0; i < ints; i++) {
            new BukkitRunnable() {
                @Override
                public void run() {
                    API.giveItems(p, new ItemStack[] {new ItemBuilder(Material.POTION, (short)16421).build()});
                }
            }.runTaskLater(Plugin.getPlugin(), 3L);
        }
    }
    public static void joinTitle(Player p, String arena) {
        new BukkitRunnable() {
            public void run() {
                API.sendTitleMessage(p, "&8* &7Arena &8*", "&8* &6Dolaczyles do areny &f"+arena+"&8*", 30, 60, 15);
            }
        }.runTaskLater(Plugin.getPlugin(), 5L);
    }
    public static void setLobbyBorder() {
        final World w = Bukkit.getWorld("world");
        final WorldBorder wb = w.getWorldBorder();
        final Location loc = w.getSpawnLocation();
        wb.setCenter(loc);
        wb.setSize((double)(Config.LOBBY_BORDER * 2));
    }
}

 

no to w takim razie nigdzie nie teleportujesz gracza, to czemu sie dziwisz ze go nie teleportuje :XD:

Cytat

            if(!u.isLobby()) {
                if(e.getSlot() == 12) {
                    if(u.isKox()) {
                        u.setKox(false);
                        u.setKox(true);
                        ArenaUtil.checkFlight(p);
                        API.sendMessage(p, "&f>> &6Przeniesiono na spawna!");
                        return;
                    }
                }

 

Edytowane przez Ewald
Odnośnik do komentarza
https://skript.pl/temat/27901-help-teleportowanie/#findComment-184835
Udostępnij na innych stronach

  • 0

chyba ze mam tak teleportowac na spawna z areny:

 

Spoiler

        else if(e.getInventory().getName().contains(API.fixColor("&8[&cPvP&f4&1U&f.PL&8] &2SPAWN/LOBBY"))) {
            e.setCancelled(true);
            if(!u.isLobby()) {
                if(e.getSlot() == 12) {
                    if(u.isKox()) {
                        u.setKox(false);
                        u.setKox(true);
                        ArenaUtil.checkFlight(p);
                        p.teleport(Bukkit.getWorld("arena_kox").getSpawnLocation());
                        API.sendMessage(p, "&f>> &6Przeniesiono na spawna!");
                        return;
                    }
                }

 

Edytowane przez Ewald
Odnośnik do komentarza
https://skript.pl/temat/27901-help-teleportowanie/#findComment-184836
Udostępnij na innych stronach

  • 0
1 minutę temu, yooniks napisał:

no to w takim razie nigdzie nie teleportujesz gracza, to czemu sie dziwisz ze go nie teleportuje :XD:

 

ty no bo ja prubuje to zrobic ale nie wychodzi, bo albo nie dziala w mc ogolnie komenda /spawn, /lobby jak cos zrobie jakos inaczej

Odnośnik do komentarza
https://skript.pl/temat/27901-help-teleportowanie/#findComment-184837
Udostępnij na innych stronach

Nieaktywny
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...