示例#1
0
 private void setBiome(CommandSender sender, IslandInfo islandInfo, String biome) {
   if (uSkyBlock.getInstance().setBiome(islandInfo.getIslandLocation(), biome)) {
     islandInfo.setBiome(biome);
     sender.sendMessage(
         tr("\u00a7eChanged biome of {0}s island to {1}.", islandInfo.getLeader(), biome));
   } else {
     islandInfo.setBiome("OCEAN");
     sender.sendMessage(
         tr("\u00a7eChanged biome of {0}s island to OCEAN.", islandInfo.getLeader()));
   }
   sender.sendMessage(tr("\u00a7aYou may need to go to spawn, or relog, to see the changes."));
 }
 @Override
 public boolean execute(
     CommandSender sender, String alias, Map<String, Object> data, String... args) {
   if (args.length == 2) {
     String island = args[0];
     String playerName = args[1];
     PlayerInfo islandPlayer = plugin.getPlayerInfo(island);
     PlayerInfo playerInfo = plugin.getPlayerInfo(playerName);
     if (islandPlayer == null || !islandPlayer.getHasIsland()) {
       sender.sendMessage(tr("\u00a74Player {0} has no island to transfer!", island));
       return false;
     }
     IslandInfo islandInfo = plugin.getIslandInfo(islandPlayer);
     if (islandInfo == null) {
       sender.sendMessage(tr("\u00a74Player {0} has no island to transfer!", island));
       return false;
     }
     if (playerInfo != null && playerInfo.getHasIsland()) {
       sender.sendMessage(
           tr(
               "\u00a7ePlayer \u00a7d{0}\u00a7e already has an island.\u00a7eUse \u00a7d/usb island remove <name>\u00a7e to remove him first.",
               playerName));
       return false;
     }
     playerInfo.setJoinParty(islandInfo.getIslandLocation());
     Location homeLocation = islandPlayer.getHomeLocation();
     islandInfo.removeMember(islandPlayer); // Remove leader
     islandInfo.setupPartyLeader(playerInfo.getPlayerName()); // Promote member
     playerInfo.setHomeLocation(homeLocation);
     islandPlayer.save();
     playerInfo.save();
     WorldGuardHandler.updateRegion(sender, islandInfo);
     islandInfo.sendMessageToIslandGroup(
         tr("\u00a7bLeadership transferred by {0}\u00a7b to {1}", sender.getName(), playerName));
     return true;
   }
   return false;
 }