Compare commits
	
		
			No commits in common. "f50a7a02e5beec2af3ee7bc92a0c1164c8ff0a4c" and "f5ce425677ec1301cda7173b5a7a97ff506a544c" have entirely different histories.
		
	
	
		
			f50a7a02e5
			...
			f5ce425677
		
	
		
							
								
								
									
										10
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								pom.xml
									
									
									
									
									
								
							|  | @ -47,16 +47,6 @@ | |||
|             <artifactId>NBT-API</artifactId> | ||||
|             <version>1.12.2</version> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>com.yaohun.playermanage</groupId> | ||||
|             <artifactId>PlayerManage</artifactId> | ||||
|             <version>1.0.3</version> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>com.vexview.api</groupId> | ||||
|             <artifactId>vexview</artifactId> | ||||
|             <version>1.12.2</version> | ||||
|         </dependency> | ||||
|     </dependencies> | ||||
| 
 | ||||
| </project> | ||||
|  | @ -14,6 +14,8 @@ public class WarpData { | |||
| 
 | ||||
|     private String key; | ||||
|     private Location location; | ||||
|     private boolean locSwitch; | ||||
|     private Island island; | ||||
| 
 | ||||
|     public WarpData(String key){ | ||||
|         FileConfiguration yml = Main.plugin.getConfig(); | ||||
|  | @ -31,15 +33,19 @@ public class WarpData { | |||
|         float yaw = (float) yml.getDouble(string+"yaw"); | ||||
|         float pitch = (float) yml.getDouble(string+"pitch"); | ||||
|         this.location = new Location(world,x,y,z,yaw,pitch); | ||||
|         this.island = ASkyBlockAPI.getInstance().getIslandAt(location); | ||||
|         this.locSwitch = yml.getBoolean(string+"switch"); | ||||
|     } | ||||
|     public WarpData(String key,Location location){ | ||||
|         this.key = key; | ||||
|         this.location = location; | ||||
|         this.locSwitch = true; | ||||
|     } | ||||
| 
 | ||||
|     public void SaveData(){ | ||||
|         FileConfiguration yml = Main.plugin.getConfig(); | ||||
|         String string = "Stats."+key+"."; | ||||
|         yml.set(string+"switch",this.locSwitch); | ||||
|         yml.set(string+"world",location.getWorld().getName()); | ||||
|         yml.set(string+"x",location.getX()); | ||||
|         yml.set(string+"y",location.getY()); | ||||
|  | @ -60,4 +66,12 @@ public class WarpData { | |||
|     public void setLocation(Location location) { | ||||
|         this.location = location; | ||||
|     } | ||||
| 
 | ||||
|     public boolean isLocSwitch() { | ||||
|         return locSwitch; | ||||
|     } | ||||
| 
 | ||||
|     public Island getIsland() { | ||||
|         return island; | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -1,93 +0,0 @@ | |||
| package me.Demon.AskyBlockWarps.Listener; | ||||
| 
 | ||||
| import com.wasteofplastic.askyblock.ASkyBlockAPI; | ||||
| import de.tr7zw.itemnbtapi.NBTItem; | ||||
| import me.Demon.AskyBlockWarps.Main; | ||||
| import me.Demon.DemonPlugin.DemonAPI; | ||||
| import org.bukkit.Bukkit; | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.Sound; | ||||
| import org.bukkit.World; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.event.EventHandler; | ||||
| import org.bukkit.event.Listener; | ||||
| import org.bukkit.event.inventory.InventoryClickEvent; | ||||
| import org.bukkit.event.inventory.InventoryCloseEvent; | ||||
| import org.bukkit.inventory.Inventory; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| import org.bukkit.inventory.meta.ItemMeta; | ||||
| import org.bukkit.scheduler.BukkitRunnable; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import java.util.UUID; | ||||
| 
 | ||||
| public class AcceptGui implements Listener { | ||||
|     public static String invtitle = "帝国战争 - 岛屿邀请"; | ||||
|     public static List<Player> playerList = new ArrayList<>(); | ||||
|     @EventHandler | ||||
|     public void onclick(InventoryClickEvent e) { | ||||
|         int rawSlot = e.getRawSlot(); | ||||
|         Player p = (Player) e.getWhoClicked(); | ||||
|         if (e.getInventory() != null && e.getInventory().getTitle().contains(invtitle)) { | ||||
|             e.setCancelled(true); | ||||
|             if (rawSlot >= 0 && rawSlot < e.getInventory().getSize()) { | ||||
|                 if(rawSlot == 2){ | ||||
|                     playerList.add(p); | ||||
|                     p.closeInventory(); | ||||
|                     p.performCommand("is accept"); | ||||
|                     new BukkitRunnable() { | ||||
|                         @Override | ||||
|                         public void run() { | ||||
|                             playerList.remove(p); | ||||
|                         } | ||||
|                     }.runTaskLater(Main.plugin,60L); | ||||
|                 } | ||||
|                 if(rawSlot == 6){ | ||||
|                     p.performCommand("is reject"); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     @EventHandler | ||||
|     public void onclick(InventoryCloseEvent e) { | ||||
|         Player p = (Player) e.getPlayer(); | ||||
|         if (e.getInventory() != null && e.getInventory().getTitle().contains(invtitle)) { | ||||
|             if (!playerList.contains(p)) { | ||||
|                 p.performCommand("is reject"); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static void Opengui(Player p) { | ||||
|         Inventory inv = Bukkit.createInventory(null, 9, invtitle); | ||||
|         inv.setItem(2,Accept()); | ||||
|         inv.setItem(6,Deny()); | ||||
|         p.openInventory(inv); | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack Accept() { | ||||
|         ItemStack item = new ItemStack(Material.SLIME_BALL); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l接受邀请"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §e点击操作"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
|     public static ItemStack Deny() { | ||||
|         ItemStack item = new ItemStack(Material.MAGMA_CREAM); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§c§l拒绝邀请"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §e点击操作"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| } | ||||
|  | @ -1,26 +1,19 @@ | |||
| package me.Demon.AskyBlockWarps.Listener; | ||||
| 
 | ||||
| import cn.hamster3.cdapi.CDTimeAPI; | ||||
| import com.wasteofplastic.askyblock.ASkyBlockAPI; | ||||
| import de.tr7zw.itemnbtapi.NBTItem; | ||||
| import me.Demon.AskyBlockWarps.Main; | ||||
| import me.Demon.AskyBlockWarps.Util.itemUtil; | ||||
| import me.Demon.DemonPlugin.DemonAPI; | ||||
| import org.bukkit.Bukkit; | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.Sound; | ||||
| import org.bukkit.World; | ||||
| 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.Inventory; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| import org.bukkit.inventory.meta.ItemMeta; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import java.util.UUID; | ||||
| 
 | ||||
| public class LandInviteGui implements Listener { | ||||
|     public static String invtitle = "帝国战争 - 成员邀请"; | ||||
|  | @ -30,23 +23,14 @@ public class LandInviteGui implements Listener { | |||
|         Player p = (Player) e.getWhoClicked(); | ||||
|         if (e.getInventory() != null && e.getInventory().getTitle().contains(invtitle)) { | ||||
|             e.setCancelled(true); | ||||
|             if (e.getRawSlot() >= 0 && e.getRawSlot() < e.getInventory().getSize()) { | ||||
|             ItemStack item = e.getCurrentItem(); | ||||
|                 if(!DemonAPI.itemIsNull(item) && !DemonAPI.itemIsLore(item)) { | ||||
|                     NBTItem nbtItem = new NBTItem(item); | ||||
|                     if (nbtItem.hasKey("inviteName")) { | ||||
|             if (e.getRawSlot() >= 0 && e.getRawSlot() < e.getInventory().getSize() && !DemonAPI.itemIsNull(item) && !DemonAPI.itemIsLore(item)) { | ||||
|                 if (ASkyBlockAPI.getInstance().getOwner(p.getLocation()).equals(p.getUniqueId())) { | ||||
|                     String playName = item.getItemMeta().getDisplayName().replace("§6§l玩家 §e", ""); | ||||
|                     p.performCommand("is invite " + playName); | ||||
|                 } else { | ||||
|                     p.sendMessage(Main.prefix + "您不是岛主,没权限邀请玩家加入岛屿."); | ||||
|                     p.closeInventory(); | ||||
|                         String name = nbtItem.getString("inviteName"); | ||||
|                         p.performCommand("is invite " + name); | ||||
|                         Player toPlayer = Bukkit.getPlayer(name); | ||||
|                         if(CDTimeAPI.getCD(p.getUniqueId(),"inviteCd") > 0){ | ||||
|                             return; | ||||
|                         } | ||||
|                         if(toPlayer != null){ | ||||
|                             AcceptGui.Opengui(toPlayer); | ||||
|                             CDTimeAPI.setPlayerCD(p.getUniqueId(),"inviteCd",1000 * 10); | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | @ -56,44 +40,20 @@ public class LandInviteGui implements Listener { | |||
|         Inventory inv = Bukkit.createInventory(null, 54, invtitle); | ||||
|         // 获取玩家附近20格内的所有玩家 | ||||
|         List<Player> nearbyPlayers = new ArrayList<>(); | ||||
|         World world = p.getWorld(); | ||||
|         for (Player nearbyPlayer : world.getPlayers()) { | ||||
|             if (p.getLocation().distance(nearbyPlayer.getLocation()) <= 50) { | ||||
|                 // 判断这个玩家是否已加入岛屿 | ||||
|                 if(!ASkyBlockAPI.getInstance().hasIsland(nearbyPlayer.getUniqueId())) { | ||||
|         for (Player nearbyPlayer : Bukkit.getServer().getOnlinePlayers()) { | ||||
|             if (p.getWorld().equals(nearbyPlayer.getWorld())) { // 确保玩家在同一世界 | ||||
|                 if (p.getLocation().distance(nearbyPlayer.getLocation()) <= 20) { | ||||
|                     nearbyPlayers.add(nearbyPlayer); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         if(nearbyPlayers.size() < 1){ | ||||
|             p.sendMessage(Main.prefix + "您周围没有玩家可邀请加入岛屿."); | ||||
|             p.playSound(p.getLocation(), Sound.ENTITY_BLAZE_DEATH, 1.6F, 1.8F); | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         for (Player nearbyPlayer : nearbyPlayers) { | ||||
|             if (!p.equals(nearbyPlayer)) { // 避免将玩家自己添加到GUI中 | ||||
|                 inv.addItem(addTeam(nearbyPlayer.getName())); | ||||
|                 inv.addItem(itemUtil.addTeam(nearbyPlayer.getName())); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         p.openInventory(inv); | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack addTeam(String name) { | ||||
|         ItemStack item = new ItemStack(Material.SIGN); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l玩家 §e" + name); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§c 请勿随意点击"); | ||||
|         lore.add("§c 请勿随意点击"); | ||||
|         lore.add("§c 请勿随意点击"); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §e点击邀请加入岛屿"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         NBTItem nbtItem = new NBTItem(item); | ||||
|         nbtItem.setString("inviteName",name); | ||||
|         return nbtItem.getItem(); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -1,26 +1,17 @@ | |||
| package me.Demon.AskyBlockWarps.Listener; | ||||
| 
 | ||||
| import com.wasteofplastic.askyblock.ASkyBlockAPI; | ||||
| import com.wasteofplastic.askyblock.Island; | ||||
| import com.yaohun.playermanage.PlayerManage; | ||||
| import de.tr7zw.itemnbtapi.NBTItem; | ||||
| import me.Demon.AskyBlockWarps.Main; | ||||
| import me.Demon.AskyBlockWarps.Util.itemUtil; | ||||
| import me.Demon.DemonPlugin.DemonAPI; | ||||
| import org.bukkit.Bukkit; | ||||
| import org.bukkit.Location; | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.Sound; | ||||
| 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.Inventory; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| import org.bukkit.inventory.meta.ItemMeta; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import java.util.UUID; | ||||
| 
 | ||||
| public class LandTeamGui implements Listener { | ||||
|  | @ -28,89 +19,27 @@ public class LandTeamGui implements Listener { | |||
| 
 | ||||
|     @EventHandler | ||||
|     public void onclick(InventoryClickEvent e) { | ||||
|         int rawSlot = e.getRawSlot(); | ||||
|         Inventory inv = e.getInventory(); | ||||
|         Player p = (Player) e.getWhoClicked(); | ||||
|         Location location = p.getLocation(); | ||||
|         String name = p.getName(); | ||||
|         if (inv != null && inv.getTitle().contains(invtitle)) { | ||||
|         if (e.getInventory() != null && e.getInventory().getTitle().contains(invtitle)) { | ||||
|             e.setCancelled(true); | ||||
|             ItemStack item = e.getCurrentItem(); | ||||
|             if (rawSlot >= 0 && rawSlot < inv.getSize()) { | ||||
|                 if(!DemonAPI.itemIsNull(item) && !DemonAPI.itemIsLore(item)) { | ||||
|                     NBTItem nbtItem = new NBTItem(item); | ||||
|                     if(nbtItem.hasKey("uuid")) { | ||||
|                         String uuid = nbtItem.getString("uuid"); | ||||
|                         // 获取当前岛屿数据 | ||||
|                         Island island = ASkyBlockAPI.getInstance().getIslandAt(location); | ||||
|                         UUID ownerUuid = island.getOwner(); | ||||
|                         // 判断操作目标是否是岛屿主人 | ||||
|                         if(ownerUuid.toString().equalsIgnoreCase(uuid)){ | ||||
|                             p.sendMessage(Main.prefix + "无法对岛屿主人进行移除操作."); | ||||
|                             p.playSound(p.getLocation(), Sound.ENTITY_BLAZE_DEATH,1.6F,1.8F); | ||||
|                             return; | ||||
|                         } | ||||
|                         // 判断操作移除的人是否是岛屿主人 | ||||
|                         if(!ownerUuid.equals(p.getUniqueId())){ | ||||
|                             p.sendMessage(Main.prefix + "只有岛屿主人才能进行移除操作."); | ||||
|                             p.playSound(p.getLocation(), Sound.ENTITY_BLAZE_DEATH,1.6F,1.8F); | ||||
|                             return; | ||||
|                         } | ||||
|                         String kickName = PlayerManage.getUuidToName(uuid); | ||||
|                         if(kickName == null){ | ||||
|                             p.sendMessage(Main.prefix + "移除失败,无法获取该目标昵称."); | ||||
|                             p.playSound(p.getLocation(), Sound.ENTITY_BLAZE_DEATH,1.6F,1.8F); | ||||
|                             return; | ||||
|                         } | ||||
|                         p.performCommand("is expel " + kickName); | ||||
|                     } | ||||
|             if (e.getRawSlot() >= 0 && e.getRawSlot() < e.getInventory().getSize() && !DemonAPI.itemIsNull(item) && !DemonAPI.itemIsLore(item)) { | ||||
|                 if (ASkyBlockAPI.getInstance().getIslandAt(p.getLocation()).equals(p.getUniqueId())) { | ||||
|                     String playName = item.getItemMeta().getDisplayName().replace("§6§l成员 §e", ""); | ||||
|                     p.performCommand("is expel " + playName); | ||||
|                 } | ||||
|             } else { | ||||
|                 p.sendMessage(Main.prefix + "您不是岛主,没权限将玩家移出岛屿."); | ||||
|                 p.closeInventory(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static void Opengui(Player p) { | ||||
|         Inventory inv = Bukkit.createInventory(null, 27, invtitle); | ||||
|         Island island = ASkyBlockAPI.getInstance().getIslandAt(p.getLocation()); | ||||
|         int slot = 0; | ||||
|         List<UUID> uuidList = island.getMembers(); | ||||
|         uuidList.remove(0); | ||||
|         for (UUID uuid : uuidList){ | ||||
|             String name = PlayerManage.getUuidToName(uuid.toString()); | ||||
|             if (name != null) { | ||||
|                 if (!uuid.equals(island.getOwner())) { | ||||
|                     inv.setItem(slot,teamList(uuid,false)); | ||||
|                 }else{ | ||||
|                     inv.setItem(slot,teamList(uuid,true)); | ||||
|                 } | ||||
|                 slot++; | ||||
|             } | ||||
|         for (UUID uid : ASkyBlockAPI.getInstance().getTeamMembers(p.getUniqueId())) { | ||||
|             inv.addItem(itemUtil.teamList(Main.convertUUIDToName(uid))); | ||||
|         } | ||||
|         p.openInventory(inv); | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack teamList(UUID uuid,boolean owner) { | ||||
|         ItemStack item = new ItemStack(Material.SIGN); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         String name = PlayerManage.getUuidToName(uuid.toString()); | ||||
|         if(name == null){ | ||||
|             meta.setDisplayName("§6§l成员 §c无法获取"); | ||||
|         }else { | ||||
|             meta.setDisplayName("§6§l成员 §e" + name); | ||||
|         } | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         if(owner){ | ||||
|             lore.add("§7 身份: §f岛主"); | ||||
|         }else { | ||||
|             lore.add("§7 身份: §f岛员"); | ||||
|         } | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §c点击移除岛屿"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         NBTItem nbtItem = new NBTItem(item); | ||||
|         nbtItem.setString("uuid",uuid.toString()); | ||||
|         return nbtItem.getItem(); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -2,30 +2,21 @@ package me.Demon.AskyBlockWarps.Listener; | |||
| 
 | ||||
| import cn.hamster3.cdapi.CDTimeAPI; | ||||
| import com.wasteofplastic.askyblock.ASkyBlockAPI; | ||||
| import com.wasteofplastic.askyblock.Island; | ||||
| import com.yaohun.playermanage.PlayerManage; | ||||
| import lk.vexview.api.VexViewAPI; | ||||
| import me.Demon.AskyBlockWarps.Main; | ||||
| import me.Demon.AskyBlockWarps.Manage.GameManage; | ||||
| import me.Demon.AskyBlockWarps.Util.itemUtil; | ||||
| import me.Demon.DemonPlugin.DemonAPI; | ||||
| import org.bukkit.Bukkit; | ||||
| import org.bukkit.Location; | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.Sound; | ||||
| import org.bukkit.configuration.file.FileConfiguration; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.entity.Vex; | ||||
| import org.bukkit.event.EventHandler; | ||||
| import org.bukkit.event.Listener; | ||||
| import org.bukkit.event.inventory.InventoryClickEvent; | ||||
| import org.bukkit.inventory.Inventory; | ||||
| import org.bukkit.inventory.ItemFlag; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| import org.bukkit.inventory.meta.ItemMeta; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import java.util.UUID; | ||||
| 
 | ||||
| public class MainGui implements Listener { | ||||
|  | @ -36,278 +27,103 @@ public class MainGui implements Listener { | |||
|         int rawSlot = e.getRawSlot(); | ||||
|         Inventory inv = e.getInventory(); | ||||
|         Player p = (Player) e.getWhoClicked(); | ||||
|         Location location = p.getLocation(); | ||||
|         String name = p.getName(); | ||||
|         if (inv != null && inv.getTitle().contains(invtitle)) { | ||||
|             e.setCancelled(true); | ||||
|             if (rawSlot >= 0 && rawSlot < inv.getSize()) { | ||||
|                 ItemStack item = e.getCurrentItem(); | ||||
|                 if(DemonAPI.itemIsNull(item) || DemonAPI.itemIsName(item)){return;} | ||||
|                 ItemMeta meta = item.getItemMeta(); | ||||
|                 String itemName = meta.getDisplayName(); | ||||
|                 if(itemName.contains("返回主页")){ | ||||
|                     VexViewAPI.openGui(p,"主菜单"); | ||||
|                     p.playSound(p.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1.6F, 1.8F); | ||||
|                     return; | ||||
|                 } | ||||
|                 if(itemName.contains("返回空岛")){ | ||||
|                 UUID islandOwner = ASkyBlockAPI.getInstance().getOwner(p.getLocation()); | ||||
|                 if (e.getRawSlot() == 1) { | ||||
|                     p.performCommand("is"); | ||||
|                     p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0F, 2.0F); | ||||
|                     p.closeInventory(); | ||||
|                     return; | ||||
|                 } | ||||
|                 if(itemName.contains("空岛地标列表")){ | ||||
|                     WarpGui.Opengui(p); | ||||
|                     p.playSound(p.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1.6F, 1.8F); | ||||
|                     return; | ||||
|                 } | ||||
|                 if(itemName.contains("邀请加入空岛")){ | ||||
|                     // 判断玩家是否拥有岛屿并且是岛主 | ||||
|                     boolean isOwner = false; | ||||
|                     Island island = ASkyBlockAPI.getInstance().getIslandOwnedBy(p.getUniqueId()); | ||||
|                     if(island != null){ | ||||
|                         UUID ownerUuid = island.getOwner(); | ||||
|                         if(ownerUuid.equals(p.getUniqueId())){ | ||||
|                             LandInviteGui.Opengui(p); | ||||
|                             p.playSound(p.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1.6F, 1.8F); | ||||
|                             isOwner = true; | ||||
|                         } | ||||
|                     } | ||||
|                     if(!isOwner){ | ||||
|                         p.sendMessage(Main.prefix + "您需要创建岛屿成为岛主后才能邀请玩家."); | ||||
|                         p.playSound(p.getLocation(), Sound.ENTITY_BLAZE_DEATH, 1.6F, 1.8F); | ||||
|                     } | ||||
|                     return; | ||||
|                 } | ||||
|                 if(itemName.contains("设置空岛地标")){ | ||||
|                     p.closeInventory(); | ||||
|                     // 获取当前岛屿岛主UUID | ||||
|                     Island island = ASkyBlockAPI.getInstance().getIslandAt(location); | ||||
|                     if(island != null && !island.getOwner().equals(p.getUniqueId())){ | ||||
|                         p.sendMessage(Main.prefix + "您只能在自己的岛屿设置传送点坐标."); | ||||
|                         p.playSound(p.getLocation(), Sound.ENTITY_BLAZE_DEATH, 1.6F, 1.8F); | ||||
|                         return; | ||||
|                     } | ||||
|                     if (CDTimeAPI.getCD(p.getUniqueId(), "islandsetwarp") > 0) { | ||||
|                         p.sendMessage(Main.prefix + "请稍后再次尝试设置坐标."); | ||||
|                         p.playSound(p.getLocation(), Sound.ENTITY_BLAZE_DEATH, 1.6F, 1.8F); | ||||
|                         return; | ||||
|                     } | ||||
|                     if(!p.hasPermission("warps.create")){ | ||||
|                         p.sendMessage(Main.prefix + "你需要成为 盫 §r才能设置坐标."); | ||||
|                         p.playSound(p.getLocation(), Sound.ENTITY_BLAZE_DEATH, 1.6F, 1.8F); | ||||
|                         return; | ||||
|                 } | ||||
| 
 | ||||
|                 if (e.getRawSlot() == 3) { | ||||
|                     if (islandOwner != null && islandOwner.equals(p.getUniqueId())) { | ||||
|                         if (CDTimeAPI.getCD(p.getUniqueId(), "islandsetwarp") < 0) { | ||||
|                             Main.gameManage.setWarpLoc(name,p.getLocation()); | ||||
|                             p.sendMessage(Main.prefix + "设置空岛地标点成功."); | ||||
|                     CDTimeAPI.setPlayerCD(p.getUniqueId(), "islandsetwarp", 1000 * 5); | ||||
|                     p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.6F, 1.8F); | ||||
|                     return; | ||||
|                 } | ||||
|                 if(itemName.contains("重置空岛")){ | ||||
|                             CDTimeAPI.setPlayerCD(p.getUniqueId(), "islandsetwarp", 1000 * 3); | ||||
|                             p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0F, 2.0F); | ||||
|                             p.closeInventory(); | ||||
|                         } else { | ||||
|                             p.sendMessage(Main.prefix + "功能冷却中..."); | ||||
|                             p.closeInventory(); | ||||
|                         } | ||||
|                     } else { | ||||
|                         p.sendMessage(Main.prefix + "您只能在您的岛屿设置传送点地标."); | ||||
|                         p.playSound(p.getLocation(), Sound.ENTITY_BLAZE_DEATH, 1.0F, 2.0F); | ||||
|                         p.closeInventory(); | ||||
|                     } | ||||
|                 } | ||||
| 
 | ||||
|                 if (e.getRawSlot() == 5) { | ||||
|                     WarpGui.Opengui(p); | ||||
|                     p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0F, 2.0F); | ||||
|                 } | ||||
| 
 | ||||
|                 if (e.getRawSlot() == 7) { | ||||
|                     DemonAPI.sendTitle(p, 10, 20, 10, "§c§l空岛重置", "§6请联系群客服进行重置"); | ||||
|                     p.sendMessage(Main.prefix + "需要重置岛屿,请联系群内客服申请报备!!!"); | ||||
|                     p.sendMessage(Main.prefix + "需要重置岛屿,请联系群内客服申请报备!!!"); | ||||
|                     p.sendMessage(Main.prefix + "需要重置岛屿,请联系群内客服申请报备!!!"); | ||||
|                     p.playSound(p.getLocation(), Sound.ENTITY_BLAZE_DEATH, 1.6F, 1.8F); | ||||
|                     return; | ||||
|                 } | ||||
|                 if(itemName.contains("岛屿等级")){ | ||||
|                     p.sendMessage(Main.prefix + "请联系客服进行空岛重置报备!!!"); | ||||
|                     p.sendMessage(Main.prefix + "请联系客服进行空岛重置报备!!!"); | ||||
|                     p.sendMessage(Main.prefix + "请联系客服进行空岛重置报备!!!"); | ||||
|                     p.playSound(p.getLocation(), Sound.ENTITY_BLAZE_DEATH, 1.0F, 2.0F); | ||||
|                     p.closeInventory(); | ||||
|                     p.performCommand("is level"); | ||||
|                     p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.6F, 1.8F); | ||||
|                     return; | ||||
|                 } | ||||
|                 if(itemName.contains("岛屿保护")){ | ||||
| 
 | ||||
|                 if (e.getRawSlot() == 11) { | ||||
|                     p.performCommand("is top"); | ||||
|                     p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0F, 2.0F); | ||||
|                     p.closeInventory(); | ||||
|                     // 获取当前岛屿岛主UUID | ||||
|                     Island island = ASkyBlockAPI.getInstance().getIslandAt(location); | ||||
|                     if(island != null && !island.getOwner().equals(p.getUniqueId())){ | ||||
|                         p.sendMessage(Main.prefix + "您只能在自己岛屿上才能设置岛屿保护."); | ||||
|                         p.playSound(p.getLocation(), Sound.ENTITY_BLAZE_DEATH, 1.6F, 1.8F); | ||||
|                         return; | ||||
|                 } | ||||
| 
 | ||||
|                 if (e.getRawSlot() == 13) { | ||||
|                     Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "asadmin lock " + p.getName()); | ||||
|                     p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.6F, 1.8F); | ||||
|                     return; | ||||
|                     p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0F, 2.0F); | ||||
|                     p.closeInventory(); | ||||
|                 } | ||||
|                 if(itemName.contains("查看空岛成员")){ | ||||
| 
 | ||||
|                 if (e.getRawSlot() == 15) { | ||||
|                     LandTeamGui.Opengui(p); | ||||
|                     p.playSound(p.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1.6F, 1.8F); | ||||
|                     return; | ||||
|                     p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0F, 2.0F); | ||||
|                 } | ||||
|                 if(itemName.contains("挑战任务")){ | ||||
|                 if (e.getRawSlot() == 19) { | ||||
|                     LandInviteGui.Opengui(p); | ||||
|                     p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0F, 2.0F); | ||||
|                 } | ||||
|                 if (e.getRawSlot() == 25) { | ||||
|                     p.performCommand("challenge"); | ||||
|                     p.playSound(p.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1.6F, 1.8F); | ||||
|                     return; | ||||
|                     p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0F, 2.0F); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static void Opengui(Player p) { | ||||
|         Inventory inv = Bukkit.createInventory(null, 36, invtitle); | ||||
|         Island island = ASkyBlockAPI.getInstance().getIslandAt(p.getLocation()); | ||||
|         if (island == null) { | ||||
|             inv = Bukkit.createInventory(null, 9, invtitle); | ||||
|             inv.setItem(1, islandBack()); | ||||
|             inv.setItem(3, checkWarpList()); | ||||
|             inv.setItem(5, islandInvite()); | ||||
|             inv.setItem(8,backMenu()); | ||||
|         } else { | ||||
|             inv.setItem(1, islandBack()); | ||||
|             inv.setItem(3, setWarp()); | ||||
|             inv.setItem(5, checkWarpList()); | ||||
|             inv.setItem(7, resetIsland()); | ||||
|             inv.setItem(11, islandLevel(island)); | ||||
|             inv.setItem(13, islandlock(island)); | ||||
|             inv.setItem(15, islandlook(island)); | ||||
|             inv.setItem(19, islandInvite()); | ||||
|             inv.setItem(25, islandChallenge()); | ||||
|             inv.setItem(31,backMenu()); | ||||
|         } | ||||
|         Inventory inv = Bukkit.createInventory(null, 27, invtitle); | ||||
|         boolean butt = ASkyBlockAPI.getInstance().hasIsland(p.getUniqueId()); | ||||
| 
 | ||||
|         inv.setItem(1, itemUtil.backisland(butt)); | ||||
|         inv.setItem(3, itemUtil.setWarp()); | ||||
|         inv.setItem(5, itemUtil.warpList()); | ||||
|         inv.setItem(7, itemUtil.resetLand()); | ||||
|         inv.setItem(11, itemUtil.looklandlevel(p, butt)); | ||||
|         inv.setItem(13, itemUtil.islandlock()); | ||||
|         inv.setItem(15, itemUtil.islandlook(butt)); | ||||
|         inv.setItem(19, itemUtil.isLandinvite()); | ||||
|         inv.setItem(25, itemUtil.islandQuest()); | ||||
| 
 | ||||
|         p.openInventory(inv); | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack backMenu() { | ||||
|         ItemStack item = new ItemStack(Material.BOOK); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§a§l返回主页"); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     public void SetLocation(String key, Location loc) { | ||||
|         FileConfiguration yml = Main.plugin.getConfig(); | ||||
|         yml.set(key + ".world", loc.getWorld().getName()); | ||||
|         yml.set(key + ".x", loc.getX()); | ||||
|         yml.set(key + ".y", loc.getY()); | ||||
|         yml.set(key + ".z", loc.getZ()); | ||||
|         yml.set(key + ".yaw", loc.getYaw()); | ||||
|         yml.set(key + ".pitch", loc.getPitch()); | ||||
|         Main.plugin.saveConfig(); | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack islandInvite() { | ||||
|         ItemStack item = new ItemStack(Material.SLIME_BALL); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l邀请加入空岛"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§7 自动搜索周围玩家"); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §c点击邀请"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack islandBack() { | ||||
|         ItemStack item = new ItemStack(Material.GRASS); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l返回空岛"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §e点击返回空岛"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack islandChallenge() { | ||||
|         ItemStack item = new ItemStack(Material.DIAMOND_CHESTPLATE); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l挑战任务"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §e点击查看"); | ||||
|         meta.setLore(lore); | ||||
|         meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack islandLevel(Island island) { | ||||
|         ItemStack item = new ItemStack(Material.BEACON); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l岛屿等级"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         UUID islandOwner = island.getOwner(); | ||||
|         lore.add("§7 岛屿主人: §f" + PlayerManage.getUuidToName(islandOwner.toString())); | ||||
|         lore.add("§7 岛屿等级: §f" + ASkyBlockAPI.getInstance().getLongIslandLevel(islandOwner)); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §e点击刷新岛屿等级"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack islandlook(Island island) { | ||||
|         ItemStack item = new ItemStack(Material.EMPTY_MAP); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l查看空岛成员"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add(" §7岛屿成员:"); | ||||
|         List<UUID> uuidList = island.getMembers(); | ||||
|         uuidList.remove(0); | ||||
|         for (UUID uuid : uuidList) { | ||||
|             String name = PlayerManage.getUuidToName(uuid.toString()); | ||||
|             lore.add(" §f - " + name); | ||||
|         } | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §e点击查看"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack islandlock(Island island) { | ||||
|         ItemStack item = new ItemStack(Material.EYE_OF_ENDER); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l岛屿保护"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         if(!island.isLocked()){ | ||||
|             lore.add(" §7当前模式: §c封锁中"); | ||||
|         }else { | ||||
|             lore.add(" §7当前模式: §f开放中"); | ||||
|             item.setType(Material.ENDER_PEARL); | ||||
|         } | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §c点击设置"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack resetIsland() { | ||||
|         ItemStack item = new ItemStack(Material.LAVA_BUCKET); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l重置空岛"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §c点击重置"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack setWarp() { | ||||
|         ItemStack item = new ItemStack(Material.ANVIL); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l设置空岛地标"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §e点击设置"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack checkWarpList() { | ||||
|         ItemStack item = new ItemStack(Material.SIGN); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l空岛地标列表"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add(" §7数量: §f"+Main.gameManage.getWarpDataMap().size()+"个"); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §e点击查看"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -3,14 +3,11 @@ package me.Demon.AskyBlockWarps.Listener; | |||
| import cn.hamster3.cdapi.CDTimeAPI; | ||||
| import com.wasteofplastic.askyblock.ASkyBlockAPI; | ||||
| import com.wasteofplastic.askyblock.Island; | ||||
| import com.yaohun.playermanage.PlayerManage; | ||||
| import de.tr7zw.itemnbtapi.NBTItem; | ||||
| import me.Demon.AskyBlockWarps.Data.WarpData; | ||||
| import me.Demon.AskyBlockWarps.Main; | ||||
| import me.Demon.AskyBlockWarps.Util.itemUtil; | ||||
| import me.Demon.DemonPlugin.DemonAPI; | ||||
| import org.bukkit.Bukkit; | ||||
| import org.bukkit.Location; | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.Sound; | ||||
| import org.bukkit.entity.Player; | ||||
|  | @ -31,29 +28,22 @@ public class WarpGui implements Listener { | |||
| 
 | ||||
|     @EventHandler | ||||
|     public void onclick(InventoryClickEvent e) { | ||||
|         int rawSlot = e.getRawSlot(); | ||||
|         Inventory inv = e.getInventory(); | ||||
|         Player p = (Player) e.getWhoClicked(); | ||||
|         String name = p.getName(); | ||||
|         if (e.getInventory() != null && e.getInventory().getTitle().contains(invtitle)) { | ||||
|             e.setCancelled(true); | ||||
|             ItemStack item = e.getCurrentItem(); | ||||
|             if (rawSlot >= 0 && rawSlot < inv.getSize()) { | ||||
|                 if(DemonAPI.itemIsNull(item)){return;} | ||||
|             if (e.getRawSlot() >= 0 && e.getRawSlot() < e.getInventory().getSize() && !DemonAPI.itemIsNull(item) && !DemonAPI.itemIsLore(item)) { | ||||
|                 if (CDTimeAPI.getCD(p.getUniqueId(), "islandwarptp") < 0) { | ||||
|                     String playName = item.getItemMeta().getDisplayName().replace("§6§l传送到 §e", "").replace(" §6§l的空岛",""); | ||||
|                     UUID islandOwner = ASkyBlockAPI.getInstance().getOwner(p.getLocation()); | ||||
|                     p.teleport(Main.LandWarpLoc(playName)); | ||||
|                     p.sendMessage(Main.prefix + "您已传送至 §e" + Main.convertUUIDToName(islandOwner) + "§f 的空岛地标旁."); | ||||
|                     CDTimeAPI.setPlayerCD(p.getUniqueId(), "islandwarptp", 1000 * 3); | ||||
|                     p.playSound(p.getLocation(), Sound.ENTITY_ENDEREYE_DEATH, 1.0F, 2.0F); | ||||
|                     p.closeInventory(); | ||||
|                 } else { | ||||
|                     p.sendMessage(Main.prefix + "空岛地标传送冷却中..."); | ||||
|                     p.closeInventory(); | ||||
|                 p.playSound(p.getLocation(),Sound.BLOCK_COMPARATOR_CLICK,1,1); | ||||
|                 NBTItem nbtItem = new NBTItem(item); | ||||
|                 if(nbtItem.hasKey("warpKey")){ | ||||
|                     boolean butt = nbtItem.getBoolean("warpLock"); | ||||
|                     String warpKey = nbtItem.getString("warpKey"); | ||||
|                     if(butt){ | ||||
|                         p.sendMessage(Main.prefix + "您想访问的目标岛屿处于封锁状态,无法访问."); | ||||
|                         return; | ||||
|                     } | ||||
|                     WarpData warpData = Main.gameManage.getWarpData(warpKey); | ||||
|                     Location location = warpData.getLocation().add(0,0.5,0); | ||||
|                     p.teleport(location); | ||||
|                     p.sendMessage(Main.prefix + "您已传送至 §e" + warpKey + "§f 的空岛地标旁."); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | @ -64,10 +54,7 @@ public class WarpGui implements Listener { | |||
|         HashMap<String, WarpData> warpDataHashMap = Main.gameManage.getWarpDataMap(); | ||||
|         for (String key : warpDataHashMap.keySet()){ | ||||
|             WarpData warpData = warpDataHashMap.get(key); | ||||
|             ItemStack item = warpShow(warpData); | ||||
|             if(item != null) { | ||||
|                 inv.addItem(item); | ||||
|             } | ||||
|             inv.addItem(warpShow(warpData)); | ||||
|         } | ||||
|         p.openInventory(inv); | ||||
|     } | ||||
|  | @ -77,30 +64,12 @@ public class WarpGui implements Listener { | |||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l传送到 §e" + wData.getKey() + " §6§l的空岛"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         Island island = ASkyBlockAPI.getInstance().getIslandAt(wData.getLocation()); | ||||
|         if(island != null) { | ||||
|             lore.add(" §7岛屿等级: §f" + ASkyBlockAPI.getInstance().getLongIslandLevel(island.getOwner())); | ||||
|             boolean isBlockade = island.isLocked(); | ||||
|             if (isBlockade) { | ||||
|                 lore.add(" §7岛屿状态: §c封锁"); | ||||
|             } else { | ||||
|                 lore.add(" §7岛屿状态: §a开放"); | ||||
|             } | ||||
|             lore.add(" §7岛屿成员:"); | ||||
|             List<UUID> uuidList = island.getMembers(); | ||||
|             for (UUID uuid : uuidList) { | ||||
|                 String name = PlayerManage.getUuidToName(uuid.toString()); | ||||
|                 lore.add(" §f - " + name); | ||||
|             } | ||||
|         Island island = wData.getIsland(); | ||||
|         lore.add(" §7岛屿等级: §f"+island.getLevelHandicap()); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §e点击传送"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|             NBTItem nbtItem = new NBTItem(item); | ||||
|             nbtItem.setString("warpKey", wData.getKey()); | ||||
|             nbtItem.setBoolean("warpLock", isBlockade); | ||||
|             return nbtItem.getItem(); | ||||
|         } | ||||
|         return null; | ||||
|         return item; | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -1,7 +1,10 @@ | |||
| package me.Demon.AskyBlockWarps; | ||||
| 
 | ||||
| import me.Demon.AskyBlockWarps.Command.iswarpCommand; | ||||
| import me.Demon.AskyBlockWarps.Listener.*; | ||||
| import me.Demon.AskyBlockWarps.Listener.LandInviteGui; | ||||
| import me.Demon.AskyBlockWarps.Listener.LandTeamGui; | ||||
| import me.Demon.AskyBlockWarps.Listener.MainGui; | ||||
| import me.Demon.AskyBlockWarps.Listener.WarpGui; | ||||
| import me.Demon.AskyBlockWarps.Manage.GameManage; | ||||
| import org.bukkit.Bukkit; | ||||
| import org.bukkit.Location; | ||||
|  | @ -25,8 +28,28 @@ public class Main extends JavaPlugin { | |||
|         Bukkit.getServer().getPluginManager().registerEvents(new WarpGui(), plugin); | ||||
|         Bukkit.getServer().getPluginManager().registerEvents(new LandTeamGui(), plugin); | ||||
|         Bukkit.getServer().getPluginManager().registerEvents(new LandInviteGui(), plugin); | ||||
|         Bukkit.getServer().getPluginManager().registerEvents(new AcceptGui(), plugin); | ||||
|         getCommand("iswarps").setExecutor(new iswarpCommand()); | ||||
|         getCommand("iswarps").setTabCompleter(new iswarpCommand()); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void onDisable() { | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     public static String convertUUIDToName(UUID uuid) { | ||||
|         OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid); | ||||
|         return offlinePlayer.getName(); | ||||
|     } | ||||
| 
 | ||||
|     public static Location LandWarpLoc(String playName) { | ||||
|         FileConfiguration yml = Main.plugin.getConfig(); | ||||
|         String w = yml.getString("Stats." + playName + ".world"); | ||||
|         double x = yml.getDouble("Stats." + playName + ".x"); | ||||
|         double y = yml.getDouble("Stats." + playName + ".y"); | ||||
|         double z = yml.getDouble("Stats." + playName + ".z"); | ||||
|         float pi = (float) yml.getDouble("Stats." + playName + ".pitch"); | ||||
|         float ya = (float) yml.getDouble("Stats." + playName + ".yaw"); | ||||
|         return new Location(Bukkit.getWorld(w), x, y, z, ya, pi); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -54,6 +54,14 @@ public class GameManage { | |||
|         Main.plugin.saveConfig(); | ||||
|     } | ||||
| 
 | ||||
|     // 获取这个传送点是否开启 | ||||
|     public boolean getWarpSwitch(String key){ | ||||
|         if(warpDataMap.get(key) == null){ | ||||
|             return false; | ||||
|         } | ||||
|         return warpDataMap.get(key).isLocSwitch(); | ||||
|     } | ||||
| 
 | ||||
|     // 获取这个坐标点的坐标 | ||||
|     public Location getWarpLoc(String key){ | ||||
|         if(warpDataMap.get(key) == null){ | ||||
|  |  | |||
|  | @ -26,4 +26,154 @@ public class itemUtil { | |||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack addTeam(String name) { | ||||
|         ItemStack item = new ItemStack(Material.SIGN); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l玩家 §e" + name); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§c 请勿随意点击"); | ||||
|         lore.add("§c 请勿随意点击"); | ||||
|         lore.add("§c 请勿随意点击"); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §e点击邀请加入岛屿"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack warpShow(String name) { | ||||
|         ItemStack item = new ItemStack(Material.SIGN); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l传送到 §e" + name + " §6§l的空岛"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §e点击传送"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack looklandlevel(Player p,boolean butt) { | ||||
|         ItemStack item = new ItemStack(Material.BEACON); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l岛屿等级"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         if (butt) { | ||||
|             lore.add("§7 您的岛屿等级: §f" + ASkyBlockAPI.getInstance().getLongIslandLevel(p.getUniqueId())); | ||||
|         } else { | ||||
|             lore.add("§7 没有属于您的岛屿"); | ||||
|         } | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §e点击查看空岛排行"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack backisland(boolean butt) { | ||||
|         ItemStack item = new ItemStack(Material.ENDER_PORTAL_FRAME); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l返回空岛"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         if (butt) { | ||||
|             lore.add("§6▸ §e点击返回空岛"); | ||||
|         } else { | ||||
|             lore.add("§6▸ §c点击创建空岛"); | ||||
|         } | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack isLandinvite() { | ||||
|         ItemStack item = new ItemStack(Material.SLIME_BALL); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l邀请加入空岛"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §c点击邀请"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack islandlook(boolean butt) { | ||||
|         ItemStack item = new ItemStack(Material.EMPTY_MAP); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l查看空岛成员"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         if (butt) { | ||||
|             lore.add("§6▸ §e点击查看"); | ||||
|         } else { | ||||
|             lore.add("§6▸ §e没有属于您的岛屿"); | ||||
|         } | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack islandlock() { | ||||
|         ItemStack item = new ItemStack(Material.WATCH); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§c§l锁定岛屿"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §c点击锁定"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack resetLand() { | ||||
|         ItemStack item = new ItemStack(Material.LAVA_BUCKET); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l重置空岛"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §c点击重置"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack setWarp() { | ||||
|         ItemStack item = new ItemStack(Material.ANVIL); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l设置空岛地标"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §e点击设置"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack warpList() { | ||||
|         ItemStack item = new ItemStack(Material.SIGN); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l空岛地标列表"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §e点击查看"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|     public static ItemStack islandQuest() { | ||||
|         ItemStack item = new ItemStack(Material.BOOK); | ||||
|         ItemMeta meta = item.getItemMeta(); | ||||
|         meta.setDisplayName("§6§l挑战任务"); | ||||
|         List<String> lore = new ArrayList<>(); | ||||
|         lore.add("§r"); | ||||
|         lore.add("§6▸ §e点击查看"); | ||||
|         meta.setLore(lore); | ||||
|         item.setItemMeta(meta); | ||||
|         return item; | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| name: AskyBlockWarps | ||||
| main: me.Demon.AskyBlockWarps.Main | ||||
| version: 1.1.0 | ||||
| version: 1.0 | ||||
| commands: | ||||
|   iswarps: | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user